aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/ARM
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2010-08-17 01:20:36 +0000
committerEvan Cheng <evan.cheng@apple.com>2010-08-17 01:20:36 +0000
commit97b9b97853d7e4fbb5c8460ef28126013c76e9a9 (patch)
tree00177661907fa80d2ee615063908e042e57911b9 /test/CodeGen/ARM
parent922157c83440e0197e7fd962cf7030491a8069b1 (diff)
PHI elimination should not break back edge. It can cause some significant code placement issues. rdar://8263994
good: LBB0_2: mov r2, r0 . . . mov r1, r2 bne LBB0_2 bad: LBB0_2: mov r2, r0 . . . @ BB#3: mov r1, r2 b LBB0_2 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111221 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/ARM')
-rw-r--r--test/CodeGen/ARM/code-placement.ll29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/CodeGen/ARM/code-placement.ll b/test/CodeGen/ARM/code-placement.ll
new file mode 100644
index 0000000000..25c556889f
--- /dev/null
+++ b/test/CodeGen/ARM/code-placement.ll
@@ -0,0 +1,29 @@
+; RUN: llc < %s -mtriple=armv7-apple-darwin | FileCheck %s
+; PHI elimination shouldn't break backedge.
+; rdar://8263994
+
+%struct.list_data_s = type { i16, i16 }
+%struct.list_head = type { %struct.list_head*, %struct.list_data_s* }
+
+define arm_apcscc %struct.list_head* @t(%struct.list_head* %list) nounwind {
+entry:
+ %0 = icmp eq %struct.list_head* %list, null
+ br i1 %0, label %bb2, label %bb
+
+bb:
+; CHECK: LBB0_2:
+; CHECK: bne LBB0_2
+; CHECK-NOT: b LBB0_2
+; CHECK: bx lr
+ %list_addr.05 = phi %struct.list_head* [ %2, %bb ], [ %list, %entry ]
+ %next.04 = phi %struct.list_head* [ %list_addr.05, %bb ], [ null, %entry ]
+ %1 = getelementptr inbounds %struct.list_head* %list_addr.05, i32 0, i32 0
+ %2 = load %struct.list_head** %1, align 4
+ store %struct.list_head* %next.04, %struct.list_head** %1, align 4
+ %3 = icmp eq %struct.list_head* %2, null
+ br i1 %3, label %bb2, label %bb
+
+bb2:
+ %next.0.lcssa = phi %struct.list_head* [ null, %entry ], [ %list_addr.05, %bb ]
+ ret %struct.list_head* %next.0.lcssa
+}