llvm-6502/lib
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
..
Analysis [IndVars] Make loop varying predicates loop invariant. 2015-07-27 21:42:49 +00:00
AsmParser AsmParser: Add a function to parse a standalone constant value. 2015-07-17 22:07:03 +00:00
Bitcode
CodeGen MIR Serialization: Serialize the '.cfi_def_cfa_register' CFI instruction. 2015-07-27 20:39:03 +00:00
DebugInfo
ExecutionEngine Fix ODR violation. NFC. 2015-07-27 18:27:23 +00:00
Fuzzer [libFuzzer] allow users to supply their own implementation of rand 2015-07-24 01:06:40 +00:00
IR Revert "Add const to a bunch of Type* in DataLayout. NFC." 2015-07-27 17:15:28 +00:00
IRReader
LibDriver Add support for producing thin archives in llvm-lib. 2015-07-17 16:01:11 +00:00
LineEditor
Linker
LTO Remove access to the DataLayout in the TargetMachine 2015-07-24 16:04:22 +00:00
MC Fix a -Winconsistent-missing-override failure in the .intel_syntax 2015-07-22 11:22:29 +00:00
Object Fix fetching the symbol table of a thin archive. 2015-07-22 19:34:26 +00:00
Option
Passes
ProfileData
Support Remove unnecessary in C++11 c_str() calls 2015-07-23 05:49:29 +00:00
TableGen [TableGen] Emit the correct error message. 2015-07-27 17:22:19 +00:00
Target remove unnecessary forward declaration; NFC 2015-07-27 21:11:55 +00:00
Transforms [IndVars] Make loop varying predicates loop invariant. 2015-07-27 21:42:49 +00:00
CMakeLists.txt
LLVMBuild.txt
Makefile