From: Philip Reames Date: Thu, 14 Feb 2019 20:48:36 +0000 (+0000) Subject: [InstCombine] Add todos for possible atomicrmw transforms X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2ecdf36fb1456dd69354966c2ce86e6f6d6294c6;p=llvm [InstCombine] Add todos for possible atomicrmw transforms git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354059 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/InstCombine/InstCombineAtomicRMW.cpp b/lib/Transforms/InstCombine/InstCombineAtomicRMW.cpp index b607c6dd608..37c43977d90 100644 --- a/lib/Transforms/InstCombine/InstCombineAtomicRMW.cpp +++ b/lib/Transforms/InstCombine/InstCombineAtomicRMW.cpp @@ -51,6 +51,12 @@ bool isIdempotentRMW(AtomicRMWInst& RMWI) { Instruction *InstCombiner::visitAtomicRMWInst(AtomicRMWInst &RMWI) { + // TODO: Any atomicrmw op which produces a known result in memory can be + // replaced w/an atomicrmw xchg. (see getBinOpAbsorber) + + // TODO: Any atomicrmw xchg with no uses can be converted to a atomic store + // if the ordering is compatible. + if (!isIdempotentRMW(RMWI)) return nullptr;