ARM: Fix CMP_SWAP expansion
authorMatthias Braun <matze@braunis.de>
Wed, 9 Aug 2017 22:22:05 +0000 (22:22 +0000)
committerMatthias Braun <matze@braunis.de>
Wed, 9 Aug 2017 22:22:05 +0000 (22:22 +0000)
commita88587ce0c5478051c583d88a85c634cdcef8b8b
tree438c017d3613134701b1449c7a0b0eeeb4ea09f4
parent93f2b4bdde892540844e7847128aa9adb5e3a5d3
ARM: Fix CMP_SWAP expansion

Clean up after my misguided attempt in r304267 to "fix" CMP_SWAP
returning an uninitialized status value.

- I was always using tMOVi8 to zero the status register which cannot
  encode higher register numbers and llvm would silently miscompile)

- Nobody was ever looking at that status value outside the expansion.
  ARMDAGToDAGISel::SelectCMP_SWAP() the only place creating CMP_SWAP
  instructions was not mapping anything to it. (The cmpxchg status value
  from llvm IR is lowered to a manual comparison after the CMP_SWAP)

So this:
- Renames the register from "status" to "temp" it make it obvious that
  it isn't used outside the expansion.
- Remove the zeroing status/temp register.
- Keep the live-in list improvements from r304267

Fixes http://llvm.org/PR34056

llvm-svn: 310534
llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp
llvm/lib/Target/ARM/ARMInstrInfo.td
llvm/test/CodeGen/ARM/cmpxchg-O0.ll