This is an archive of the discontinued LLVM Phabricator instance.

[AtomicExpandPass] Widen partword atomicrmw or/xor/and before tryExpandAtomicRMW
ClosedPublic

Authored by asb on Jun 13 2018, 8:11 AM.

Details

Summary

This patch performs a widening transformation of bitwise atomicrmw or, xor, and and applies it prior to tryExpandAtomicRMW. This operates similarly to convertCmpXchgToIntegerType. For these operations, the i8/i16 atomicrmw can be implemented in terms of the 32-bit atomicrmw by appropriately manipulating the operands. There is no functional change for the handling of partword or/xor, but the transformation for partword and is new.

The advantage of performing this transformation early is that the same code-path can be used regardless of the approach used to expand the atomicrmw (AtomicExpansionKind). i.e. the same logic is used for AtomicExpansionKind::CmpXchg and can also be used by the intrinsic-based expansion in D47882.

Diff Detail

Repository
rL LLVM

Event Timeline

asb created this revision.Jun 13 2018, 8:11 AM
asb updated this revision to Diff 160980.Aug 16 2018, 2:15 AM
asb retitled this revision from [RISCV] Improved lowering for bit-wise atomicrmw {i8,i16} on RV32A to [AtomicExpandPass] Widen partword atomicrmw or/xor/and before tryExpandAtomicRMW.
asb edited the summary of this revision. (Show Details)

I've updated this patch so it is independent of the RISC-V atomics lowering. I replace the previous logic in performMaskedAtomicOp with a new helper function widenPartwordAtomicRMW, which is called early on. See the updated summary for more details.

jyknight accepted this revision.Aug 16 2018, 8:24 AM
This revision is now accepted and ready to land.Aug 16 2018, 8:24 AM
This revision was automatically updated to reflect the committed changes.