diff options
| author | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2017-09-28 22:08:25 +0000 |
|---|---|---|
| committer | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2017-09-28 22:08:25 +0000 |
| commit | df86855f61bb6ad41f683a5d615f77ab207fade4 (patch) | |
| tree | 54dd7b2a42bcc2a677c4061134e472bc8d79e4f8 /llvm | |
| parent | e8c0e558a40a68aa6db8b6436f391c42329b0481 (diff) | |
| download | bcm5719-llvm-df86855f61bb6ad41f683a5d615f77ab207fade4.tar.gz bcm5719-llvm-df86855f61bb6ad41f683a5d615f77ab207fade4.zip | |
[SystemZ] Fix fall-out from r314428
The expensive-checks build bot found a problem with the r314428 commit:
if CC is live after a ATOMIC_CMP_SWAPW instruction, it needs to be
marked as live-in to the block after the loop the pseudo gets expanded
to. This actually fixes a code-gen bug as well, since if the CC isn't
live, the CR and JLH are merged to a CRJLH which doesn't actually set
the condition code any more.
llvm-svn: 314465
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/Target/SystemZ/SystemZISelLowering.cpp | 6 | ||||
| -rw-r--r-- | llvm/test/CodeGen/SystemZ/cmpxchg-01.ll | 3 | ||||
| -rw-r--r-- | llvm/test/CodeGen/SystemZ/cmpxchg-02.ll | 3 |
3 files changed, 10 insertions, 2 deletions
diff --git a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp index be7c5e430fc..d49d7316e68 100644 --- a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp +++ b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp @@ -6027,6 +6027,12 @@ SystemZTargetLowering::emitAtomicCmpSwapW(MachineInstr &MI, MBB->addSuccessor(LoopMBB); MBB->addSuccessor(DoneMBB); + // If the CC def wasn't dead in the ATOMIC_CMP_SWAPW, mark CC as live-in + // to the block after the loop. At this point, CC may have been defined + // either by the CR in LoopMBB or by the CS in SetMBB. + if (!MI.registerDefIsDead(SystemZ::CC)) + DoneMBB->addLiveIn(SystemZ::CC); + MI.eraseFromParent(); return DoneMBB; } diff --git a/llvm/test/CodeGen/SystemZ/cmpxchg-01.ll b/llvm/test/CodeGen/SystemZ/cmpxchg-01.ll index 8257a36ddde..afcf3463255 100644 --- a/llvm/test/CodeGen/SystemZ/cmpxchg-01.ll +++ b/llvm/test/CodeGen/SystemZ/cmpxchg-01.ll @@ -65,7 +65,8 @@ define i32 @f3(i8 %dummy, i8 *%src, i8 %cmp, i8 %swap) { ; CHECK-MAIN: [[LOOP:\.[^ ]*]]: ; CHECK-MAIN: rll [[TMP:%r[0-9]+]], [[OLD]], 8(%r3) ; CHECK-MAIN: risbg %r4, [[TMP]], 32, 55, 0 -; CHECK-MAIN: crjlh [[TMP]], %r4, [[EXIT:\.[^ ]*]] +; CHECK-MAIN: cr [[TMP]], %r4 +; CHECK-MAIN: jlh [[EXIT:\.[^ ]*]] ; CHECK-MAIN: risbg %r5, [[TMP]], 32, 55, 0 ; CHECK-MAIN: rll [[NEW:%r[0-9]+]], %r5, -8({{%r[1-9]+}}) ; CHECK-MAIN: cs [[OLD]], [[NEW]], 0([[RISBG]]) diff --git a/llvm/test/CodeGen/SystemZ/cmpxchg-02.ll b/llvm/test/CodeGen/SystemZ/cmpxchg-02.ll index 48e1e18db9b..dd7db09d947 100644 --- a/llvm/test/CodeGen/SystemZ/cmpxchg-02.ll +++ b/llvm/test/CodeGen/SystemZ/cmpxchg-02.ll @@ -65,7 +65,8 @@ define i32 @f3(i16 %dummy, i16 *%src, i16 %cmp, i16 %swap) { ; CHECK-MAIN: [[LOOP:\.[^ ]*]]: ; CHECK-MAIN: rll [[TMP:%r[0-9]+]], [[OLD]], 16(%r3) ; CHECK-MAIN: risbg %r4, [[TMP]], 32, 47, 0 -; CHECK-MAIN: crjlh [[TMP]], %r4, [[EXIT:\.[^ ]*]] +; CHECK-MAIN: cr [[TMP]], %r4 +; CHECK-MAIN: jlh [[EXIT:\.[^ ]*]] ; CHECK-MAIN: risbg %r5, [[TMP]], 32, 47, 0 ; CHECK-MAIN: rll [[NEW:%r[0-9]+]], %r5, -16({{%r[1-9]+}}) ; CHECK-MAIN: cs [[OLD]], [[NEW]], 0([[RISBG]]) |

