[llvm] r267779 - [AArch64] Set correct successors in CMPXCHG pseudo expansion.

Ahmed Bougacha via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 27 13:33:02 PDT 2016


Author: ab
Date: Wed Apr 27 15:33:02 2016
New Revision: 267779

URL: http://llvm.org/viewvc/llvm-project?rev=267779&view=rev
Log:
[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.

Modified:
    llvm/trunk/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp
    llvm/trunk/test/CodeGen/AArch64/cmpxchg-O0.ll

Modified: llvm/trunk/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp?rev=267779&r1=267778&r2=267779&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp Wed Apr 27 15:33:02 2016
@@ -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
   //     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
   DoneBB->transferSuccessors(&MBB);
   addPostLoopLiveIns(DoneBB, LiveRegs);
 
+  MBB.addSuccessor(LoadCmpBB);
+
   NextMBBI = MBB.end();
   MI.eraseFromParent();
   return true;

Modified: llvm/trunk/test/CodeGen/AArch64/cmpxchg-O0.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/cmpxchg-O0.ll?rev=267779&r1=267778&r2=267779&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/cmpxchg-O0.ll (original)
+++ llvm/trunk/test/CodeGen/AArch64/cmpxchg-O0.ll Wed Apr 27 15:33:02 2016
@@ -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:




More information about the llvm-commits mailing list