[AArch64] Set correct successors in CMPXCHG pseudo expansion.

transferSuccessors() would LoadCmpBB a successor of DoneBB,
whereas it should be a successor of the original MBB.

Follow-up to r266339.

Unfortunately, it's tricky to catch this in the verifier.

llvm-svn: 267779
This commit is contained in:
Ahmed Bougacha 2016-04-27 20:33:02 +00:00
parent b4af107239
commit 9e71425f54
2 changed files with 5 additions and 3 deletions

View File

@ -624,7 +624,6 @@ bool AArch64ExpandPseudo::expandCMP_SWAP(
// ldaxr xDest, [xAddr]
// cmp xDest, xDesired
// b.ne .Ldone
MBB.addSuccessor(LoadCmpBB);
LoadCmpBB->addLiveIn(Addr.getReg());
LoadCmpBB->addLiveIn(Dest.getReg());
LoadCmpBB->addLiveIn(Desired.getReg());
@ -663,6 +662,8 @@ bool AArch64ExpandPseudo::expandCMP_SWAP(
DoneBB->transferSuccessors(&MBB);
addPostLoopLiveIns(DoneBB, LiveRegs);
MBB.addSuccessor(LoadCmpBB);
NextMBBI = MBB.end();
MI.eraseFromParent();
return true;
@ -702,7 +703,6 @@ bool AArch64ExpandPseudo::expandCMP_SWAP_128(
// cmp xDestLo, xDesiredLo
// sbcs xDestHi, xDesiredHi
// b.ne .Ldone
MBB.addSuccessor(LoadCmpBB);
LoadCmpBB->addLiveIn(Addr.getReg());
LoadCmpBB->addLiveIn(DestLo.getReg());
LoadCmpBB->addLiveIn(DestHi.getReg());
@ -749,6 +749,8 @@ bool AArch64ExpandPseudo::expandCMP_SWAP_128(
DoneBB->transferSuccessors(&MBB);
addPostLoopLiveIns(DoneBB, LiveRegs);
MBB.addSuccessor(LoadCmpBB);
NextMBBI = MBB.end();
MI.eraseFromParent();
return true;

View File

@ -1,4 +1,4 @@
; RUN: llc -mtriple=aarch64-linux-gnu -O0 %s -o - | FileCheck %s
; RUN: llc -verify-machineinstrs -mtriple=aarch64-linux-gnu -O0 %s -o - | FileCheck %s
define { i8, i1 } @test_cmpxchg_8(i8* %addr, i8 %desired, i8 %new) nounwind {
; CHECK-LABEL: test_cmpxchg_8: