[PATCH] D23594: SCEV: Don't assert about non-SCEV-able value in isSCEVExprNeverPoison() (PR28932)
Hans Wennborg via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 17 15:58:19 PDT 2016
This revision was automatically updated to reflect the committed changes.
hans marked an inline comment as done.
Closed by commit rL278999: SCEV: Don't assert about non-SCEV-able value in isSCEVExprNeverPoison()… (authored by hans).
Changed prior to commit:
https://reviews.llvm.org/D23594?vs=68438&id=68444#toc
Repository:
rL LLVM
https://reviews.llvm.org/D23594
Files:
llvm/trunk/lib/Analysis/ScalarEvolution.cpp
llvm/trunk/test/Analysis/ScalarEvolution/flags-from-poison.ll
Index: llvm/trunk/test/Analysis/ScalarEvolution/flags-from-poison.ll
===================================================================
--- llvm/trunk/test/Analysis/ScalarEvolution/flags-from-poison.ll
+++ llvm/trunk/test/Analysis/ScalarEvolution/flags-from-poison.ll
@@ -688,3 +688,52 @@
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
+}
Index: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
===================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp
@@ -4866,6 +4866,10 @@
// 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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23594.68444.patch
Type: text/x-patch
Size: 2923 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160817/1e2c8bdd/attachment.bin>
More information about the llvm-commits
mailing list