Skip to content

Commit

Permalink
[GlobalISel]: Fix a bug where we could dereference None
Browse files Browse the repository at this point in the history
getConstantVRegVal returns None when dealing with constants > 64 bits.
Don't assume we always have a value in GISelKnownBits.

llvm-svn: 371465
  • Loading branch information
Aditya Nandakumar committed Sep 9, 2019
1 parent 2ca7370 commit 5112b71
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ void GISelKnownBits::computeKnownBitsImpl(Register R, KnownBits &Known,
}
case TargetOpcode::G_CONSTANT: {
auto CstVal = getConstantVRegVal(R, MRI);
if (!CstVal)
break;
Known.One = *CstVal;
Known.Zero = ~Known.One;
break;
Expand Down

0 comments on commit 5112b71

Please sign in to comment.