1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 20:12:56 +02:00
Commit Graph

510 Commits

Author SHA1 Message Date
Eli Friedman
ff5c248066 Slightly generalize transformation of memmove(a,a,n) so that it also applies
to memcpy. (Such a memcpy is technically illegal, but in practice is safe
and is generated by struct self-assignment in C code.)

llvm-svn: 91621
2009-12-17 21:07:31 +00:00
Eli Friedman
5c7e38b936 Aggressively flip compare constant expressions where appropriate; constant
folding in particular expects null to be on the RHS.

llvm-svn: 91587
2009-12-17 06:07:04 +00:00
Benjamin Kramer
6cd9b2ba74 Fix some CHECK lines which were ignored by accident.
llvm-svn: 91214
2009-12-12 09:25:50 +00:00
Nick Lewycky
10693e2bb0 Generalize this optimization to work on equality comparisons between any two
integers that are constant except for a single bit (the same n-th bit in each).

llvm-svn: 90646
2009-12-05 05:00:00 +00:00
Chris Lattner
851aea6ce2 fix PR5673 by being more careful about pointers to functions.
llvm-svn: 90369
2009-12-03 01:05:45 +00:00
Chris Lattner
2d3554c3d9 merge sext-2 into sext.ll
llvm-svn: 90293
2009-12-02 05:34:35 +00:00
Chris Lattner
3781027d07 rename test
llvm-svn: 90292
2009-12-02 05:32:33 +00:00
Chris Lattner
2c2a69cd14 filecheckize
llvm-svn: 90291
2009-12-02 05:32:16 +00:00
Mon P Wang
91ac05d480 Fixed an assertion failure for tracking sext of a vector of integers
llvm-svn: 90290
2009-12-02 04:59:58 +00:00
Nick Lewycky
116b145b02 Teach ConstantFolding to do a better job when folding gep(bitcast).
This permits the devirtualization of llvm.org/PR3100#c9 when compiled by clang.

llvm-svn: 90099
2009-11-29 21:40:55 +00:00
Chris Lattner
cd6fed25d5 add testcases for the foo_with_overflow op xforms added recently and
fix bugs exposed by the tests.  Testcases from Alastair Lynn!

llvm-svn: 90056
2009-11-29 02:57:29 +00:00
Chris Lattner
d48ff7ea6a Implement PR5634.
llvm-svn: 90046
2009-11-29 00:51:17 +00:00
Chris Lattner
cf7665b0c8 Fix PR5471 by removing an instcombine xform. Some pieces of the code
generates store to undef and some generates store to null as the idiom
for undefined behavior.  Since simplifycfg zaps both, don't remove the
undefined behavior in instcombine.

llvm-svn: 89971
2009-11-26 22:04:42 +00:00
Dan Gohman
58bb87921b Make ConstantFoldConstantExpression recursively visit the entire
ConstantExpr, not just the top-level operator. This allows it to
fold many more constants.

Also, make GlobalOpt call ConstantFoldConstantExpression on
GlobalVariable initializers.

llvm-svn: 89659
2009-11-23 16:22:21 +00:00
Nick Lewycky
9d1ee635e3 Reapply r88830 with a bugfix: this transform only applies to icmp eq/ne. This
fixes part of PR5438.

llvm-svn: 89639
2009-11-23 03:17:33 +00:00
Nick Lewycky
f05946faff Revert r88830 and r88831 which appear to have caused a selfhost buildbot some
grief. I suspect this patch merely exposed a bug else.

llvm-svn: 88841
2009-11-15 07:47:32 +00:00
Nick Lewycky
62f00c17eb Correct typo.
llvm-svn: 88831
2009-11-15 06:16:57 +00:00
Nick Lewycky
14a2122db3 Teach instcombine to look for booleans in wider integers when it encounters a
zext(icmp). It may be able to optimize that away. This fixes one of the cases
in PR5438.

llvm-svn: 88830
2009-11-15 05:55:17 +00:00
Duncan Sands
f0d9823d0b Don't trivially delete unused calls to llvm.invariant.start. This allows
llvm.invariant.start to be used without necessarily being paired with a call
to llvm.invariant.end.  If you run the entire optimization pipeline then such
calls are in fact deleted (adce does it), but that's actually a good thing since
we probably do want them to be zapped late in the game.  There should really be
an integration test that checks that the llvm.invariant.start call lasts long
enough that all passes that do interesting things with it get to do their stuff
before it is deleted.  But since no passes do anything interesting with it yet
this will have to wait for later.

llvm-svn: 86840
2009-11-11 15:34:13 +00:00
Chris Lattner
562cc40dbb unify the code that determines whether it is a good idea to change the type
of a computation.  This fixes some infinite loops when dealing with TD that
has no native types.

llvm-svn: 86670
2009-11-10 07:23:37 +00:00
Chris Lattner
f2b3c795fd if a 'with overflow' intrinsic just has the normal result used, simplify
it to a normal binop.  Patch by Alastair Lynn, testcase by me.

llvm-svn: 86524
2009-11-09 07:07:56 +00:00
Chris Lattner
5a3a41a757 enhance PHI slicing to handle the case when a slicable PHI is begin
used by a chain of other PHIs.

llvm-svn: 86503
2009-11-09 01:38:00 +00:00
Chris Lattner
6c67b00026 Teach an instcombine to not pull trunc instructions through PHI nodes
when both the source and dest are illegal types, since it would cause
the phi to grow (for example, we shouldn't transform test14b's phi to
a phi on i320).  This fixes an infinite loop on i686 bootstrap with
phi slicing turned on, so turn it back on.

llvm-svn: 86483
2009-11-08 21:20:06 +00:00
Chris Lattner
11b6e3c1eb reapply r8644[3-5] with only the scary part
(SliceUpIllegalIntegerPHI) disabled.

llvm-svn: 86480
2009-11-08 19:23:30 +00:00
Daniel Dunbar
1543f2c26f Speculatively revert r8644[3-5], they seem to be leading to infinite loops in
llvm-gcc bootstrap.

llvm-svn: 86478
2009-11-08 17:52:47 +00:00
Chris Lattner
d8faf7adb4 another more interesting test.
llvm-svn: 86445
2009-11-08 08:36:40 +00:00
Chris Lattner
a8adfad5b9 feature test for the new transformation in r86443
llvm-svn: 86444
2009-11-08 08:30:58 +00:00
Chris Lattner
cddc8aa1b8 teach a couple of instcombine transformations involving PHIs to
not turn a PHI in a legal type into a PHI of an illegal type, and
add a new optimization that breaks up insane integer PHI nodes into
small pieces (PR3451).

llvm-svn: 86443
2009-11-08 08:21:13 +00:00
Chris Lattner
c6bb31e5ea make instcombine only rewrite a chain of computation
(eliminating some extends) if the new type of the
computation is legal or if both the source and dest
are illegal.  This prevents instcombine from changing big
chains of computation into i64 on 32-bit targets for 
example.

llvm-svn: 86398
2009-11-07 19:11:46 +00:00
Chris Lattner
d8ab8fbe9f move two functions up higher in the file. Delete a useless argument
to EmitGEPOffset.  

Implement some new transforms for optimizing 
subtracts of two pointer to ints into the same vector.  This happens
for C++ iterator idioms for example, stringmap takes a const char*
that points to the start and end of a string.  Once inlined, we want
the pointer difference to turn back into a length.

This is rdar://7362831.

llvm-svn: 86021
2009-11-04 08:05:20 +00:00
Chris Lattner
aede55dc9b filecheckize this test.
llvm-svn: 86020
2009-11-04 07:57:05 +00:00
Kenneth Uildriks
e711736014 Make opt default to not adding a target data string and update tests that depend on target data to supply it within the test
llvm-svn: 85900
2009-11-03 15:29:06 +00:00
Chris Lattner
b94afb778c fix instcombine to only do store sinking when the alignments
of the two loads agree.  Propagate that onto the new store.

