[llvm-branch-commits] [llvm-branch] r279093 - Merging r278999:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Aug 18 10:34:02 PDT 2016


Author: hans
Date: Thu Aug 18 12:34:01 2016
New Revision: 279093

URL: http://llvm.org/viewvc/llvm-project?rev=279093&view=rev
Log:
Merging r278999:
------------------------------------------------------------------------
r278999 | hans | 2016-08-17 15:50:18 -0700 (Wed, 17 Aug 2016) | 3 lines

SCEV: Don't assert about non-SCEV-able value in isSCEVExprNeverPoison() (PR28932)

Differential Revision: https://reviews.llvm.org/D23594
------------------------------------------------------------------------

Modified:
    llvm/branches/release_39/   (props changed)
    llvm/branches/release_39/lib/Analysis/ScalarEvolution.cpp
    llvm/branches/release_39/test/Analysis/ScalarEvolution/flags-from-poison.ll

Propchange: llvm/branches/release_39/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Aug 18 12:34:01 2016
@@ -1,3 +1,3 @@
 /llvm/branches/Apple/Pertwee:110850,110961
 /llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,275868-275870,275879,275898,275928,275935,275946,275978,275981,276015,276051,276077,276109,276119,276181,276209,276236-276237,276358,276364,276368,276389,276435,276438,276479,276510,276648,276676,276712,276740,276823,276956,276980,277093,277114,277135,277371,277399,277500,277504,277625,277691,277693,277773,278002,278086,278133,278157,278370,278413,278558,278569,278571,278573,278575,278584,278841,278900,278938
+/llvm/trunk:155241,275868-275870,275879,275898,275928,275935,275946,275978,275981,276015,276051,276077,276109,276119,276181,276209,276236-276237,276358,276364,276368,276389,276435,276438,276479,276510,276648,276676,276712,276740,276823,276956,276980,277093,277114,277135,277371,277399,277500,277504,277625,277691,277693,277773,278002,278086,278133,278157,278370,278413,278558,278569,278571,278573,278575,278584,278841,278900,278938,278999

Modified: llvm/branches/release_39/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_39/lib/Analysis/ScalarEvolution.cpp?rev=279093&r1=279092&r2=279093&view=diff
==============================================================================
--- llvm/branches/release_39/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/branches/release_39/lib/Analysis/ScalarEvolution.cpp Thu Aug 18 12:34:01 2016
@@ -4822,6 +4822,10 @@ bool ScalarEvolution::isSCEVExprNeverPoi
   // from different loops, so that we know which loop to prove that I is
   // executed in.
   for (unsigned OpIndex = 0; OpIndex < I->getNumOperands(); ++OpIndex) {
+    // I could be an extractvalue from a call to an overflow intrinsic.
+    // TODO: We can do better here in some cases.
+    if (!isSCEVable(I->getOperand(OpIndex)->getType()))
+      return false;
     const SCEV *Op = getSCEV(I->getOperand(OpIndex));
     if (auto *AddRec = dyn_cast<SCEVAddRecExpr>(Op)) {
       bool AllOtherOpsLoopInvariant = true;

Modified: llvm/branches/release_39/test/Analysis/ScalarEvolution/flags-from-poison.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_39/test/Analysis/ScalarEvolution/flags-from-poison.ll?rev=279093&r1=279092&r2=279093&view=diff
==============================================================================
--- llvm/branches/release_39/test/Analysis/ScalarEvolution/flags-from-poison.ll (original)
+++ llvm/branches/release_39/test/Analysis/ScalarEvolution/flags-from-poison.ll Thu Aug 18 12:34:01 2016
@@ -688,3 +688,52 @@ outer.be:
 exit:
   ret void
 }
+
+
+; PR28932: Don't assert on non-SCEV-able value %2.
+%struct.anon = type { i8* }
+ at a = common global %struct.anon* null, align 8
+ at b = common global i32 0, align 4
+declare { i32, i1 } @llvm.ssub.with.overflow.i32(i32, i32)
+declare void @llvm.trap()
+define i32 @pr28932() {
+entry:
+  %.pre = load %struct.anon*, %struct.anon** @a, align 8
+  %.pre7 = load i32, i32* @b, align 4
+  br label %for.cond
+
+for.cond:                                         ; preds = %cont6, %entry
+  %0 = phi i32 [ %3, %cont6 ], [ %.pre7, %entry ]
+  %1 = phi %struct.anon* [ %.ph, %cont6 ], [ %.pre, %entry ]
+  %tobool = icmp eq %struct.anon* %1, null
+  %2 = tail call { i32, i1 } @llvm.ssub.with.overflow.i32(i32 %0, i32 1)
+  %3 = extractvalue { i32, i1 } %2, 0
+  %4 = extractvalue { i32, i1 } %2, 1
+  %idxprom = sext i32 %3 to i64
+  %5 = getelementptr inbounds %struct.anon, %struct.anon* %1, i64 0, i32 0
+  %6 = load i8*, i8** %5, align 8
+  %7 = getelementptr inbounds i8, i8* %6, i64 %idxprom
+  %8 = load i8, i8* %7, align 1
+  br i1 %tobool, label %if.else, label %if.then
+
+if.then:                                          ; preds = %for.cond
+  br i1 %4, label %trap, label %cont6
+
+trap:                                             ; preds = %if.else, %if.then
+  tail call void @llvm.trap()
+  unreachable
+
+if.else:                                          ; preds = %for.cond
+  br i1 %4, label %trap, label %cont1
+
+cont1:                                            ; preds = %if.else
+  %conv5 = sext i8 %8 to i64
+  %9 = inttoptr i64 %conv5 to %struct.anon*
+  store %struct.anon* %9, %struct.anon** @a, align 8
+  br label %cont6
+
+cont6:                                            ; preds = %cont1, %if.then
+  %.ph = phi %struct.anon* [ %9, %cont1 ], [ %1, %if.then ]
+  store i32 %3, i32* @b, align 4
+  br label %for.cond
+}




More information about the llvm-branch-commits mailing list