llvm-6502/lib
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
..
Analysis ValueTracking: Make isSafeToSpeculativelyExecute a little cleaner 2015-02-01 19:10:19 +00:00
AsmParser IR: Split out DebugInfoMetadata.h, NFC 2015-02-02 18:53:21 +00:00
Bitcode Propagate a better error message to the C api. 2015-02-03 01:53:03 +00:00
CodeGen Only access TLOF via the TargetMachine, not TargetLowering. 2015-02-03 07:22:52 +00:00
DebugInfo Move DebugInfo to DebugInfo/DWARF. 2015-01-30 18:07:45 +00:00
ExecutionEngine [Orc] Make OrcMCJITReplacement::addObject calls transfer buffer ownership to the 2015-02-02 19:51:18 +00:00
Fuzzer [fuzzer] add flags to run fuzzer in multiple parallel processes 2015-01-31 01:14:40 +00:00
IR Fix the -Werror build, NFC 2015-02-02 20:20:56 +00:00
IRReader
LineEditor
Linker
LTO [LTO API] split lto_codegen_compile to lto_codegen_optimize and 2015-02-03 18:39:15 +00:00
MC
Object
Option
ProfileData InstrProf: Simplify RawCoverageMappingReader's API slightly 2015-02-03 00:20:11 +00:00
Support NFC. Making printOptionValues an API on the parser class. 2015-01-30 22:16:01 +00:00
TableGen
Target Add straight-line strength reduction to LLVM 2015-02-03 19:37:06 +00:00
Transforms Add straight-line strength reduction to LLVM 2015-02-03 19:37:06 +00:00
CMakeLists.txt
LLVMBuild.txt
Makefile Move DebugInfo to DebugInfo/DWARF. 2015-01-30 18:07:45 +00:00