llvm-svn: 85772
2009-11-02 02:06:37 +00:00
Chris Lattner
96bfb792af merge a test into store.ll
llvm-svn: 85771
2009-11-02 02:00:18 +00:00
Chris Lattner
0eaddd9187 convert to filecheck
llvm-svn: 85770
2009-11-02 01:58:03 +00:00
Chris Lattner
326adfb172 merge phi-merge.ll into phi.ll
I don't know what Dan wants to do with phi-merge-gep.ll, I'll let
him deal with it because instcombine may end up sinking these.

llvm-svn: 85739
2009-11-01 20:10:11 +00:00
Chris Lattner
f3c2039dde when merging two loads, make sure to take the min of their alignment,
not the max.  This didn't matter until the previous patch because
instcombine would refuse to sink loads with differenting alignments.

llvm-svn: 85738
2009-11-01 20:07:07 +00:00
Chris Lattner
b3fe1009a5 fix a bug noticed by inspection: when instcombine sinks loads through
phis, it didn't preserve the alignment of the load.  This is a missed
optimization of the alignment is high and a miscompilation when the
alignment is low.

llvm-svn: 85736
2009-11-01 19:50:13 +00:00
Chris Lattner
c0f971670d convert to filecheck.
llvm-svn: 85734
2009-11-01 19:22:20 +00:00
Edward O'Callaghan
e9e8913261 Convert a few tests to FileCheck for PR5307.
llvm-svn: 85171
2009-10-26 22:52:03 +00:00
Dan Gohman
795e3db7ce Code that checks WillNotOverflowSignedAdd before creating an Add
can safely use the NSW bit on the Add.

llvm-svn: 85164
2009-10-26 22:14:22 +00:00
Chris Lattner
7f9ddaf7e3 reapply r85085 with a bugfix to avoid infinite looping.
All of the 'demorgan' related xforms need to use 
dyn_castNotVal, not m_Not.

llvm-svn: 85119
2009-10-26 15:40:07 +00:00
Evan Cheng
7dad155ec7 Revert 85085. It causes infinite looping during llvm-gcc build.
llvm-svn: 85090
2009-10-26 03:51:32 +00:00
Chris Lattner
192549ef70 Implement PR3266 & PR5276, folding:
not (or (icmp, icmp)) -> and(icmp, icmp)

llvm-svn: 85085
2009-10-26 01:06:31 +00:00
Chris Lattner
c88c01adb6 convert or.ll to filecheck and merge or2 into it.
llvm-svn: 85083
2009-10-25 23:47:55 +00:00
Victor Hernandez
e8998896f5 Auto-upgrade free instructions to calls to the builtin free function.
Update all analysis passes and transforms to treat free calls just like FreeInst.
Remove RaiseAllocations and all its tests since FreeInst no longer needs to be raised.

llvm-svn: 84987
2009-10-24 04:23:03 +00:00
Chris Lattner
7c507ae857 fix PR5262.
llvm-svn: 84810
2009-10-22 00:17:26 +00:00
Chris Lattner
bf5a89d82b revert r84754, it isn't the right approach. Edwin, please propose
patches for fixes like this instead of committing them directly.

llvm-svn: 84799
2009-10-21 23:41:58 +00:00
Victor Hernandez
0996619220 Make changes to rev 84292 as requested by Chris Lattner.
Most changes are cleanup, but there is 1 correctness fix:
I fixed InstCombine so that the icmp is removed only if the malloc call is removed (which requires explicit removal because the Worklist won't DCE any calls since they can have side-effects).

llvm-svn: 84772
2009-10-21 19:11:40 +00:00
Torok Edwin
a8a12b7d98 Fix PR5262: when folding select into PHI, make sure all operands are available
in the PHI's Basic Block. This uses a conservative approach, because we don't
have dominator info in instcombine.

llvm-svn: 84754
2009-10-21 10:49:00 +00:00