[llvm] r371465 - [GlobalISel]: Fix a bug where we could dereference None

Quentin Colombet via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 9 15:54:42 PDT 2019


Do you have a test case for this?

> On Sep 9, 2019, at 3:51 PM, Aditya Nandakumar via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> 
> Author: aditya_nandakumar
> Date: Mon Sep  9 15:51:41 2019
> New Revision: 371465
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=371465&view=rev
> Log:
> [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.
> 
> Modified:
>    llvm/trunk/lib/CodeGen/GlobalISel/GISelKnownBits.cpp
> 
> Modified: llvm/trunk/lib/CodeGen/GlobalISel/GISelKnownBits.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalISel/GISelKnownBits.cpp?rev=371465&r1=371464&r2=371465&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/GlobalISel/GISelKnownBits.cpp (original)
> +++ llvm/trunk/lib/CodeGen/GlobalISel/GISelKnownBits.cpp Mon Sep  9 15:51:41 2019
> @@ -140,6 +140,8 @@ void GISelKnownBits::computeKnownBitsImp
>   }
>   case TargetOpcode::G_CONSTANT: {
>     auto CstVal = getConstantVRegVal(R, MRI);
> +    if (!CstVal)
> +      break;
>     Known.One = *CstVal;
>     Known.Zero = ~Known.One;
>     break;
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list