[GlobalISel]: Fix a bug where we could dereference None
authorAditya Nandakumar <aditya_nandakumar@apple.com>
Mon, 9 Sep 2019 22:51:41 +0000 (22:51 +0000)
committerAditya Nandakumar <aditya_nandakumar@apple.com>
Mon, 9 Sep 2019 22:51:41 +0000 (22:51 +0000)
getConstantVRegVal returns None when dealing with constants > 64 bits.
Don't assume we always have a value in GISelKnownBits.

llvm-svn: 371465

llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp

index 7db6465..c0391f7 100644 (file)
@@ -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;