summaryrefslogtreecommitdiff
path: root/test/Transforms/Reassociate
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2012-06-08 13:37:30 +0000
committerDuncan Sands <baldrick@free.fr>2012-06-08 13:37:30 +0000
commit69938a85bdbeef1c5b60aa778e361586bec36fb7 (patch)
tree5a0a6b1d603c5ea39f7cc745c682426f453575e5 /test/Transforms/Reassociate
parent2563ad294fb27baaef2ef12f7829b8289c6925ae (diff)
downloadllvm-69938a85bdbeef1c5b60aa778e361586bec36fb7.tar.gz
llvm-69938a85bdbeef1c5b60aa778e361586bec36fb7.tar.bz2
llvm-69938a85bdbeef1c5b60aa778e361586bec36fb7.tar.xz
Revert commit 158073 while waiting for a fix. The issue is that reassociate
can move instructions within the instruction list. If the instruction just happens to be the one the basic block iterator is pointing to, and it is moved to a different basic block, then we get into an infinite loop due to the iterator running off the end of the basic block (for some reason this doesn't fire any assertions). Original commit message: Grab-bag of reassociate tweaks. Unify handling of dead instructions and instructions to reoptimize. Exploit this to more systematically eliminate dead instructions (this isn't very useful in practice but is convenient for analysing some testcase I am working on). No need for WeakVH any more: use an AssertingVH instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158199 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/Reassociate')
-rw-r--r--test/Transforms/Reassociate/2012-06-08-InfiniteLoop.ll21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/Transforms/Reassociate/2012-06-08-InfiniteLoop.ll b/test/Transforms/Reassociate/2012-06-08-InfiniteLoop.ll
new file mode 100644
index 0000000000..6e62a287e0
--- /dev/null
+++ b/test/Transforms/Reassociate/2012-06-08-InfiniteLoop.ll
@@ -0,0 +1,21 @@
+; RUN: opt < %s -reassociate -disable-output
+; PR13041
+
+define void @foo() {
+entry:
+ br label %while.cond
+
+while.cond: ; preds = %while.body, %entry
+ %b.0 = phi i32 [ undef, %entry ], [ %sub2, %while.body ]
+ %c.0 = phi i32 [ undef, %entry ], [ %sub3, %while.body ]
+ br i1 undef, label %while.end, label %while.body
+
+while.body: ; preds = %while.cond
+ %sub = sub nsw i32 0, %b.0
+ %sub2 = sub nsw i32 %sub, %c.0
+ %sub3 = sub nsw i32 0, %c.0
+ br label %while.cond
+
+while.end: ; preds = %while.cond
+ ret void
+}