Canonicalize all integer "idempotent" atomicrmw ops
authorPhilip Reames <listmail@philipreames.com>
Thu, 14 Feb 2019 20:41:17 +0000 (20:41 +0000)
committerPhilip Reames <listmail@philipreames.com>
Thu, 14 Feb 2019 20:41:17 +0000 (20:41 +0000)
commit485474208e11ecbf2a589d9e4156e78a88257bfa
tree86eb7587be681e6841e5eb5d4ae104592102b1d3
parent04a1ee466062fe00dd414fdba2f827b400bc7bee
Canonicalize all integer "idempotent" atomicrmw ops

For "idempotent" atomicrmw instructions which we can't simply turn into load, canonicalize the operation and constant. This reduces the matching needed elsewhere in the optimizer, but doesn't directly impact codegen.

For any architecture where OR/Zero is not a good default choice, you can extend the AtomicExpand lowerIdempotentRMWIntoFencedLoad mechanism. I reviewed X86 to make sure this works well, haven't audited other backends.

Differential Revision: https://reviews.llvm.org/D58244

llvm-svn: 354058
llvm/lib/Transforms/InstCombine/InstCombineAtomicRMW.cpp
llvm/test/Transforms/InstCombine/atomicrmw.ll