llvm-6502/include/llvm
Hal Finkel bebe48dbfe Add a loop rerolling pass
This adds a loop rerolling pass: the opposite of (partial) loop unrolling. The
transformation aims to take loops like this:

for (int i = 0; i < 3200; i += 5) {
  a[i]     += alpha * b[i];
  a[i + 1] += alpha * b[i + 1];
  a[i + 2] += alpha * b[i + 2];
  a[i + 3] += alpha * b[i + 3];
  a[i + 4] += alpha * b[i + 4];
}

and turn them into this:

for (int i = 0; i < 3200; ++i) {
  a[i] += alpha * b[i];
}

and loops like this:

for (int i = 0; i < 500; ++i) {
  x[3*i] = foo(0);
  x[3*i+1] = foo(0);
  x[3*i+2] = foo(0);
}

and turn them into this:

for (int i = 0; i < 1500; ++i) {
  x[i] = foo(0);
}

There are two motivations for this transformation:

  1. Code-size reduction (especially relevant, obviously, when compiling for
code size).

  2. Providing greater choice to the loop vectorizer (and generic unroller) to
choose the unrolling factor (and a better ability to vectorize). The loop
vectorizer can take vector lengths and register pressure into account when
choosing an unrolling factor, for example, and a pre-unrolled loop limits that
choice. This is especially problematic if the manual unrolling was optimized
for a machine different from the current target.

The current implementation is limited to single basic-block loops only. The
rerolling recognition should work regardless of how the loop iterations are
intermixed within the loop body (subject to dependency and side-effect
constraints), but the significant restriction is that the order of the
instructions in each iteration must be identical. This seems sufficient to
capture all current use cases.

This pass is not currently enabled by default at any optimization level.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194939 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-16 23:59:05 +00:00
..
ADT Annotate APInt methods where it's not clear whether they are in place with warn_unused_result. 2013-11-16 16:25:41 +00:00
Analysis ScalarEvolution: Warn if the result of setFlags/clearFlags is unused. 2013-11-16 16:25:47 +00:00
Assembly Enable *BasicBlockPass::createPrinterPass() 2013-02-08 23:37:41 +00:00
Bitcode Add addrspacecast instruction. 2013-11-15 01:34:59 +00:00
CodeGen Fix filename in header comment 2013-11-16 15:40:54 +00:00
Config Fix symbol defines in config.h.cmake 2013-11-05 07:27:18 +00:00
DebugInfo DWARF parser: Use ArrayRef to represent form sizes and simplify DWARFDIE::extractFast() interface. No functionality change. 2013-10-28 23:41:49 +00:00
ExecutionEngine [weak vtables] Remove a bunch of weak vtables 2013-11-15 22:34:48 +00:00
IR Implemented aarch64 Neon scalar vmulx_lane intrinsics 2013-11-15 23:32:10 +00:00
IRReader
LTO Protect user-supplied runtime library functions in LTO 2013-11-12 21:44:01 +00:00
MC [weak vtables] Remove a bunch of weak vtables 2013-11-15 22:34:48 +00:00
Object Readobj: If NumbersOfSections is 0xffff, it's an COFF import library. 2013-11-15 20:23:25 +00:00
Option Option parsing: support case-insensitive option matching. 2013-08-28 20:04:31 +00:00
Support X86: Encode the 'h' cpu subtype in the MachO header for x86. 2013-11-16 00:52:57 +00:00
TableGen Speling fixes. 2013-10-22 15:18:03 +00:00
Target Add target hook to prevent folding some bitcasted loads. 2013-11-15 04:42:23 +00:00
Transforms Add a loop rerolling pass 2013-11-16 23:59:05 +00:00
AutoUpgrade.h Add addrspacecast instruction. 2013-11-15 01:34:59 +00:00
CMakeLists.txt
DebugInfo.h Reformat. 2013-10-15 21:22:12 +00:00
DIBuilder.h fix two typos. 2013-10-21 23:55:19 +00:00
GVMaterializer.h Use error_code in GVMaterializer. 2013-11-05 19:36:34 +00:00
InitializePasses.h Add a loop rerolling pass 2013-11-16 23:59:05 +00:00
InstVisitor.h Add addrspacecast instruction. 2013-11-15 01:34:59 +00:00
LinkAllIR.h
LinkAllPasses.h Add a loop rerolling pass 2013-11-16 23:59:05 +00:00
Linker.h
Pass.h moves doInitialization and doFinalization to the Pass class and removes some unreachable code in MachineModuleInfo 2012-12-03 21:56:57 +00:00
PassAnalysisSupport.h Fix include guards so they exactly match file names. 2013-01-10 00:45:19 +00:00
PassManager.h Move the old pass manager infrastructure into a legacy namespace and 2013-11-09 12:26:54 +00:00
PassRegistry.h This patch breaks up Wrap.h so that it does not have to include all of 2013-05-01 20:59:00 +00:00
PassSupport.h