1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 12:33:33 +02:00
llvm-mirror/lib
Adam Nemet 933537bc6b LLE 6/6: Add LoopLoadElimination pass
Summary:
The goal of this pass is to perform store-to-load forwarding across the
backedge of a loop.  E.g.:

  for (i)
     A[i + 1] = A[i] + B[i]

  =>

  T = A[0]
  for (i)
     T = T + B[i]
     A[i + 1] = T

The pass relies on loop dependence analysis via LoopAccessAnalisys to
find opportunities of loop-carried dependences with a distance of one
between a store and a load.  Since it's using LoopAccessAnalysis, it was
easy to also add support for versioning away may-aliasing intervening
stores that would otherwise prevent this transformation.

This optimization is also performed by Load-PRE in GVN without the
option of multi-versioning.  As was discussed with Daniel Berlin in
http://reviews.llvm.org/D9548, this is inferior to a more loop-aware
solution applied here.  Hopefully, we will be able to remove some
complexity from GVN/MemorySSA as a consequence.

In the long run, we may want to extend this pass (or create a new one if
there is little overlap) to also eliminate loop-indepedent redundant
loads and store that *require* versioning due to may-aliasing
intervening stores/loads.  I have some motivating cases for store
elimination. My plan right now is to wait for MemorySSA to come online
first rather than using memdep for this.

The main motiviation for this pass is the 456.hmmer loop in SPECint2006
where after distributing the original loop and vectorizing the top part,
we are left with the critical path exposed in the bottom loop.  Being
able to promote the memory dependence into a register depedence (even
though the HW does perform store-to-load fowarding as well) results in a
major gain (~20%).  This gain also transfers over to x86: it's
around 8-10%.

Right now the pass is off by default and can be enabled
with -enable-loop-load-elim.  On the LNT testsuite, there are two
performance changes (negative number -> improvement):

  1. -28% in Polybench/linear-algebra/solvers/dynprog: the length of the
     critical paths is reduced
  2. +2% in Polybench/stencils/adi: Unfortunately, I couldn't reproduce this
     outside of LNT

The pass is scheduled after the loop vectorizer (which is after loop
distribution).  The rational is to try to reuse LAA state, rather than
recomputing it.  The order between LV and LLE is not critical because
normally LV does not touch scalar st->ld forwarding cases where
vectorizing would inhibit the CPU's st->ld forwarding to kick in.

LoopLoadElimination requires LAA to provide the full set of dependences
(including forward dependences).  LAA is known to omit loop-independent
dependences in certain situations.  The big comment before
removeDependencesFromMultipleStores explains why this should not occur
for the cases that we're interested in.

Reviewers: dberlin, hfinkel

Subscribers: junbuml, dberlin, mssimpso, rengolin, sanjoy, llvm-commits

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

llvm-svn: 252017
2015-11-03 23:50:08 +00:00
..
Analysis [LAA] LLE 5/6: Add predicate functions Dependence::isForward/isBackward, NFC 2015-11-03 23:50:03 +00:00
AsmParser AsmParser: Remove implicit ilist iterator conversions, NFC 2015-10-20 01:12:49 +00:00
Bitcode Don't assert if materializing before seeing any function bodies 2015-11-03 13:48:26 +00:00
CodeGen CodeGen, Target: Move Mach-O-specific symbol name logic to Mach-O lowering. 2015-11-03 23:40:03 +00:00
DebugInfo [LLVMSymbolize] Factor out the logic for printing structs from DIContext. NFC. 2015-11-03 22:20:52 +00:00
ExecutionEngine Revert "Revert "[Orc] Directly emit machine code for the x86 resolver block and trampolines."" 2015-11-03 16:40:37 +00:00
Fuzzer [libFuzzer] make -test_single_input more reliable: make sure the input's size is equal to it's capacity 2015-11-03 18:57:25 +00:00
IR [X86][XOP] Add support for the matching of the VPCMOV bit select instruction 2015-11-03 20:27:01 +00:00
IRReader
LibDriver [Option] Use an ArrayRef to store the Option Infos in OptTable. NFC 2015-10-21 16:30:42 +00:00
LineEditor
Linker Revert "Move metadata linking after lazy global materialization/linking." 2015-11-03 19:36:04 +00:00
LTO Reapply "LTO: Disable extra verify runs in release builds" 2015-09-15 23:05:59 +00:00
MC Don't create empty sections just to look like gas. 2015-11-03 20:02:22 +00:00
Object This never returns end(), simplify to use Child instead of iterator. NFC. 2015-11-03 01:20:44 +00:00
Option [Option] Use an ArrayRef to store the Option Infos in OptTable. NFC 2015-10-21 16:30:42 +00:00
Passes [PM] Port StripDeadPrototypes to the new pass manager 2015-10-30 23:28:12 +00:00
ProfileData [PGO] Value profiling (index format) code cleanup and testing 2015-11-02 05:08:23 +00:00
Support Use static instead of anonymous namespace for helper functions. NFC. 2015-11-02 14:57:24 +00:00
TableGen [TblGen] ArrayRefize TGParser. No functional change intended. 2015-10-24 12:46:45 +00:00
Target CodeGen, Target: Move Mach-O-specific symbol name logic to Mach-O lowering. 2015-11-03 23:40:03 +00:00
Transforms LLE 6/6: Add LoopLoadElimination pass 2015-11-03 23:50:08 +00:00
CMakeLists.txt
LLVMBuild.txt
Makefile