diff options
author | Robert Lytton <robert@xmos.com> | 2013-10-11 10:26:48 +0000 |
---|---|---|
committer | Robert Lytton <robert@xmos.com> | 2013-10-11 10:26:48 +0000 |
commit | fb312f9f5a9f8cd8be1dbeaf011768e186eb8f98 (patch) | |
tree | f3838961471bd5139a5220a3e126dcdcfc5bae53 /test/CodeGen | |
parent | 7b5376659c1c822960a5cb56d5e1417cfd74673f (diff) | |
download | external_llvm-fb312f9f5a9f8cd8be1dbeaf011768e186eb8f98.zip external_llvm-fb312f9f5a9f8cd8be1dbeaf011768e186eb8f98.tar.gz external_llvm-fb312f9f5a9f8cd8be1dbeaf011768e186eb8f98.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192432 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen')
-rw-r--r-- | test/CodeGen/XCore/threads.ll | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/CodeGen/XCore/threads.ll b/test/CodeGen/XCore/threads.ll index b56b16b..c50da1d 100644 --- a/test/CodeGen/XCore/threads.ll +++ b/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 |