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-Tag: llvmorg-11-init~9613 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5112b71126a133b744b11b50d60fcb89d005513d;p=platform%2Fupstream%2Fllvm.git [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. llvm-svn: 371465 --- diff --git a/llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp b/llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp index 7db6465..c0391f7 100644 --- a/llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp +++ b/llvm/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;