Chris Lattner
567166c0a8
replace a slow and verbose version of Instruction::isUsedOutsideOfBlock with
...
a call to Instruction::isUsedOutsideOfBlock.
llvm-svn: 50005
2008-04-20 22:18:22 +00:00
Chris Lattner
9c1f1a82bf
we can only thread blocks when there is a pred we can determine the succ of.
...
llvm-svn: 50003
2008-04-20 21:18:09 +00:00
Chris Lattner
2115722ffa
improve comments, infrastructure, and add some validity checks for threading.
...
Add a cost function.
llvm-svn: 50002
2008-04-20 21:13:06 +00:00
Chris Lattner
b3b6007c8b
Add a new Jump Threading pass, which will handle cases
...
such as those in PR2235. Right now the pass is not very
effective. :)
llvm-svn: 50000
2008-04-20 20:35:01 +00:00
Torok Edwin
ab20784740
g++-4.3 build-fix: CHAR_BIT requires <climits>.
...
llvm-svn: 49989
2008-04-20 08:33:11 +00:00
Chris Lattner
3b18762f40
Switch to using Simplified ConstantFP::get API.
...
llvm-svn: 49977
2008-04-20 00:41:09 +00:00
Owen Anderson
f9ae76d89c
Make GVN able to remove unnecessary calls to read-only functions again.
...
llvm-svn: 49842
2008-04-17 05:36:50 +00:00
Dan Gohman
4fff979a43
Remove unnecessary <sstream> includes.
...
llvm-svn: 49681
2008-04-14 20:40:47 +00:00
Dan Gohman
e36714c0b4
Minor whitespace and comment cleanups.
...
llvm-svn: 49671
2008-04-14 18:26:16 +00:00
Owen Anderson
7629b71dd4
Revert r49614. As Dan pointed out, some of these aren't correct.
...
llvm-svn: 49657
2008-04-14 17:38:21 +00:00
Owen Anderson
1f6fbc4bc3
Replace calls of the form V1->setName(V2->getName()) with V1->takeName(V2),
...
which is significantly more efficient.
llvm-svn: 49614
2008-04-13 19:15:17 +00:00
Owen Anderson
1e73f29a7f
Fix PR2213 by simultaneously making GVN more aggressive with the return values
...
of calls and less aggressive with non-readnone calls.
llvm-svn: 49516
2008-04-11 05:11:49 +00:00
Dan Gohman
99b7b3f03b
Teach InstCombine's ComputeMaskedBits to handle pointer expressions
...
in addition to integer expressions. Rewrite GetOrEnforceKnownAlignment
as a ComputeMaskedBits problem, moving all of its special alignment
knowledge to ComputeMaskedBits as low-zero-bits knowledge.
Also, teach ComputeMaskedBits a few basic things about Mul and PHI
instructions.
This improves ComputeMaskedBits-based simplifications in a few cases,
but more noticeably it significantly improves instcombine's alignment
detection for loads, stores, and memory intrinsics.
llvm-svn: 49492
2008-04-10 18:43:06 +00:00
Devang Patel
a7dfbc0366
Be conservative if getresult operand is neither call nor invoke.
...
llvm-svn: 49430
2008-04-09 15:58:24 +00:00
Owen Anderson
ef9a6fd5c2
Factor a bunch of functionality related to memcpy and memset transforms out of
...
GVN and into its own pass.
llvm-svn: 49419
2008-04-09 08:23:16 +00:00
Owen Anderson
8ee792d1b6
Remove accidentally duplicated code.
...
llvm-svn: 49418
2008-04-09 07:55:01 +00:00
Owen Anderson
ed92b41a39
Add operator= implementations to SparseBitVector, allowing it to be used in GVN. This results
...
in both time and memory savings for GVN. For example, one testcase went from 10.5s to 6s with
this patch.
llvm-svn: 49345
2008-04-07 17:38:23 +00:00
Owen Anderson
0c1e634cbb
Make GVN more memory efficient, particularly on code that contains a large number of
...
allocations, which GVN can't optimize anyways.
llvm-svn: 49329
2008-04-07 09:59:07 +00:00
Chris Lattner
a39cfc5c5b
silence a warning when assertions are disabled.
...
llvm-svn: 49283
2008-04-06 21:44:08 +00:00
Gabor Greif
e9ecc68d8f
API changes for class Use size reduction, wave 1.
...
Specifically, introduction of XXX::Create methods
for Users that have a potentially variable number of
Uses.
llvm-svn: 49277
2008-04-06 20:25:17 +00:00
David Greene
586740f401
Iterators folloring a SmallVector erased element are invalidated so
...
don't access cached iterators from after the erased element.
Re-apply 49056 with SmallVector support.
llvm-svn: 49106
2008-04-02 18:24:46 +00:00
Tanya Lattner
052838c55d
Reverting 49056 due to the build being broken.
...
llvm-svn: 49060
2008-04-01 23:41:44 +00:00
David Greene
7f7edc3824
Iterators folloring a SmallVector erased element are invalidated so
...
don't access cached iterators from after the erased element.
llvm-svn: 49056
2008-04-01 22:14:23 +00:00
Nate Begeman
f2b0b0eb17
Don't eliminate bitcast instructions that change the type of a pointer
...
llvm-svn: 48971
2008-03-31 00:22:16 +00:00
Chris Lattner
0f760dfe09
Fix "Control reaches the end of non-void function" warnings,
...
patch by David Chisnall.
llvm-svn: 48963
2008-03-30 18:22:13 +00:00
Chris Lattner
4311ad2dae
change iterator invalidation avoidance to just move the iterator backward
...
when something changes, instead of moving forward. This allows us to
simplify memset lowering, inserting the memset at the end of the range of
stuff we're touching instead of at the start.
This, in turn, allows us to make use of the addressing instructions already
used in the function instead of inserting our own. For example, we now
codegen:
%tmp41 = getelementptr [8 x i8]* %ref_idx, i32 0, i32 0 ; <i8*> [#uses=2]
call void @llvm.memset.i64( i8* %tmp41, i8 -1, i64 8, i32 1 )
instead of:
%tmp20 = getelementptr [8 x i8]* %ref_idx, i32 0, i32 7 ; <i8*> [#uses=1]
%ptroffset = getelementptr i8* %tmp20, i64 -7 ; <i8*> [#uses=1]
call void @llvm.memset.i64( i8* %ptroffset, i8 -1, i64 8, i32 1 )
llvm-svn: 48940
2008-03-29 05:15:47 +00:00
Chris Lattner
ac95515741
make the common case of a single store (which clearly shouldn't be turned
...
into a memset!) faster by avoiding an allocation of an std::list node.
llvm-svn: 48939
2008-03-29 04:52:12 +00:00
Chris Lattner
d528b21a65
give form-memset a significantly more sane heuristic, enable it by default.
...
llvm-svn: 48937
2008-03-29 04:36:18 +00:00
Chris Lattner
d62964a7d8
make memset inference significantly more powerful: it can now handle
...
memsets that initialize "structs of arrays" and other store sequences
that are not sequential. This is still only enabled if you pass
-form-memset-from-stores. The flag is not heavily tested and I haven't
analyzed the perf regressions when -form-memset-from-stores is passed
either, but this causes no make check regressions.
llvm-svn: 48909
2008-03-28 06:45:13 +00:00
Devang Patel
eb1e3fcbe0
PHI->removeIncomingValue may remove PHInode.
...
Increment iterator in advance.
llvm-svn: 48890
2008-03-27 17:32:46 +00:00
Evan Cheng
2b72c05992
Handle a special case xor undef, undef -> 0. Technically this should be transformed to undef. But this is such a common idiom (misuse) we are going to handle it.
...
llvm-svn: 48791
2008-03-25 20:07:13 +00:00
Devang Patel
a38f58aa5c
Add incoming value from header only if phi node has any use inside the loop.
...
llvm-svn: 48738
2008-03-24 20:16:14 +00:00
Evan Cheng
21a8e3d260
Temporarily disabling memset forming optimization. Add an option.
...
llvm-svn: 48720
2008-03-24 05:28:38 +00:00
Evan Cheng
c3cf9f872a
Transform (zext (or (icmp), (icmp))) to (or (zext (cimp), (zext icmp))) if at least one of the (zext icmp) can be transformed to eliminate an icmp.
...
llvm-svn: 48715
2008-03-24 00:21:34 +00:00
Chris Lattner
53ccb62712
implement an initial hack at a straight-line store -> memset optimization.
...
This fires dozens of times across spec and multisource, but I don't know
if it actually speeds stuff up. Hopefully the testers will show something
nice :)
llvm-svn: 48680
2008-03-22 05:37:16 +00:00
Chris Lattner
168be766a8
implement the logic for memset insertion and store deletion.
...
llvm-svn: 48679
2008-03-22 04:13:49 +00:00
Chris Lattner
f5d41c67af
This is a partially implemented and currently disabled start of a store
...
merging optimization. Nothing to see here, hopefully more later :)
llvm-svn: 48670
2008-03-22 00:31:52 +00:00
Dan Gohman
9988569af8
Don't include <map> in Pass.h, which doesn't need it. This requires
...
adding <map> to many files that actually do need it.
llvm-svn: 48667
2008-03-21 23:51:57 +00:00
Chris Lattner
804209d17c
the size of a smallvector shouldn't be part of the interface to these methods.
...
llvm-svn: 48662
2008-03-21 22:01:16 +00:00
Chris Lattner
beb216da0a
make gvn marginally faster by reallocating the lastSeenLoad map for
...
each basic block.
llvm-svn: 48660
2008-03-21 21:33:23 +00:00
Chris Lattner
2876a645c3
Minor cleanups and shrinkification.
...
llvm-svn: 48658
2008-03-21 21:14:38 +00:00
Dan Gohman
a25dde6fee
Handle getresult instructions in different basic blocks
...
from their aggregate operands by moving the getresult
instructions.
llvm-svn: 48657
2008-03-21 21:01:32 +00:00
Duncan Sands
c9e09a0588
Fix the build for gcc-4.2.
...
llvm-svn: 48639
2008-03-21 08:32:17 +00:00
Chris Lattner
c44160ce6e
Teach masked value is zero about add and sub, and use MVIZ to
...
simplify things like (X & 4) >> 1 == 2 --> (X & 4) == 4.
since it is obvious that the shift doesn't remove any bits.
llvm-svn: 48631
2008-03-21 05:19:58 +00:00
Gordon Henriksen
b81777a354
C and Objective Caml bindings for mem2reg and reg2mem.
...
Patch by Erick Tryzelaar.
llvm-svn: 48602
2008-03-20 17:16:03 +00:00
Devang Patel
b727960f78
Add comment.
...
llvm-svn: 48567
2008-03-19 23:05:52 +00:00
Evan Cheng
a90fdc4340
Remove dead options.
...
llvm-svn: 48556
2008-03-19 22:02:26 +00:00
Devang Patel
924ca7f01d
Update heuritics that estimates cost of call instructions.
...
llvm-svn: 48474
2008-03-17 23:41:20 +00:00
Gordon Henriksen
82a0e74f43
C and Objective Caml bindings for several scalar transforms.
...
Patch originally by Erick Tryzelaar, but has been modified somewhat.
llvm-svn: 48419
2008-03-16 16:32:40 +00:00
Bill Wendling
68a930b33e
The inst combining of inttoptr into GEP with one index was using the bit size of
...
the type instead of the byte size. This was causing troublesome mis-compilations.
True to form, this took 2 days to find and is a one-line fix. :-P
llvm-svn: 48354
2008-03-14 05:12:19 +00:00