llvm-6502/include/llvm
Jingyue Wu 2918efd551 Add straight-line strength reduction to LLVM
Summary:
Straight-line strength reduction (SLSR) is implemented in GCC but not yet in
LLVM. It has proven to effectively simplify statements derived from an unrolled
loop, and can potentially benefit many other cases too. For example,

LLVM unrolls

  #pragma unroll
  foo (int i = 0; i < 3; ++i) {
    sum += foo((b + i) * s);
  }

into

  sum += foo(b * s);
  sum += foo((b + 1) * s);
  sum += foo((b + 2) * s);

However, no optimizations yet reduce the internal redundancy of the three
expressions:

  b * s
  (b + 1) * s
  (b + 2) * s

With SLSR, LLVM can optimize these three expressions into:

  t1 = b * s
  t2 = t1 + s
  t3 = t2 + s

This commit is only an initial step towards implementing a series of such
optimizations. I will implement more (see TODO in the file commentary) in the
near future. This optimization is enabled for the NVPTX backend for now.
However, I am more than happy to push it to the standard optimization pipeline
after more thorough performance tests.

Test Plan: test/StraightLineStrengthReduce/slsr.ll

Reviewers: eliben, HaoLiu, meheff, hfinkel, jholewinski, atrick

Reviewed By: jholewinski, atrick

Subscribers: karthikthecool, jholewinski, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228016 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-03 19:37:06 +00:00
..
ADT STLExtras: Provide less/equal functors with templated function call operators, plus a deref'ing functor template utility 2015-02-02 18:35:10 +00:00
Analysis [LoopVectorize] Fix rebase glitch in r227751 2015-02-03 17:59:53 +00:00
AsmParser
Bitcode [Bitcode] Diagnose errors instead of asserting from bad input 2015-01-24 04:15:05 +00:00
CodeGen [PBQP Regalloc] Pre-spill vregs that have no legal physregs. 2015-02-03 06:14:06 +00:00
Config [Cygming] Seek also chkstk_ms, or JIT fails with DLL builds. It is fixup for r227519. 2015-01-30 13:01:19 +00:00
DebugInfo/DWARF Move DebugInfo to DebugInfo/DWARF. 2015-01-30 18:07:45 +00:00
ExecutionEngine [Orc] Make the ObjectLinkingLayer take ownership of object files until 2015-02-02 04:32:17 +00:00
IR IR: Allow GenericDebugNode construction from MDString 2015-02-02 20:01:03 +00:00
IRReader
LineEditor
Linker Use the DiagnosticHandler to print diagnostics when reading bitcode. 2015-01-10 00:07:30 +00:00
LTO [LTO API] split lto_codegen_compile to lto_codegen_optimize and 2015-02-03 18:39:15 +00:00
MC Compute the ELF SectionKind from the flags. 2015-01-29 17:33:21 +00:00
Object dd the option, -link-opt-hints to llvm-objdump used with -macho to print the 2015-01-27 21:28:24 +00:00
Option
ProfileData InstrProf: Simplify RawCoverageMappingReader's API slightly 2015-02-03 00:20:11 +00:00
Support [LPM] Remove a PPC64 hack to try to work around a bad interaction 2015-01-29 23:26:37 +00:00
TableGen Make MultiClass::DefPrototypes own their Records to fix memory leaks. 2014-12-11 05:25:33 +00:00
Target Only access TLOF via the TargetMachine, not TargetLowering. 2015-02-03 07:22:52 +00:00
Transforms Add straight-line strength reduction to LLVM 2015-02-03 19:37:06 +00:00
CMakeLists.txt
InitializePasses.h Add straight-line strength reduction to LLVM 2015-02-03 19:37:06 +00:00
LinkAllIR.h
LinkAllPasses.h Add straight-line strength reduction to LLVM 2015-02-03 19:37:06 +00:00
module.modulemap Bring the modules buildbot back to life after r226940. 2015-01-24 01:55:52 +00:00
module.modulemap.build
Pass.h
PassAnalysisSupport.h
PassInfo.h
PassManager.h
PassRegistry.h [PM] Remove an unused and rather expensive mapping from an analysis 2014-10-06 00:30:59 +00:00
PassSupport.h Defining a new API for debug options that doesn't rely on static global cl::opts. 2014-10-15 21:54:35 +00:00