From: Cameron Zwarich Date: Wed, 18 May 2011 02:20:07 +0000 (+0000) Subject: Fix more of PR8825 by correctly using rGPR registers when lowering atomic X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=7d336c0c68f00f18c214fe5e689628f099a0f6d7;p=oota-llvm.git Fix more of PR8825 by correctly using rGPR registers when lowering atomic compare-and-swap intrinsics. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131518 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/ARM/ARMISelLowering.cpp b/lib/Target/ARM/ARMISelLowering.cpp index 2b27a7e4e6a..e3bc3fa9b3d 100644 --- a/lib/Target/ARM/ARMISelLowering.cpp +++ b/lib/Target/ARM/ARMISelLowering.cpp @@ -4860,12 +4860,21 @@ ARMTargetLowering::EmitAtomicCmpSwap(MachineInstr *MI, unsigned ptr = MI->getOperand(1).getReg(); unsigned oldval = MI->getOperand(2).getReg(); unsigned newval = MI->getOperand(3).getReg(); - unsigned scratch = BB->getParent()->getRegInfo() - .createVirtualRegister(ARM::GPRRegisterClass); const TargetInstrInfo *TII = getTargetMachine().getInstrInfo(); DebugLoc dl = MI->getDebugLoc(); bool isThumb2 = Subtarget->isThumb2(); + MachineRegisterInfo &MRI = BB->getParent()->getRegInfo(); + unsigned scratch = + MRI.createVirtualRegister(isThumb2 ? ARM::tGPRRegisterClass + : ARM::GPRRegisterClass); + + if (isThumb2) { + MRI.constrainRegClass(dest, ARM::tGPRRegisterClass); + MRI.constrainRegClass(oldval, ARM::tGPRRegisterClass); + MRI.constrainRegClass(newval, ARM::tGPRRegisterClass); + } + unsigned ldrOpc, strOpc; switch (Size) { default: llvm_unreachable("unsupported size for AtomicCmpSwap!");