[PATCH] D36945: [x86] Handle more cases where we can re-use an atomic operation's flags rather than doing a separate comparison.

Chandler Carruth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 20 19:15:12 PDT 2017


chandlerc created this revision.
Herald added subscribers: mcrosier, sanjoy.

This both saves an explicit comparision and avoids the use of `xadd`
which introduces register constraints and other challenges to the
generated code.

The motivating case is from atomic reference counts where `1` is the
sentinel rather than `0` for whatever reason. This can and should be
lowered efficiently on x86 by just using a different flag, however the
x86 code only handled the `0` case.

There remains some further opportunities here that are currently hidden
due to canonicalization. I've included test cases that show these and
FIXMEs. However, I don't at the moment have any production use cases and
they seem substantially harder to address.


https://reviews.llvm.org/D36945

Files:
  lib/Target/X86/X86ISelLowering.cpp
  test/CodeGen/X86/atomic-eflags-reuse.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36945.111921.patch
Type: text/x-patch
Size: 4787 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170821/fe305902/attachment.bin>


More information about the llvm-commits mailing list