]> granicus.if.org Git - llvm/commitdiff
[SCCP] Partially propagate informations when the input is not fully defined.
authorDavide Italiano <davide@freebsd.org>
Tue, 10 May 2016 19:49:47 +0000 (19:49 +0000)
committerDavide Italiano <davide@freebsd.org>
Tue, 10 May 2016 19:49:47 +0000 (19:49 +0000)
With this patch:
%r1 = lshr i64 -1, 4294967296 -> undef

Before this patch:
%r1 = lshr i64 -1, 4294967296 -> 0

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269105 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/SCCP.cpp
test/Transforms/ConstProp/shift.ll

index 75414ef3864d1563ef6b73c8eeb7af552cd05ecd..49748ff4c439a3b1e22abf388ceb385666dd7fa6 100644 (file)
@@ -1331,6 +1331,9 @@ bool SCCPSolver::ResolvedUndefsIn(Function &F) {
         }
 
         Op1LV = getValueState(I.getOperand(1));
+
+        if (!Op0LV.isUndefined() && !Op1LV.isUndefined())
+          break;
       }
       // If this is an instructions whose result is defined even if the input is
       // not fully defined, propagate the information.
index de23fe98ad8752c1dc0c1afbfd55b413b0c3247f..91027096dd5d3c773dc3f00f14bd5cad41ea2db2 100644 (file)
@@ -1,4 +1,5 @@
 ; RUN: opt < %s -constprop -S | FileCheck %s
+; RUN: opt < %s -sccp -S | FileCheck %s
 
 ; CHECK-LABEL: shift_undef_64
 define void @shift_undef_64(i64* %p) {