From 5112b71126a133b744b11b50d60fcb89d005513d Mon Sep 17 00:00:00 2001 From: Aditya Nandakumar Date: Mon, 9 Sep 2019 22:51:41 +0000 Subject: [PATCH] [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 --- llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp | 2 ++ 1 file changed, 2 insertions(+) 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; -- 2.7.4