]> granicus.if.org Git - llvm/commit
[InstCombine] Optimize `atomicrmw <op>, 0` into `load atomic` when possible
authorQuentin Colombet <quentin.colombet@gmail.com>
Thu, 7 Feb 2019 21:27:23 +0000 (21:27 +0000)
committerQuentin Colombet <quentin.colombet@gmail.com>
Thu, 7 Feb 2019 21:27:23 +0000 (21:27 +0000)
commitbf48dea5862977d7de14485025c0a089827dea4c
treec03f0f8a418ec1cf8a3d6f5b6c3d653a9b4b297e
parentea1e928e56bf2171f5ee4cb4b1b908c7d36d5ccb
[InstCombine] Optimize `atomicrmw <op>, 0` into `load atomic` when possible

This commit teaches InstCombine how to replace an atomicrmw operation
into a simple load atomic.
For a given `atomicrmw <op>`, this is possible when:
1. The ordering of that operation is compatible with a load (i.e.,
   anything that doesn't have a release semantic).
2. <op> does not modify the value being stored

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353471 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/CMakeLists.txt
lib/Transforms/InstCombine/InstCombineAtomicRMW.cpp [new file with mode: 0644]
lib/Transforms/InstCombine/InstCombineInternal.h
test/Transforms/InstCombine/atomicrmw.ll [new file with mode: 0644]