llvm-6502/test/Transforms
Kevin Qin dbaeb6e7cb Use a loop to simplify the runtime unrolling prologue.
Runtime unrolling will create a prologue to execute the extra
iterations which is can't divided by the unroll factor. It
generates an if-then-else sequence to jump into a factor -1
times unrolled loop body, like

    extraiters = tripcount % loopfactor
    if (extraiters == 0) jump Loop:
    if (extraiters == loopfactor) jump L1
    if (extraiters == loopfactor-1) jump L2
    ...
    L1:  LoopBody;
    L2:  LoopBody;
    ...
    if tripcount < loopfactor jump End
    Loop:
    ...
    End:

It means if the unroll factor is 4, the loop body will be 7
times unrolled, 3 are in loop prologue, and 4 are in the loop.
This commit is to use a loop to execute the extra iterations
in prologue, like

        extraiters = tripcount % loopfactor
        if (extraiters == 0) jump Loop:
        else jump Prol
 Prol:  LoopBody;
        extraiters -= 1                 // Omitted if unroll factor is 2.
        if (extraiters != 0) jump Prol: // Omitted if unroll factor is 2.
        if (tripcount < loopfactor) jump End
 Loop:
 ...
 End:

Then when unroll factor is 4, the loop body will be copied by
only 5 times, 1 in the prologue loop, 4 in the original loop.
And if the unroll factor is 2, new loop won't be created, just
as the original solution.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218604 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-29 11:15:00 +00:00
..
ADCE
AddDiscriminators Use DILexicalBlockFile, rather than DILexicalBlock, to track discriminator changes to ensure discriminator changes don't introduce new DWARF DW_TAG_lexical_blocks. 2014-08-21 22:45:21 +00:00
AlignmentFromAssumptions [AlignmentFromAssumptions] Don't crash just because the target is 32-bit 2014-09-11 08:40:17 +00:00
ArgumentPromotion Don't promote byval pointer arguments when padding matters 2014-08-28 22:42:00 +00:00
AtomicExpand/ARM Use target-dependent emitLeading/TrailingFence instead of the target-independent insertLeading/TrailingFence (in AtomicExpandPass) 2014-09-03 21:01:03 +00:00
BBVectorize
BranchFolding
CodeExtractor
CodeGenPrepare
ConstantHoisting
ConstantMerge
ConstProp Fix a bug around truncating vector in const prop. 2014-08-21 02:12:35 +00:00
CorrelatedValuePropagation
DeadArgElim musttail: Don't eliminate varargs packs if there is a forwarding call 2014-08-26 00:59:51 +00:00
DeadStoreElimination Relax the constraint more in MemoryDependencyAnalysis.cpp 2014-08-29 20:32:58 +00:00
DebugIR
EarlyCSE
FunctionAttrs [optnone] Make the optnone attribute effective at suppressing function 2014-08-13 10:49:33 +00:00
GCOVProfiling
GlobalDCE Remove dangling initializers in GlobalDCE 2014-08-25 17:51:14 +00:00
GlobalOpt GlobalOpt: Preserve comdats of unoptimized initializers 2014-09-23 22:33:01 +00:00
GVN Relax the constraint more in MemoryDependencyAnalysis.cpp 2014-08-29 20:32:58 +00:00
IndVarSimplify [IndVar] Don't widen loop compare unless IV user is sign extended. 2014-09-26 20:05:35 +00:00
Inline Add functions for finding ephemeral values 2014-09-07 13:49:57 +00:00
InstCombine [InstCombine] Fix wrong folding of constant comparison involving ahsr and negative quantities (PR20945). 2014-09-17 11:32:31 +00:00
InstMerge
InstSimplify InstSimplify: Don't allow (x srem y) urem y -> x srem y 2014-09-17 04:16:35 +00:00
Internalize
IPConstantProp
JumpThreading Make use of @llvm.assume from LazyValueInfo 2014-09-07 20:29:59 +00:00
LCSSA
LICM Fix assertion in LICM doFinalization() 2014-09-24 16:48:31 +00:00
LoadCombine
LoopDeletion
LoopIdiom
LoopReroll
LoopRotate
LoopSimplify FileCheckize. NFC. 2014-09-12 17:55:16 +00:00
LoopStrengthReduce
LoopUnroll Use a loop to simplify the runtime unrolling prologue. 2014-09-29 11:15:00 +00:00
LoopUnswitch
LoopVectorize Rename getMaximumUnrollFactor -> getMaxInterleaveFactor; also rename option names controlling this variable. 2014-09-10 17:58:16 +00:00
LowerAtomic
LowerExpectIntrinsic
LowerInvoke
LowerSwitch
Mem2Reg
MemCpyOpt Fix a really bad miscompile introduced in r216865 - the else-if logic 2014-09-01 10:09:18 +00:00
MergeFunc Fix crash when looking up the addrspace of GEPs with vector types 2014-09-02 18:47:54 +00:00
MetaRenamer
ObjCARC
PartiallyInlineLibCalls
PhaseOrdering
PruneEH
Reassociate Reassociate x + -0.1234 * y into x - 0.1234 * y 2014-08-21 10:45:30 +00:00
Reg2Mem
SampleProfile Use DILexicalBlockFile, rather than DILexicalBlock, to track discriminator changes to ensure discriminator changes don't introduce new DWARF DW_TAG_lexical_blocks. 2014-08-21 22:45:21 +00:00
Scalarizer
ScalarRepl
SCCP
SeparateConstOffsetFromGEP/NVPTX
SimplifyCFG Add a test for hoisting instructions with metadata out of then/else blocks 2014-09-09 17:10:21 +00:00
Sink
SLPVectorizer Preserve IR flags (nsw, nuw, exact, fast-math) in SLP vectorizer (PR20802). 2014-09-03 17:40:30 +00:00
SROA SROA: Don't insert instructions before a PHI 2014-09-01 21:20:14 +00:00
StripSymbols
StructurizeCFG
TailCallElim
TailDup
Util utils: Fix segfault in flattencfg 2014-08-13 20:31:53 +00:00