Commit Graph

3169 Commits

Author SHA1 Message Date
Owen Anderson
ea12a06a81 Very first part of a GVN-PRE implementation. It currently performs a bunch of analysis, and nothing more. It is also quite slow for the moment. However,
it should give a sense of what's going on.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37343 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-29 21:53:49 +00:00
Chris Lattner
7139406707 Fix PR1446 by not scalarrepl'ing giant structures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37326 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-24 18:43:04 +00:00
Dan Gohman
fa73ea2d9f Minor comment cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37321 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-24 14:36:04 +00:00
Chris Lattner
2b7e0ade62 fix a miscompilation when passing a float through varargs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37297 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-23 01:17:04 +00:00
Chris Lattner
a2b18de4ba Fix Transforms/InstCombine/2007-05-18-CastFoldBug.ll, a bug that devastates
objc code due to the way the FE lowers objc message sends.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37256 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-19 06:51:32 +00:00
Chris Lattner
fb3e1190fc Handle negative strides much more optimally. This compiles X86/lsr-negative-stride.ll
into:

_t:
        movl 8(%esp), %ecx
        movl 4(%esp), %eax
        cmpl %ecx, %eax
        je LBB1_3       #bb17
LBB1_1: #bb
        cmpl %ecx, %eax
        jg LBB1_4       #cond_true
LBB1_2: #cond_false
        subl %eax, %ecx
        cmpl %ecx, %eax
        jne LBB1_1      #bb
LBB1_3: #bb17
        ret
LBB1_4: #cond_true
        subl %ecx, %eax
        cmpl %ecx, %eax
        jne LBB1_1      #bb
        jmp LBB1_3      #bb17

instead of:

_t:
        subl $4, %esp
        movl %esi, (%esp)
        movl 12(%esp), %ecx
        movl 8(%esp), %eax
        cmpl %ecx, %eax
        je LBB1_4       #bb17
LBB1_1: #bb.outer
        movl %ecx, %edx
        negl %edx
LBB1_2: #bb
        cmpl %ecx, %eax
        jle LBB1_5      #cond_false
LBB1_3: #cond_true
        addl %edx, %eax
        cmpl %ecx, %eax
        jne LBB1_2      #bb
LBB1_4: #bb17
        movl (%esp), %esi
        addl $4, %esp
        ret
LBB1_5: #cond_false
        movl %ecx, %edx
        subl %eax, %edx
        movl %eax, %esi
        addl %esi, %esi
        cmpl %ecx, %esi
        je LBB1_4       #bb17
LBB1_6: #cond_false.bb.outer_crit_edge
        movl %edx, %ecx
        jmp LBB1_1      #bb.outer


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37252 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-19 01:22:21 +00:00
Devang Patel
9f26f73179 Fix PR1431
Test case at Transformations/SCCP/2007-05-16-InvokeCrash.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37185 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-17 22:10:15 +00:00
Chris Lattner
ce3e2bff8b selects can also reach here
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37081 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-15 06:42:04 +00:00
Chris Lattner
6b6aef8efc Fix Transforms/InstCombine/2007-05-14-Crash.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37057 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-15 00:16:00 +00:00
Dan Gohman
d9efdb2012 Correct a few comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37034 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-14 14:31:17 +00:00
Chris Lattner
79cfddf646 Fix Transforms/GlobalOpt/2007-05-13-Crash.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37020 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-13 21:28:07 +00:00
Chris Lattner
7d8ed8a941 significantly improve debug output of lsr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36996 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-11 22:40:34 +00:00
Dan Gohman
23d9d27c26 Fix typos.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36994 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-11 21:10:54 +00:00
Dan Gohman
c767844fc9 This patch extends the LoopUnroll pass to be able to unroll loops
with unknown trip counts. This is left off by default, and a
command-line option enables it. It also begins to separate loop
unrolling into a utility routine; eventually it might be made usable
from other passes.

