llvm-6502/test/Transforms
Sanjoy Das 39d6da003d [IndVars] Make loop varying predicates loop invariant.
Summary:
Was D9784: "Remove loop variant range check when induction variable is
strictly increasing"

This change re-implements D9784 with the two differences:

 1. It does not use SCEVExpander and does not generate new
    instructions.  Instead, it does a quick local search for existing
    `llvm::Value`s that it needs when modifying the `icmp`
    instruction.

 2. It is more general -- it deals with both increasing and decreasing
    induction variables.

I've added all of the tests included with D9784, and two more.

As an example on what this change does (copied from D9784):

Given C code:

```
for (int i = M; i < N; i++) // i is known not to overflow
  if (i < 0) break;
  a[i] = 0;
}
```

This transformation produces:

```
for (int i = M; i < N; i++)
  if (M < 0) break;
  a[i] = 0;
}
```

Which can be unswitched into:

```
if (!(M < 0))
  for (int i = M; i < N; i++)
    a[i] = 0;
}
```

I went back and forth on whether the top level logic should live in
`SimplifyIndvar::eliminateIVComparison` or be put into its own
routine.  Right now I've put it under `eliminateIVComparison` because
even though the `icmp` is not *eliminated*, it no longer is an IV
comparison.  I'm open to putting it in its own helper routine if you
think that is better.

Reviewers: reames, nicholas, atrick

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243331 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-27 21:42:49 +00:00
..
ADCE
AddDiscriminators
AlignmentFromAssumptions
ArgumentPromotion
AtomicExpand/ARM
BBVectorize
BDCE
BranchFolding
CodeExtractor
CodeGenPrepare AMDGPU: Fix some places missed in rename 2015-06-19 17:39:03 +00:00
ConstantHoisting
ConstantMerge
ConstProp Fix assert when inlining a constantexpr addrspacecast 2015-07-27 18:31:03 +00:00
CorrelatedValuePropagation
DeadArgElim DI/Verifier: Fix argument bitrot in DILocalVariable 2015-07-24 23:59:25 +00:00
DeadStoreElimination
EarlyCSE
EliminateAvailableExternally Don't change the visibility when converting a definition to a declaration. 2015-07-13 14:18:22 +00:00
Float2Int
FunctionAttrs
GCOVProfiling
GlobalDCE
GlobalOpt DI/Verifier: Fix argument bitrot in DILocalVariable 2015-07-24 23:59:25 +00:00
GVN GVN: tolerate an instruction being replaced without existing in the leaderboard 2015-07-14 21:03:18 +00:00
IndVarSimplify [IndVars] Make loop varying predicates loop invariant. 2015-07-27 21:42:49 +00:00
Inline Fix assert when inlining a constantexpr addrspacecast 2015-07-27 18:31:03 +00:00
InstCombine [InstCombine][X86][SSE] Replace sign/zero extension intrinsics with native IR 2015-07-27 18:52:15 +00:00
InstMerge
InstSimplify [InstSimplify] Teach InstSimplify how to simplify extractelement 2015-07-13 01:15:53 +00:00
Internalize Internalize: internalize comdat members as a group, and drop comdat on such members. 2015-07-16 17:42:21 +00:00
IPConstantProp
IRCE
JumpThreading
LCSSA
LICM [LICM] Don't try to sink values out of loops without any exits 2015-07-12 03:53:05 +00:00
LoadCombine
LoopDeletion
LoopDistribute [LAA] Merge memchecks for accesses separated by a constant offset 2015-07-08 09:16:33 +00:00
LoopIdiom Remove unnecessary lines from the test in r242068. 2015-07-13 21:50:35 +00:00
LoopInterchange
LoopReroll Handle loop with negtive induction variable increment 2015-07-24 22:01:49 +00:00
LoopRotate DI/Verifier: Fix argument bitrot in DILocalVariable 2015-07-24 23:59:25 +00:00
LoopSimplify [LoopSimplify] Set proper debug location in loop backedge blocks. 2015-06-29 21:30:14 +00:00
LoopStrengthReduce [LSR] don't attempt to promote ephemeral values to indvars 2015-07-13 03:28:53 +00:00
LoopUnroll Roll forward r243250 2015-07-26 19:10:03 +00:00
LoopUnswitch [LoopUnswitch] Improve loop unswitch pass to find trivial unswitch conditions more effectively 2015-07-25 03:21:06 +00:00
LoopVectorize The tests added in r243270 require asserts to be enabled 2015-07-27 15:22:49 +00:00
LowerAtomic
LowerBitSets LowerBitSets: Ignore bitset entries that do not directly refer to a global. 2015-06-27 00:17:51 +00:00
LowerExpectIntrinsic
LowerInvoke
LowerSwitch
Mem2Reg DI/Verifier: Fix argument bitrot in DILocalVariable 2015-07-24 23:59:25 +00:00
MemCpyOpt
MergeFunc MergeFunc: Transfer the callee's attributes when replacing a direct caller 2015-07-21 17:07:07 +00:00
MetaRenamer
NaryReassociate [NaryReassociate] enhances nsw by leveraging @llvm.assume 2015-07-01 03:38:49 +00:00
ObjCARC
PartiallyInlineLibCalls
PhaseOrdering
PlaceSafepoints Rename llvm.frameescape and llvm.framerecover to localescape and localrecover 2015-07-07 22:25:32 +00:00
PruneEH [PruneEH] A naked, noinline function can return via InlineAsm 2015-06-27 07:52:53 +00:00
Reassociate [Reassociate] Don't propogate flags when creating negations 2015-06-24 21:27:36 +00:00
Reg2Mem
RewriteStatepointsForGC [RewriteStatepointsForGC] Adjust naming scheme to be more stable 2015-07-24 19:01:39 +00:00
SafeStack SafeStack: Create the unsafe stack pointer on demand. 2015-06-22 20:26:54 +00:00
SampleProfile
Scalarizer [Scalarizer] Fix potential for stale data in Scattered across invocations 2015-07-23 20:53:46 +00:00
ScalarRepl
SCCP [ConstantFolding] Support folding loads from a GlobalAlias 2015-07-22 22:29:30 +00:00
SeparateConstOffsetFromGEP AMDGPU: Fix some places missed in rename 2015-06-19 17:39:03 +00:00
SimplifyCFG AMDGPU: Fix some places missed in rename 2015-06-19 17:39:03 +00:00
Sink
SLPVectorizer [SLPVectorizer] Try different vectorization factors for store chains 2015-07-08 23:40:55 +00:00
SpeculativeExecution
SROA [SROA] Fix a nasty pile of bugs to do with big-endian, different alloca 2015-07-22 03:32:42 +00:00
StraightLineStrengthReduce [NVPTX] enable SpeculativeExecution in NVPTX 2015-07-16 20:13:48 +00:00
StripSymbols DI/Verifier: Fix argument bitrot in DILocalVariable 2015-07-24 23:59:25 +00:00
StructurizeCFG
TailCallElim
TailDup
Util