From d9003e75353416cfcdb9f03d5fba7e1060a35196 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 5 Mar 2014 17:27:17 -0800 Subject: 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. --- test/CodeGen/JS/phi.ll | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 test/CodeGen/JS/phi.ll (limited to 'test') 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 +} -- cgit v1.2.3-18-g5258