[PATCH] D41791: [DAG Legalization] Zero-extend the value compared in cmpxchg

Nemanja Ivanovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 5 15:49:53 PST 2018


nemanjai created this revision.
nemanjai added reviewers: t.p.northover, sdardis, uweigand, hfinkel, bogner.
Herald added a subscriber: javed.absar.

Current legalization scheme extends input operands to atomic compare and exchange without specifying whether it's a sign or zero extension. However, this leads to bugs at least in PPC codegen. Of course, this can be fixed in the PPC back end, but it seems like the right thing to do would be to change this in legalization since the underlying comparison is an equality comparison. Operands of equality comparisons (SETCC) are zero-extended as well.

Since this affects other back ends as well, I'll send out an RFC about this to make sure this is safe/desirable for other targets.


Repository:
  rL LLVM

https://reviews.llvm.org/D41791

Files:
  lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
  test/CodeGen/ARM/atomic-cmpxchg.ll
  test/CodeGen/ARM/cmpxchg-O0.ll
  test/CodeGen/Mips/atomic.ll
  test/CodeGen/PowerPC/PR35812-neg-cmpxchg.ll
  test/CodeGen/PowerPC/atomics-regression.ll
  test/CodeGen/SystemZ/cmpxchg-01.ll
  test/CodeGen/SystemZ/cmpxchg-02.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41791.128822.patch
Type: text/x-patch
Size: 19040 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180105/63a7b3c1/attachment.bin>


More information about the llvm-commits mailing list