llvm-6502/test
Andrew Trick a5c5bc9948 SCEV should use NSW to get trip count for positive nonunit stride loops.
SCEV currently fails to compute loop counts for nonunit stride
loops. This comes up frequently. It prevents loop optimization and
forces vectorization to insert extra loop checks.

For example:
void foo(int n, int *x) {
 for (int i = 0; i < n; i += 3) {
   x[i] = i;
   x[i+1] = i+1;
   x[i+2] = i+2;
 }
}

We need to properly handle the case in which limit > INT_MAX-stride. In
the above case: n > INT_MAX-3. In this case the loop counter will step
beyond the limit and overflow at the same time. However, knowing that
signed integer overlow in undefined, we can assume the loop test
behavior is arbitrary after overflow. This obeys both C undefined
behavior rules, and the more strict LLVM poison value rules.

I'm finally fixing this in response to Hal Finkel's persistence.
The most probable reason that we never optimized this before is that
we were being careful to handle case where the developer expected a
side-effect free infinite loop relying on overflow:

for (int i = 0; i < n; i += s) {
  ++j;
}
return j;

If INT_MAX+1 is a multiple of s and n > INT_MAX-s, then we might
expect an infinite loop. However there are plenty of ways to achieve
this effect without relying on undefined behavior of signed overflow.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193015 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-18 23:43:53 +00:00
..
Analysis SCEV should use NSW to get trip count for positive nonunit stride loops. 2013-10-18 23:43:53 +00:00
Assembler
Bindings/Ocaml
Bitcode
BugPoint
CodeGen Test case for r192957 2013-10-18 14:49:59 +00:00
DebugInfo Changing DebugInfoFinder to iterate over all the compile units. 2013-10-17 10:27:12 +00:00
ExecutionEngine Fixing problems in lli's RemoteMemoryManager. 2013-10-11 22:47:10 +00:00
Feature
FileCheck Really fix CHECK-LABEL and CHECK-DAG interaction. This actually just restores the initial implementation that was in r186162 but got lost in some subsequent refactoring. More explicit variable names and comments are present now to hopefully prevent repeat regression, as well as another test. 2013-10-11 18:38:36 +00:00
Instrumentation tsan: implement no_sanitize_thread attribute 2013-10-17 07:20:06 +00:00
Integer
JitListener
Linker
LTO llvm/test/LTO should run also on cygwin. 2013-10-09 01:07:31 +00:00
MC MC asm parser: allow ?'s in symbol names, and handle @'s in names in MS asm 2013-10-18 20:46:28 +00:00
Object Create an atom with just the data that failed to disassemble. 2013-10-16 19:03:14 +00:00
Other
TableGen
tools
Transforms SLPVectorizer: Don't vectorize volatile memory operations 2013-10-16 17:52:40 +00:00
Unit
Verifier Add support for metadata representing .ident directives. 2013-10-16 01:49:05 +00:00
YAMLParser [Support][YAML] Add support for accessing tags and tag handle substitution. 2013-10-18 22:38:04 +00:00
CMakeLists.txt
lit.cfg
lit.site.cfg.in
Makefile
Makefile.tests
TestRunner.sh