[EarlyCSE] Value forwarding for unordered atomics
authorPhilip Reames <listmail@philipreames.com>
Tue, 8 Dec 2015 21:45:41 +0000 (21:45 +0000)
committerPhilip Reames <listmail@philipreames.com>
Tue, 8 Dec 2015 21:45:41 +0000 (21:45 +0000)
commiteca5f1938e545905126f43b6f1afb7b515c36b0e
tree0bd50766d5e0c1d0131a2da67ea204586c89a35e
parent9d46b32e8801178491b93d8813ae98e05d13adcc
[EarlyCSE] Value forwarding for unordered atomics

This patch teaches the fully redundant load part of EarlyCSE how to forward from atomic and volatile loads and stores, and how to eliminate unordered atomics (only). This patch does not include dead store elimination support for unordered atomics, that will follow in the near future.

The basic idea is that we allow all loads and stores to be tracked by the AvailableLoad table. We store a bit in the table which tracks whether load/store was atomic, and then only replace atomic loads with ones which were also atomic.

No attempt is made to refine our handling of ordered loads or stores. Those are still treated as full fences. We could pretty easily extend the release fence handling to release stores, but that should be a separate patch.

Differential Revision: http://reviews.llvm.org/D15337

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255054 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/EarlyCSE.cpp
test/Transforms/EarlyCSE/atomics.ll [new file with mode: 0644]