summaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/pr12338.ll
diff options
context:
space:
mode:
authorNuno Lopes <nunoplopes@sapo.pt>2012-06-08 22:30:05 +0000
committerNuno Lopes <nunoplopes@sapo.pt>2012-06-08 22:30:05 +0000
commit0f68fbb9e5a6ccc59c3c75581d4e594347ca4c92 (patch)
treea165987d68fc44ff8f75bc5e685784f4f66b6ab5 /test/Transforms/InstCombine/pr12338.ll
parent791e2e0867d1e6fcb9c6f651da89f57043bc6c4a (diff)
downloadllvm-0f68fbb9e5a6ccc59c3c75581d4e594347ca4c92.tar.gz
llvm-0f68fbb9e5a6ccc59c3c75581d4e594347ca4c92.tar.bz2
llvm-0f68fbb9e5a6ccc59c3c75581d4e594347ca4c92.tar.xz
canonicalize:
-%a + 42 into 42 - %a previously we were emitting: -(%a + 42) This fixes the infinite loop in PR12338. The generated code is still not perfect, though. Will work on that next git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158237 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine/pr12338.ll')
-rw-r--r--test/Transforms/InstCombine/pr12338.ll24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/pr12338.ll b/test/Transforms/InstCombine/pr12338.ll
new file mode 100644
index 0000000000..2b5c8f8a74
--- /dev/null
+++ b/test/Transforms/InstCombine/pr12338.ll
@@ -0,0 +1,24 @@
+; RUN: opt < %s -instcombine -S | FileCheck %s
+
+define void @entry() nounwind {
+entry:
+ br label %for.cond
+
+for.cond:
+ %local = phi <1 x i32> [ <i32 0>, %entry ], [ %phi2, %cond.end47 ]
+; CHECK: sub <1 x i32> <i32 92>, %local
+ %phi3 = sub <1 x i32> zeroinitializer, %local
+ br label %cond.end
+
+cond.false:
+ br label %cond.end
+
+cond.end:
+ %cond = phi <1 x i32> [ %phi3, %for.cond ], [ undef, %cond.false ]
+ br label %cond.end47
+
+cond.end47:
+ %sum = add <1 x i32> %cond, <i32 92>
+ %phi2 = sub <1 x i32> zeroinitializer, %sum
+ br label %for.cond
+}