[PATCH] D51770: [IndVars] Set Changed when we delete dead instructions. PR38855
Max Kazantsev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 7 00:25:48 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL341633: [IndVars] Set Changed when we delete dead instructions. PR38855 (authored by mkazantsev, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D51770?vs=164361&id=164362#toc
Repository:
rL LLVM
https://reviews.llvm.org/D51770
Files:
llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp
llvm/trunk/test/Transforms/IndVarSimplify/pr38855.ll
Index: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -2491,7 +2491,7 @@
while (!DeadInsts.empty())
if (Instruction *Inst =
dyn_cast_or_null<Instruction>(DeadInsts.pop_back_val()))
- RecursivelyDeleteTriviallyDeadInstructions(Inst, TLI);
+ Changed |= RecursivelyDeleteTriviallyDeadInstructions(Inst, TLI);
// The Rewriter may not be used from this point on.
Index: llvm/trunk/test/Transforms/IndVarSimplify/pr38855.ll
===================================================================
--- llvm/trunk/test/Transforms/IndVarSimplify/pr38855.ll
+++ llvm/trunk/test/Transforms/IndVarSimplify/pr38855.ll
@@ -0,0 +1,24 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S -inline -functionattrs -indvars < %s | FileCheck %s
+
+; Check that the invalidation happens correctly and the test does not crash.
+define void @f2() {
+; CHECK-LABEL: @f2(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br label [[FOR_COND:%.*]]
+; CHECK: for.cond:
+; CHECK-NEXT: br label [[FOR_COND]]
+;
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.cond, %entry
+ %a.0 = phi i32 [ 1, %entry ], [ 0, %for.cond ]
+ call void @f1(i32 %a.0)
+ br label %for.cond
+}
+
+define internal void @f1(i32 %p1) noinline {
+entry:
+ ret void
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51770.164362.patch
Type: text/x-patch
Size: 1528 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180907/3c564f58/attachment.bin>
More information about the llvm-commits
mailing list