From: Aditya Nandakumar Date: Mon, 9 Sep 2019 22:51:41 +0000 (+0000) Subject: [GlobalISel]: Fix a bug where we could dereference None X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d417693e472d373ad0b6a3bcce04a1184ab07bfc;p=llvm [GlobalISel]: Fix a bug where we could dereference None getConstantVRegVal returns None when dealing with constants > 64 bits. Don't assume we always have a value in GISelKnownBits. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371465 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/GlobalISel/GISelKnownBits.cpp b/lib/CodeGen/GlobalISel/GISelKnownBits.cpp index 7db64654e42..c0391f7771f 100644 --- a/lib/CodeGen/GlobalISel/GISelKnownBits.cpp +++ b/lib/CodeGen/GlobalISel/GISelKnownBits.cpp @@ -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;