| #
0f4a6401 |
| 19-Feb-2011 |
Chris Lattner <sabre@nondot.org> |
Implement rdar://9009151, transforming strided loop stores of unsplatable values into memset_pattern16 when it is available (recent darwins). This transforms lots of strided loop stores of ints for
Implement rdar://9009151, transforming strided loop stores of unsplatable values into memset_pattern16 when it is available (recent darwins). This transforms lots of strided loop stores of ints for example, like 5 in vpr:
Formed memset: call void @memset_pattern16(i8* %4, i8* getelementptr inbounds ([16 x i8]* @.memset_pattern9, i32 0, i32 0), i64 %tmp25) from store to: {%3,+,4}<%11> at: store i32 3, i32* %scevgep, align 4, !tbaa !4
llvm-svn: 126040
show more ...
|
| #
8643810e |
| 04-Jan-2011 |
Chris Lattner <sabre@nondot.org> |
Teach loop-idiom to turn a loop containing a memset into a larger memset when safe.
The testcase is basically this nested loop: void foo(char *X) { for (int i = 0; i != 100; ++i) for (int j =
Teach loop-idiom to turn a loop containing a memset into a larger memset when safe.
The testcase is basically this nested loop: void foo(char *X) { for (int i = 0; i != 100; ++i) for (int j = 0; j != 100; ++j) X[j+i*100] = 0; }
which gets turned into a single memset now. clang -O3 doesn't optimize this yet though due to a phase ordering issue I haven't analyzed yet.
llvm-svn: 122806
show more ...
|
| #
9c69406f |
| 02-Jan-2011 |
Chris Lattner <sabre@nondot.org> |
fix a miscompilation of tramp3d-v4: when forming a memcpy, we have to make sure that the loop we're promoting into a memcpy doesn't mutate the input of the memcpy. Before we were just checking that
fix a miscompilation of tramp3d-v4: when forming a memcpy, we have to make sure that the loop we're promoting into a memcpy doesn't mutate the input of the memcpy. Before we were just checking that the dest of the memcpy wasn't mod/ref'd by the loop.
llvm-svn: 122712
show more ...
|
| #
5702a43c |
| 02-Jan-2011 |
Chris Lattner <sabre@nondot.org> |
If a loop iterates exactly once (has backedge count = 0) then don't mess with it. We'd rather peel/unroll it than convert all of its stores into memsets.
llvm-svn: 122711
|
| #
8455b6e4 |
| 02-Jan-2011 |
Chris Lattner <sabre@nondot.org> |
enhance loop idiom recognition to scan *all* unconditionally executed blocks in a loop, instead of just the header block. This makes it more aggressive, able to handle Duncan's Ada examples.
llvm-s
enhance loop idiom recognition to scan *all* unconditionally executed blocks in a loop, instead of just the header block. This makes it more aggressive, able to handle Duncan's Ada examples.
llvm-svn: 122704
show more ...
|
| #
ddf58010 |
| 02-Jan-2011 |
Chris Lattner <sabre@nondot.org> |
Allow loop-idiom to run on multiple BB loops, but still only scan the loop header for now for memset/memcpy opportunities. It turns out that loop-rotate is successfully rotating loops, but *DOESN'T
Allow loop-idiom to run on multiple BB loops, but still only scan the loop header for now for memset/memcpy opportunities. It turns out that loop-rotate is successfully rotating loops, but *DOESN'T MERGE THE BLOCKS*, turning "for loops" into 2 basic block loops that loop-idiom was ignoring.
With this fix, we form many *many* more memcpy and memsets than before, including on the "history" loops in the viterbi benchmark, which look like this:
for (j=0; j<MAX_history; ++j) { history_new[i][j+1] = history[2*i][j]; }
Transforming these loops into memcpy's speeds up the viterbi benchmark from 11.98s to 3.55s on my machine. Woo.
llvm-svn: 122685
show more ...
|
| #
85b6d81d |
| 02-Jan-2011 |
Chris Lattner <sabre@nondot.org> |
teach loop idiom recognition to form memcpy's from simple loops.
llvm-svn: 122678
|
| #
a3514441 |
| 01-Jan-2011 |
Chris Lattner <sabre@nondot.org> |
add a validity check that was missed, fixing a crash on the new testcase.
llvm-svn: 122662
|
| #
91a44358 |
| 01-Jan-2011 |
Chris Lattner <sabre@nondot.org> |
improve validity check to handle constant-trip-count loops more aggressively. In practice, this doesn't help anything though, see the todo.
llvm-svn: 122660
|
| #
8b3baf6d |
| 01-Jan-2011 |
Chris Lattner <sabre@nondot.org> |
implement the "no aliasing accesses in loop" safety check. This pass should be correct now.
llvm-svn: 122659
|
| #
29e14edc |
| 26-Dec-2010 |
Chris Lattner <sabre@nondot.org> |
implement enough of the memset inference algorithm to recognize and insert memsets. This is still missing one important validity check, but this is enough to compile stuff like this:
void test0(st
implement enough of the memset inference algorithm to recognize and insert memsets. This is still missing one important validity check, but this is enough to compile stuff like this:
void test0(std::vector<char> &X) { for (std::vector<char>::iterator I = X.begin(), E = X.end(); I != E; ++I) *I = 0; }
void test1(std::vector<int> &X) { for (long i = 0, e = X.size(); i != e; ++i) X[i] = 0x01010101; }
With: $ clang t.cpp -S -o - -O2 -emit-llvm | opt -loop-idiom | opt -O3 | llc
to:
__Z5test0RSt6vectorIcSaIcEE: ## @_Z5test0RSt6vectorIcSaIcEE ## BB#0: ## %entry subq $8, %rsp movq (%rdi), %rax movq 8(%rdi), %rsi cmpq %rsi, %rax je LBB0_2 ## BB#1: ## %bb.nph subq %rax, %rsi movq %rax, %rdi callq ___bzero LBB0_2: ## %for.end addq $8, %rsp ret ... __Z5test1RSt6vectorIiSaIiEE: ## @_Z5test1RSt6vectorIiSaIiEE ## BB#0: ## %entry subq $8, %rsp movq (%rdi), %rax movq 8(%rdi), %rdx subq %rax, %rdx cmpq $4, %rdx jb LBB1_2 ## BB#1: ## %for.body.preheader andq $-4, %rdx movl $1, %esi movq %rax, %rdi callq _memset LBB1_2: ## %for.end addq $8, %rsp ret
llvm-svn: 122573
show more ...
|