It currently works by inserting conditional branches between each
unrolled iteration, unless it proves that the trip count is a
multiple of a constant integer > 1, which it currently only does in
the rare case that the trip count expression is a Mul operator with
a ConstantInt operand. Eventually this information might be provided
by other sources, for example by a pass that peels/splits the loop
for this purpose.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36990 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-11 20:53:41 +00:00
Chris Lattner
3aea1bdca5 fix regressions from my previous checking, including
Transforms/InstCombine/2006-12-08-ICmp-Combining.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36989 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-11 16:58:45 +00:00
Chris Lattner
8885887b9c fix Transforms/InstCombine/2007-05-10-icmp-or.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36984 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-11 05:55:56 +00:00
Devang Patel
fd98dc9a76 Fix PR1333
Testcases :
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070507/049451.html
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070507/049452.html


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36955 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-09 08:24:12 +00:00
Dan Gohman
1cc0096d55 Fix various whitespace inconsistencies.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36936 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-08 15:19:19 +00:00
Dan Gohman
f742c2363c Correct the comment for ApproximateLoopSize to reflect what it actually does.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36935 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-08 15:14:19 +00:00
Dale Johannesen
6603a1bff0 Don't generate branch to entry block.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36917 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-08 01:01:04 +00:00
Chris Lattner
1ce6f8da72 Fix PR1395, by passing the ID correctly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36894 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-06 23:13:56 +00:00
Nick Lewycky
ecd94c804a Fix typo in comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36873 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-06 13:37:16 +00:00
Chris Lattner
6f6f5125e2 Fix a bug in my previous patch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36857 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-06 07:24:03 +00:00
Chris Lattner
8c756c1fff Implement Transforms/InstCombine/cast_ptr.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36809 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-05 22:41:33 +00:00
Chris Lattner
d717c1859a wrap long lines
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36807 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-05 22:32:24 +00:00
Chris Lattner
caccc996e2 Fix Transforms/LoopUnroll/2007-05-05-UnrollMiscomp.ll and PR1385.
If we have a LCSSA, only modify the input value if the inval was defined
by an instruction in the loop.  If defined by something before the loop,
it is still valid.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36784 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-05 18:49:57 +00:00
Chris Lattner
a0c54f3ada make a temporary for *SI, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36782 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-05 18:36:36 +00:00
Chris Lattner
c42e226f08 Fix InstCombine/2007-05-04-Crash.ll and PR1384
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36775 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-05 01:59:31 +00:00
Dan Gohman
e5b01bea7b Use IntrinsicInst to test for prefetch instructions, which is ever so
slightly nicer than using CallInst with an extra check; thanks Chris.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36743 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-04 14:59:09 +00:00
Dan Gohman
2acc760165 Allow strength reduction to make use of addressing modes for the
address operand in a prefetch intrinsic.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36713 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-03 23:20:33 +00:00
Devang Patel
1997473cf7 Drop 'const'
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36662 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-03 01:11:54 +00:00
Devang Patel
3e15bf33e0 Use 'static const char' instead of 'static const int'.
Due to darwin gcc bug, one version of darwin linker coalesces
static const int, which defauts PassID based pass identification.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36652 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-02 21:39:20 +00:00
Lauro Ramos Venancio
c718288f49 Fix build error.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36648 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-02 20:37:47 +00:00
Devang Patel
794fd75c67 Do not use typeinfo to identify pass in pass manager.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36632 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-01 21:15:47 +00:00
Anton Korobeynikov
c6c98af9e5 Implement review feedback
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36564 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-29 18:02:48 +00:00
Anton Korobeynikov
a80e1181b7 Implement review feedback. Aliasees can be either GlobalValue's or
bitcasts of them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36537 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-28 13:45:00 +00:00
Chris Lattner
7f3c4d49df fix a bug triggered by 403.gcc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36527 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-28 05:27:36 +00:00
Chris Lattner
e62f021c8c Fix several latent bugs in EmitGEPOffset that didn't manifest with its
previous clients.  This fixes MallocBench/gs


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36525 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-28 04:52:43 +00:00
Chris Lattner
53c22fc7c6 uhn zap cvs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36523 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-28 03:50:56 +00:00
Chris Lattner
9bc1464094 Implement PR1345 and Transforms/InstCombine/bitcast-gep.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36521 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-28 00:57:34 +00:00
Chris Lattner
d3e28347e5 refactor some code relating to pointer cast xforms, pulling it out of the codepath
for unrelated casts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36511 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-27 17:44:50 +00:00
Zhou Sheng
c125c00e68 Using APInt more efficiently.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36475 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-26 16:42:07 +00:00
Devang Patel
68c01b3cf3 Mem2Reg does not need TargetData.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36444 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-25 18:32:35 +00:00
Devang Patel
41968df51e Remove unused function argument.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36441 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-25 17:15:20 +00:00
Anton Korobeynikov
8b0a8c84da Implement aliases. This fixes PR1017 and it's dependent bugs. CFE part
will follow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36435 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-25 14:27:10 +00:00
Chris Lattner
79b3bd395d If an alloca only has two types of uses: 1) reads 2) a memcpy/memmove that
copies from a constant global, then we can change the reads to read from the
global instead of from the alloca.  This eliminates the alloca and the memcpy,
and promotes secondary optimizations (because the loads are now loads from
a constant global).

This is important for a common C idiom:

void foo() {
   int A[] = {1,2,3,4,5,6,7,8,9...};
   ... only reads of A ...
}

For some reason, people forget to mark the array static or const.

This triggers on these multisource benchmarks:
JM/ldecode: block_pos, [3 x [4 x [4 x i32]]]
FreeBench/mason: m, [18 x i32], inlined 4 times
MiBench/office-stringsearch: search_strings, [1332 x i8*]
MiBench/office-stringsearch: find_strings, [1333 x i8*]
Prolangs-C++/city: dirs, [9 x i8*], inlined 4 places

and these spec benchmarks:
177.mesa: message, [8 x [32 x i8]]
186.crafty: bias_rl45, [64 x i32]
186.crafty: diag_sq, [64 x i32]
186.crafty: empty, [9 x i8]
186.crafty: xlate, [15 x i8]
186.crafty: status, [13 x i8]
186.crafty: bdinfo, [25 x i8]
445.gobmk: routines, [16 x i8*]
458.sjeng: piece_rep, [14 x i8*]
458.sjeng: t, [13 x i32], inlined 4 places.
464.h264ref: block8x8_idx, [3 x [4 x [4 x i32]]]
464.h264ref: block_pos, [3 x [4 x [4 x i32]]]
464.h264ref: j_off_tab, [12 x i32]

This implements Transforms/ScalarRepl/memcpy-from-global.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36429 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-25 06:40:51 +00:00
Chris Lattner
a10b29b84b refactor the SROA code out into its own method, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36426 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-25 05:02:56 +00:00
Owen Anderson
ab0e4d38f0 Undo my previous changes. Since my approach to this problem is being revised,
this approach is no longer appropriate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36421 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-25 04:18:54 +00:00
Devang Patel
75abc1ed06 Fix
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070423/048376.html


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36417 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-25 00:37:04 +00:00
Owen Anderson
3a2b58f3ad Rollback some changes that adversely affected performance. I'm currently rethinking
my approach to this, so hopefully I'll find a way to do this without making this slower.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36392 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-24 06:40:39 +00:00