[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)
commit8fc2cbf933d6d264538bd59321320649ea935aef
treec2e4db58b767a12c6156bfee90f905001f3eea49
parent0aea1b89eb63affa44d88bc836ee323ce605ec03
[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

llvm-svn: 255054
llvm/lib/Transforms/Scalar/EarlyCSE.cpp
llvm/test/Transforms/EarlyCSE/atomics.ll [new file with mode: 0644]