summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/XCore/threads.ll
diff options
context:
space:
mode:
authorRobert Lytton <robert@xmos.com>2013-10-11 10:26:48 +0000
committerRobert Lytton <robert@xmos.com>2013-10-11 10:26:48 +0000
commit9715375c25bc1f985fd2dbbbad61fd43e334a1e9 (patch)
tree48c2717eea68c5f2fa81333de70466a7aea7bce7 /llvm/test/CodeGen/XCore/threads.ll
parent3139db02c8cdf83a71f04a9aeb4e295031b1e57c (diff)
downloadbcm5719-llvm-9715375c25bc1f985fd2dbbbad61fd43e334a1e9.tar.gz
bcm5719-llvm-9715375c25bc1f985fd2dbbbad61fd43e334a1e9.zip
XCore target: fix bug in XCoreLowerThreadLocal.cpp
When a ConstantExpr which uses a thread local is part of a PHI node instruction, the insruction that replaces the ConstantExpr must be inserted in the predecessor block, in front of the terminator instruction. If the predecessor block has multiple successors, the edge is first split. llvm-svn: 192432
Diffstat (limited to 'llvm/test/CodeGen/XCore/threads.ll')
-rw-r--r--llvm/test/CodeGen/XCore/threads.ll39
1 files changed, 39 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/XCore/threads.ll b/llvm/test/CodeGen/XCore/threads.ll
index b56b16b5fa9..c50da1d5934 100644
--- a/llvm/test/CodeGen/XCore/threads.ll
+++ b/llvm/test/CodeGen/XCore/threads.ll
@@ -1,4 +1,5 @@
; RUN: llc -march=xcore < %s | FileCheck %s
+; RUN: llc -march=xcore -O=0 < %s | FileCheck %s -check-prefix=PHINODE
declare i8 addrspace(1)* @llvm.xcore.getst.p1i8.p1i8(i8 addrspace(1)* %r)
declare void @llvm.xcore.msync.p1i8(i8 addrspace(1)* %r)
@@ -102,5 +103,43 @@ define i32 @f_tlExpr () {
i32 ptrtoint( i32* getelementptr inbounds ([2 x i32]* @tle, i32 0, i32 0) to i32))
}
+define void @phiNode1() {
+; N.B. lowering of duplicate constexpr in a PHI node requires -O=0
+; PHINODE-LABEL: phiNode1:
+; PHINODE: get r11, id
+; PHINODE-LABEL: .LBB11_1:
+; PHINODE: get r11, id
+; PHINODE: bu .LBB11_1
+entry:
+ br label %ConstantExpPhiNode
+ConstantExpPhiNode:
+ %ptr = phi i32* [ getelementptr inbounds ([3 x i32]* @tl, i32 0, i32 0), %entry ],
+ [ getelementptr inbounds ([3 x i32]* @tl, i32 0, i32 0), %ConstantExpPhiNode ]
+ br label %ConstantExpPhiNode
+exit:
+ ret void
+}
+
+define void @phiNode2( i1 %bool) {
+; N.B. check an extra 'Node_crit_edge' (LBB12_1) is inserted
+; PHINODE-LABEL: phiNode2:
+; PHINODE: bf {{r[0-9]}}, .LBB12_3
+; PHINODE: bu .LBB12_1
+; PHINODE-LABEL: .LBB12_1:
+; PHINODE: get r11, id
+; PHINODE-LABEL: .LBB12_2:
+; PHINODE: get r11, id
+; PHINODE: bu .LBB12_2
+; PHINODE-LABEL: .LBB12_3:
+entry:
+ br i1 %bool, label %ConstantExpPhiNode, label %exit
+ConstantExpPhiNode:
+ %ptr = phi i32* [ getelementptr inbounds ([3 x i32]* @tl, i32 0, i32 0), %entry ],
+ [ getelementptr inbounds ([3 x i32]* @tl, i32 0, i32 0), %ConstantExpPhiNode ]
+ br label %ConstantExpPhiNode
+exit:
+ ret void
+}
+
; CHECK-LABEL: tl:
; CHECK: .space 96
OpenPOWER on IntegriCloud