aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDan Gohman <sunfish@mozilla.com>2014-03-05 17:27:17 -0800
committerDan Gohman <sunfish@mozilla.com>2014-03-05 17:30:30 -0800
commitd9003e75353416cfcdb9f03d5fba7e1060a35196 (patch)
treeba9901d4b25066cb4fb07898ed5b17ec718adfc4 /test
parent0e2a08d6c55b8b020fb84a1277e2fccf7767c784 (diff)
Teach phi translation to also look through bitcasts.
This fixes a regression introduced in d95cd364f0c049d6c1b8d78746d44c00ed2f69f2; when regular expression translation looks through bitcasts but phi translation doesn't, phi translation may fail to properly detect dependencies.
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/JS/phi.ll22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/CodeGen/JS/phi.ll b/test/CodeGen/JS/phi.ll
new file mode 100644
index 0000000000..517f73cba3
--- /dev/null
+++ b/test/CodeGen/JS/phi.ll
@@ -0,0 +1,22 @@
+; RUN: llc -march=js < %s | FileCheck %s
+
+; Phi lowering should check for dependency cycles, including looking through
+; bitcasts, and emit extra copies as needed.
+
+; CHECK: while(1) {
+; CHECK: $k$phi = $j;$j$phi = $k;$k = $k$phi;$j = $j$phi;
+; CHECK: }
+define void @foo(float* nocapture %p, i32* %j.init, i32* %k.init) {
+entry:
+ br label %for.body
+
+for.body:
+ %j = phi i32* [ %j.init, %entry ], [ %k.cast, %more ]
+ %k = phi i32* [ %k.init, %entry ], [ %j.cast, %more ]
+ br label %more
+
+more:
+ %j.cast = bitcast i32* %j to i32*
+ %k.cast = bitcast i32* %k to i32*
+ br label %for.body
+}