History log of /external/llvm/lib/Analysis/InstructionSimplify.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
ae707bd5594e52a8b385760f99ff58aa8fede948 05-Sep-2011 Benjamin Kramer <benny.kra@googlemail.com> InstSimplify: Don't try to replace an extractvalue/insertvalue pair with the original value if types don't match.

Fixes clang selfhost.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139120 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
dabc2806726a286b00313419fac8461ebe0f774c 05-Sep-2011 Duncan Sands <baldrick@free.fr> Add some simple insertvalue simplifications, for the purpose of cleaning
up do-nothing exception handling code produced by dragonegg.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139113 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
f23d4adbfaf870d5fa67c6bff0da7891d3a98f9d 17-Aug-2011 Eli Friedman <eli.friedman@gmail.com> Revert r137781; I agree with Duncan's comment that the situation in question is clearly impossible given the current structure of the code.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137853 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
207634263c6a5271d6a10f802c4970ffcd34d271 17-Aug-2011 Eli Friedman <eli.friedman@gmail.com> Extend the undef ^ undef idiom once more. No testcase: I can't figure out how to actually trigger the codepath in question at the moment, but it might get exposed in the future.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137781 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
c9d904ee2ca36ab6238ed93c7ad2ea67b5fd0a23 04-Aug-2011 Duncan Sands <baldrick@free.fr> Fix what seems an obvious typo. Patch by Ivan Krasin. Problem
reported at http://habrahabr.ru/blogs/compilers/125626/.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136865 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
f56138d4aeb6d271cb353d70a794fa1525d892c3 26-Jul-2011 Duncan Sands <baldrick@free.fr> Add helper function for getting true/false constants in a uniform
way for i1 and vector of i1 types. Use these to make some code
more self-documenting.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136079 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
a9203109f4ac95aa7e9624f2838e3d89623ec902 25-Jul-2011 Jay Foad <jay.foad@gmail.com> Convert GetElementPtrInst to use ArrayRef.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135904 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
dab3d29605a5c83db41b28176273ef55961120c1 21-Jul-2011 Jay Foad <jay.foad@gmail.com> Convert ConstantExpr::getGetElementPtr and
ConstantExpr::getInBoundsGetElementPtr to use ArrayRef.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135673 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
b9b54ebfed02f0654897d37e8a4448d3f8087558 19-Jul-2011 Jay Foad <jay.foad@gmail.com> Convert SimplifyGEPInst to use ArrayRef.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135482 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
1d2f569c3428d70d0cf690c9adb459ad4a3ecff2 19-Jul-2011 Jay Foad <jay.foad@gmail.com> Use ArrayRef in ConstantFoldInstOperands and ConstantFoldCall.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135477 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
db125cfaf57cc83e7dd7453de2d509bc8efd0e5e 18-Jul-2011 Chris Lattner <sabre@nondot.org> land David Blaikie's patch to de-constify Type, with a few tweaks.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135375 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
68c0dbc14fb7599987fb3e27be4e12c1ac36535e 01-Jul-2011 Dan Gohman <gohman@apple.com> Improve constant folding of undef for cmp and select operators.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134223 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
e864b5b840c58d0b04324082ec94a7156743ed60 07-May-2011 Duncan Sands <baldrick@free.fr> The comparision "max(x,y)==x" is equivalent to "x>=y". Since the max is
often expressed as "x >= y ? x : y", there is a good chance we can extract
the existing "x >= y" from it and use that as a replacement for "max(x,y)==x".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131049 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
b6e7cd655c6ee119dbeacc321ee92387f983edb0 05-May-2011 Eli Friedman <eli.friedman@gmail.com> PR9838: Fix transform introduced in r127064 to not trigger when only one side of the icmp is an exact shift.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130954 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
8140ad32ce45281ed2bc4f6ca388a6ed9f806550 04-May-2011 Duncan Sands <baldrick@free.fr> Add variations on: max(x,y) >= min(x,z) folds to true. This isn't that common,
but according to my super-optimizer there are only two missed simplifications
of -instsimplify kind when compiling bzip2, and this is one of them. It amuses
me to have bzip2 be perfectly optimized as far as instsimplify goes!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130840 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
ad20681cdeaf72383891b153b925624aa585be4d 03-May-2011 Duncan Sands <baldrick@free.fr> Implement some basic simplifications involving min/max, for example
max(a,b) >= a -> true. According to my super-optimizer, these are
by far the most common simplifications (of the -instsimplify kind)
that occur in the testsuite and aren't caught by -std-compile-opts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130780 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
448a6d3cc23f2a249778bb341ae26589568efdf8 02-May-2011 Duncan Sands <baldrick@free.fr> Fix PR9579: when simplifying a compare to "true" or "false", and it was
a vector compare, generate a vector result rather than i1 (and crashing).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130706 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
f24ed77d2416b66178d8ff1d807858dfab37ca18 02-May-2011 Duncan Sands <baldrick@free.fr> Move some rem transforms out of instcombine and into instsimplify.
This automagically provides a transform noticed by my super-optimizer
as occurring quite often: "rem x, (select cond, x, 1)" -> 0.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130694 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
562b84b3aea359d1f918184e355da82bf05eb290 11-Apr-2011 Jay Foad <jay.foad@gmail.com> Don't include Operator.h from InstrTypes.h.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129271 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
a0e2f38b25ce7c51c22ed40d8a315fe1dd98926d 09-Mar-2011 Nick Lewycky <nicholas@mxc.ca> Fix two cases I forgot to update when doing a mental "getSwappedPredicate".
Thanks Duncan Sands!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127323 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
84dd4fa2e36f72050f5c46577359f5df0467e3e4 09-Mar-2011 Nick Lewycky <nicholas@mxc.ca> Add another micro-optimization. Apologies for the lack of refactoring, but I
gave up when I realized I couldn't come up with a good name for what the
refactored function would be, to describe what it does.

This is PR9343 test12, which is test3 with arguments reordered. Whoops!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127318 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
58bfcdbcf6a7c1cac0187f7c6beb3afe9d8f5411 05-Mar-2011 Nick Lewycky <nicholas@mxc.ca> Thread comparisons over udiv/sdiv/ashr/lshr exact and lshr nuw/nsw whenever
possible. This goes into instcombine and instsimplify because instsimplify
doesn't need to check hasOneUse since it returns (almost exclusively) constants.

This fixes PR9343 #4 #5 and #8!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127064 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
e2ee753bc440d373717b8fd06c062d50f1005268 04-Mar-2011 Nick Lewycky <nicholas@mxc.ca> Revert broken srem logic from r126991.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127021 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
786792784e898f29febb3e7270d54b0e21e3c904 04-Mar-2011 Nick Lewycky <nicholas@mxc.ca> Fold "icmp pred (srem X, Y), Y" like we do for urem. Handle signed comparisons
in the urem case, though not the other way around. This is enough to get #3 from
PR9343!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126991 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
3a73e343d02ba3a00adf03311183cc0ccc960978 04-Mar-2011 Nick Lewycky <nicholas@mxc.ca> Teach instruction simplify to use constant ranges to solve problems of the form
"icmp pred %X, CI" and a number of examples where "%X = binop %Y, CI2".

Some of these cases (div and rem) used to make it through opt -O2, but the
others are probably now making code elsewhere redundant (probably instcombine).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126988 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
88cd0aadb2849a259e8656b0ff8439ef660db7c5 01-Mar-2011 Nick Lewycky <nicholas@mxc.ca> Optimize "icmp pred (urem X, Y), Y" --> true/false depending on pred. There's
more work to do here, "icmp ult (urem X, 10), 11" doesn't optimize away yet.
Fixes example 3 from PR9343!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126741 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
38f7f66fcc6ed5e43be4d9c96c782d4eabdb7342 20-Feb-2011 Benjamin Kramer <benny.kra@googlemail.com> Move "A | ~(A & ?) -> -1" from InstCombine to InstructionSimplify.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126082 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
5380d280702423990e37d0dac05c76a35ad31baa 13-Feb-2011 Duncan Sands <baldrick@free.fr> Remove pointless blank line.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125463 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
52fb846578714d14bbde9b28884a6a8729217677 13-Feb-2011 Duncan Sands <baldrick@free.fr> Teach instsimplify that X+Y>=X+Z is the same as Y>=Z if neither side overflows,
plus some variations of this. According to my auto-simplifier this occurs a lot
but usually in combination with max/min idioms. Because max/min aren't handled
yet this unfortunately doesn't have much effect in the testsuite.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125462 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
ffeb98ad3becfbb8e26270ef8751e37e4b6b0cd1 09-Feb-2011 Duncan Sands <baldrick@free.fr> Formatting and comment tweaks.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125200 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
81a0dc911586c77421c2255aa417dc9b350b9e20 09-Feb-2011 Chris Lattner <sabre@nondot.org> Teach instsimplify some tricks about exact/nuw/nsw shifts.
improve interfaces to instsimplify to take this info.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125196 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
aeaf3d484b4d4c35e8794378c4b6cfbbde718dd1 09-Feb-2011 Chris Lattner <sabre@nondot.org> Rework InstrTypes.h so to reduce the repetition around the NSW/NUW/Exact
versions of creation functions. Eventually, the "insertion point" versions
of these should just be removed, we do have IRBuilder afterall.

Do a massive rewrite of much of pattern match. It is now shorter and less
redundant and has several other widgets I will be using in other patches.
Among other changes, m_Div is renamed to m_IDiv (since it only matches
integer divides) and m_Shift is gone (it used to match all binops!!) and
we now have m_LogicalShift for the one client to use.

Enhance IRBuilder to have "isExact" arguments to things like CreateUDiv
and reduce redundancy within IRbuilder by having these methods chain to
each other more instead of duplicating code.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125194 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
163a84bbce69947aa314760e6068c704fc0df7a0 07-Feb-2011 Duncan Sands <baldrick@free.fr> Add an m_Div pattern for matching either a udiv or an sdiv and use it
to simplify the "(X/Y)*Y->X when the division is exact" transform.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125004 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
c6ee9181a51fdfa3c07e1e53695681c55aa98ce4 06-Feb-2011 Chris Lattner <sabre@nondot.org> teach instsimplify to transform (X / Y) * Y to X
when the div is an exact udiv.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124994 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
479b4b9ef06dd84097202ffa6aea07913cdf651c 05-Feb-2011 Anders Carlsson <andersca@mac.com> Fix another warning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124961 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
50ca4d37f7f3b460c6441eb5ad14625a7d86b5d9 03-Feb-2011 Duncan Sands <baldrick@free.fr> Improve threading of comparisons over select instructions (spotted by my
auto-simplifier). This has a big impact on Ada code, but not much else.
Unfortunately the impact is mostly negative! This is due to PR9004 (aka
SCCP failing to resolve conditional branch conditions in the destination
blocks of the branch), in which simple correlated expressions are not
resolved but complicated ones are, so simplifying has a bad effect!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124788 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
4b720718fbda1194f925e0a9d931bc220e8b0e3a 02-Feb-2011 Duncan Sands <baldrick@free.fr> Reenable the transform "(X*Y)/Y->X" when the multiplication is known not to
overflow (nsw flag), which was disabled because it breaks 254.gap. I have
informed the GAP authors of the mistake in their code, and arranged for the
testsuite to use -fwrapv when compiling this benchmark.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124746 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
f9e4a986c03fe3af7dbc9de0b0a9251280fbdf41 01-Feb-2011 Duncan Sands <baldrick@free.fr> Add a m_Undef pattern for convenience. This is so that code that uses
pattern matching can also pattern match undef, creating a more uniform
style.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124657 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
7681c6da606efcc392f76b8acea8301cb5fc7a0a 01-Feb-2011 Duncan Sands <baldrick@free.fr> Have m_One also match constant vectors for which every element is 1.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124655 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
7af00c0f6e4a5612a2438269a6f8a71b0ae9190e 30-Jan-2011 Duncan Sands <baldrick@free.fr> Commit 124487 broke 254.gap. See if disabling the part that might be triggered
by PR9088 fixes things.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124561 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
1895e98ef38afbe011575cc25f4889d96e37421b 30-Jan-2011 Duncan Sands <baldrick@free.fr> Transform (X/Y)*Y into X if the division is exact. Instcombine already knows how
to do this and more, but would only do it if X/Y had only one use. Spotted as the
most common missed simplification in SPEC by my auto-simplifier, now that it knows
about nuw/nsw/exact flags. This removes a bunch of multiplications from 447.dealII
and 483.xalancbmk. It also removes a lot from tramp3d-v4, which results in much
more inlining.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124560 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
5413880654585f01ea9880f24f07f27c8da56ba8 29-Jan-2011 Nick Lewycky <nicholas@mxc.ca> Fix comment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124544 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
1fca2c32cc99197215d3fd32a4ad05214c74edd1 29-Jan-2011 Frits van Bommel <fvbommel@gmail.com> Move InstCombine's knowledge of fdiv to SimplifyInstruction().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124534 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
79f4eea7a3375aef93bf0d9fb1785ffee801eb84 28-Jan-2011 Duncan Sands <baldrick@free.fr> This dyn_cast should be a cast. Pointed out by Frits van Bommel.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124497 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
a3e292c7e85efb33899f08238f57a85996a05a0b 28-Jan-2011 Duncan Sands <baldrick@free.fr> Thread divisions over selects and phis. This doesn't fire much and has basically
zero effect on the testsuite (it improves two Ada testcases).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124496 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
593faa53fa6d89841e601cc4571d143a6a05f0b4 28-Jan-2011 Duncan Sands <baldrick@free.fr> My auto-simplifier noticed that ((X/Y)*Y)/Y occurs several times in SPEC
benchmarks, and that it can be simplified to X/Y. (In general you can only
simplify (Z*Y)/Y to Z if the multiplication did not overflow; if Z has the
form "X/Y" then this is the case). This patch implements that transform and
moves some Div logic out of instcombine and into InstructionSimplify.
Unfortunately instcombine gets in the way somewhat, since it likes to change
(X/Y)*Y into X-(X rem Y), so I had to teach instcombine about this too.
Finally, thanks to the NSW/NUW flags, sometimes we know directly that "Z*Y"
does not overflow, because the flag says so, so I added that logic too. This
eliminates a bunch of divisions and subtractions in 447.dealII, and has good
effects on some other benchmarks too. It seems to have quite an effect on
tramp3d-v4 but it's hard to say if it's good or bad because inlining decisions
changed, resulting in massive changes all over.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124487 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
d70d1a5c44609af091f6fc3e29193f9f4756a74f 25-Jan-2011 Duncan Sands <baldrick@free.fr> According to my auto-simplifier the most common missed simplifications in
optimized code are:
(non-negative number)+(power-of-two) != 0 -> true
and
(x | 1) != 0 -> true
Instcombine knows about the second one of course, but only does it if X|1
has only one use. These fire thousands of times in the testsuite.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124183 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
9d32f60a6f7dbd8e83187481cd2ae0a2f3e726ce 20-Jan-2011 Duncan Sands <baldrick@free.fr> At -O123 the early-cse pass is run before instcombine has run. According to my
auto-simplier the transform most missed by early-cse is (zext X) != 0 -> X != 0.
This patch adds this transform and some related logic to InstructionSimplify
and removes some of the logic from instcombine (unfortunately not all because
there are several situations in which instcombine can improve things by making
new instructions, whereas instsimplify is not allowed to do this). At -O2 this
often results in more than 15% more simplifications by early-cse, and results in
hundreds of lines of bitcode being eliminated from the testsuite. I did see some
small negative effects in the testsuite, for example a few additional instructions
in three programs. One program, 483.xalancbmk, got an additional 35 instructions,
which seems to be due to a function getting an additional instruction and then
being inlined all over the place.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123911 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
b2f3c383ec62b959ee27d0a5fb890894c4e49e86 18-Jan-2011 Duncan Sands <baldrick@free.fr> For completeness, generalize the (X + Y) - Y -> X transform and add X - (X + 1) -> -1.
These were not recommended by my auto-simplifier since they don't fire often enough.
However they do fire from time to time, for example they remove one subtraction from
the final bitcode for 483.xalancbmk.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123755 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
fe02c69f84ad52d42be934e4fe702f03e4991a6a 18-Jan-2011 Duncan Sands <baldrick@free.fr> Simplify (X<<1)-X into X. According to my auto-simplier this is the most common missed
simplification in fully optimized code. It occurs sporadically in the testsuite, and
many times in 403.gcc: the final bitcode has 131 fewer subtractions after this change.
The reason that the multiplies are not eliminated is the same reason that instcombine
did not catch this: they are used by other instructions (instcombine catches this with
a more general transform which in general is only profitable if the operands have only
one use).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123754 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
c087e20331c8a4c3b77d96a73588e80c06d89e3d 14-Jan-2011 Duncan Sands <baldrick@free.fr> Turn X-(X-Y) into Y. According to my auto-simplifier this is the most common
simplification present in fully optimized code (I think instcombine fails to
transform some of these when "X-Y" has more than one use). Fires here and
there all over the test-suite, for example it eliminates 8 subtractions in
the final IR for 445.gobmk, 2 subs in 447.dealII, 2 in paq8p etc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123442 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
cf80bc1d4ac741620641c2bf48c25993bd478bd0 14-Jan-2011 Duncan Sands <baldrick@free.fr> Factorize common code out of the InstructionSimplify shift logic. Add in
threading of shifts over selects and phis while there. This fires here and
there in the testsuite, to not much effect. For example when compiling spirit
it fires 5 times, during early-cse, resulting in 6 more cse simplifications,
and 3 more terminators being folded by jump threading, but the final bitcode
doesn't change in any interesting way: other optimizations would have caught
the opportunity anyway, only later.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123441 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
c43cee3fbb3098f0647e50dd2c13bc55b027a228 14-Jan-2011 Duncan Sands <baldrick@free.fr> Move some shift transforms out of instcombine and into InstructionSimplify.
While there, I noticed that the transform "undef >>a X -> undef" was wrong.
For example if X is 2 then the top two bits must be equal, so the result can
not be anything. I fixed this in the constant folder as well. Also, I made
the transform for "X << undef" stronger: it now folds to undef always, even
though X might be zero. This is in accordance with the LangRef, but I must
admit that it is fairly aggressive. Also, I added "i32 X << 32 -> undef"
following the LangRef and the constant folder, likewise fairly aggressive.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123417 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
53ad861193e44454cd3051ddb34fae398827ab6c 13-Jan-2011 Duncan Sands <baldrick@free.fr> Remove some wrong code which fortunately was never executed (as explained in
the comment I added): an extern weak global may have a null address.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123373 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
6dc91253ab1872e118b08511a09d5c934988354e 13-Jan-2011 Duncan Sands <baldrick@free.fr> The most common simplification missed by instsimplify in unoptimized bitcode
is "X != 0 -> X" when X is a boolean. This occurs a lot because of the way
llvm-gcc converts gcc's conditional expressions. Add this, and a few other
similar transforms for completeness.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123372 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
124708d9b47cc53cb11d8bfed75b241b6eec86d4 01-Jan-2011 Duncan Sands <baldrick@free.fr> Revert commit 122654 at the request of Chris, who reckons that instsimplify
is the wrong hammer for this nail, and is probably right.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122661 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
7cf85e74e3885005ca8e5fdb155fa5351e255b85 01-Jan-2011 Duncan Sands <baldrick@free.fr> Fix a README item by having InstructionSimplify do a mild form of value
numbering, in which it considers (for example) "%a = add i32 %x, %y" and
"%b = add i32 %x, %y" to be equal because the operands are equal and the
result of the instructions only depends on the values of the operands.
This has almost no effect (it removes 4 instructions from gcc-as-one-file),
and perhaps slows down compilation: I measured a 0.4% slowdown on the large
gcc-as-one-file testcase, but it wasn't statistically significant.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122654 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
e21083aa3a79506f896d95d7147c3c4627a77ef0 28-Dec-2010 Benjamin Kramer <benny.kra@googlemail.com> Cast away "comparison between signed and unsigned integer" warnings.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122598 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
1cd05bb605e3c3eee9197d3f10b628c60d0cc07a 22-Dec-2010 Duncan Sands <baldrick@free.fr> When determining whether the new instruction was already present in
the original instruction, half the cases were missed (making it not
wrong but suboptimal). Also correct a typo (A <-> B) in the second
chunk.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122414 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
a3c44a5280042dbc0cde995675c225ede4528c6e 22-Dec-2010 Duncan Sands <baldrick@free.fr> Add some statistics, good for understanding how much more powerful
instcombine is compared to instsimplify.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122397 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
07f30fbd734069b80b90c6aeea0ae645ce3880c0 21-Dec-2010 Duncan Sands <baldrick@free.fr> While I don't think any later transforms can fire, it seems cleaner to
not assume this (for example in case more transforms get added below
it). Suggested by Frits van Bommel.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122332 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
75d289ed6201e82718343d7a36d2a2fa082f6217 21-Dec-2010 Duncan Sands <baldrick@free.fr> Fix inverted condition noticed by Frits van Bommel.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122331 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
82fdab335881cd90f8f7ab3ad1f1ca0bb3ee886a 21-Dec-2010 Duncan Sands <baldrick@free.fr> Pull a few more simplifications out of instcombine (there are still
plenty left though!), in particular for multiplication.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122330 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
3421d908539cc489d2b1dac67d8cbc07160b01db 21-Dec-2010 Duncan Sands <baldrick@free.fr> Teach InstructionSimplify about distributive laws. These transforms fire
quite often, but don't make much difference in practice presumably because
instcombine also knows them and more.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122328 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
0312a93693abc2eb682b2b101c889959888fd883 21-Dec-2010 Duncan Sands <baldrick@free.fr> Move checking of the recursion limit into the various Thread methods.
No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122327 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
566edb04b890cebca8f2eefa37af7371a1e756c9 21-Dec-2010 Duncan Sands <baldrick@free.fr> Add generic simplification of associative operations, generalizing
a couple of existing transforms. This fires surprisingly often, for
example when compiling gcc "(X+(-1))+1->X" fires quite a lot as well
as various "and" simplifications (usually with a phi node operand).
Most of the time this doesn't make a real difference since the same
thing would have been done elsewhere anyway, eg: by instcombine, but
there are a few places where this results in simplifications that we
were not doing before.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122326 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
ee9a2e322af96accc9e55ed6373c0057453714b1 20-Dec-2010 Duncan Sands <baldrick@free.fr> Have SimplifyBinOp dispatch Xor, Add and Sub to the corresponding methods
(they had just been forgotten before). Adding Xor causes "main" in the
existing testcase 2010-11-01-lshr-mask.ll to be hugely more simplified.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122245 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
fea3b218d61708ea3577f4ef14c8f7677a94db95 15-Dec-2010 Duncan Sands <baldrick@free.fr> Move Sub simplifications and additional Add simplifications out of
instcombine and into InstructionSimplify.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121861 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
f8b1a5ea9602bb65a5cf59d3d34f2851a08cdc3e 15-Dec-2010 Duncan Sands <baldrick@free.fr> If we detect that the instruction we are simplifying is unreachable, arrange for
it to be replaced by undef rather than not replaced at all, the idea being that
this may reduce the amount of work done by whoever called InstructionSimplify.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121860 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
e89ada98a6ed803ca865843678c4dd4cf77b14ee 29-Nov-2010 Chandler Carruth <chandlerc@gmail.com> Add some dead stores to pacify my least favorite GCC warning: may be
uninitialized. The warning is terrible, has incorrect source locations, and has
a huge false positive rate such as *all* of these.

If anyone has a better solution, please let me know. Alternatively, I'll
happily add -Wno-uninitialized to the -Werror build mode. Maybe I can even do
it *only* when building with GCC instead of Clang.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120281 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
4cd2ad15b43f21d641330b4b09961af08646445e 23-Nov-2010 Duncan Sands <baldrick@free.fr> Expand a little on the description of what InstructionSimplify does.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120016 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
a63395a30f9227bde826749d3480046301b47332 22-Nov-2010 Duncan Sands <baldrick@free.fr> If a GEP index simply advances by multiples of a type of zero size,
then replace the index with zero.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119974 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
85bbff6c94695f07cc1a9765b4d384ed18d2fd7c 22-Nov-2010 Duncan Sands <baldrick@free.fr> Move the "gep undef" -> "undef" transform from instcombine to
InstructionSimplify.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119970 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
e60d79faf7ef7bc4847f9e5d067af00b98dced7b 21-Nov-2010 Duncan Sands <baldrick@free.fr> Add a rather pointless InstructionSimplify transform, inspired by recent constant
folding improvements: if P points to a type of size zero, turn "gep P, N" into "P".
More generally, if a gep index type has size zero, instcombine could replace the
index with zero, but that is not done here.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119942 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
87689cfc54993959adb20b89a56bc58aad18ca56 19-Nov-2010 Duncan Sands <baldrick@free.fr> Remove threading of Xor over selects and phis, with an explanation
of why such threading is pointless.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119798 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
2b749870d0488c3b049edf5d0c8875f56f5b1bed 17-Nov-2010 Duncan Sands <baldrick@free.fr> Move some those Xor simplifications which don't require creating new
instructions out of InstCombine and into InstructionSimplify. While
there, introduce an m_AllOnes pattern to simplify matching with integers
and vectors with all bits equal to one.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119536 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
d261dc650a01ac5c51ab10f97f1e35aa6a770721 17-Nov-2010 Duncan Sands <baldrick@free.fr> Previously SimplifyInstruction could report that an instruction
simplified to itself (this can only happen in unreachable blocks).
Change it to return null instead. Hopefully this will fix some
buildbot failures.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119490 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
ff10341183adf74760e6118a55cbd1debf50f90f 17-Nov-2010 Duncan Sands <baldrick@free.fr> Fix a layering violation: hasConstantValue, which is part of the PHINode
class, uses DominatorTree which is an analysis. This change moves all of
the tricky hasConstantValue logic to SimplifyInstruction, and replaces it
with a very simple literal implementation. I already taught users of
hasConstantValue that need tricky stuff to use SimplifyInstruction instead.
I didn't update InlineFunction because the IR looks like it might be in a
funky state at the point it calls hasConstantValue, which makes calling
SimplifyInstruction dangerous since it can in theory do a lot of tricky
reasoning. This may be a pessimization, for example in the case where
all phi node operands are either undef or a fixed constant.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119459 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
1845009290e4d804ad377927bd8a08cca3036adc 16-Nov-2010 Duncan Sands <baldrick@free.fr> In which I discover the existence of loops. Threading an operation
over a phi node by applying it to each operand may be wrong if the
operation and the phi node are mutually interdependent (the testcase
has a simple example of this). So only do this transform if it would
be correct to perform the operation in each predecessor of the block
containing the phi, i.e. if the other operands all dominate the phi.
This should fix the FFMPEG snow.c regression reported by İsmail Dönmez.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119347 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
552008946530e01efdad15044e1f621883d14a3a 15-Nov-2010 Duncan Sands <baldrick@free.fr> Teach InstructionSimplify the trick of skipping incoming phi
values that are equal to the phi itself.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119161 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
eff0581583ef10e2872e9baf537a04b67d992101 14-Nov-2010 Duncan Sands <baldrick@free.fr> If dom tree information is available, make it possible to pass
it to get better phi node simplification.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119055 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
cd6636c737a82949ad13db2d0d918af6424fb78b 14-Nov-2010 Duncan Sands <baldrick@free.fr> Teach InstructionSimplify about phi nodes. I chose to have it simply
offload the work to hasConstantValue rather than do something more
complicated (such handling mutually recursive phis) because (1) it is
not clear it is worth it; and (2) if it is worth it, maybe such logic
would be better placed in hasConstantValue. Adjust some GVN tests
which are now cleaned up much further (eg: all phi nodes are removed).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119043 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
12a86f5b3199e72e6d967781acc76340f5920e46 14-Nov-2010 Duncan Sands <baldrick@free.fr> Strip trailing whitespace.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119038 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
bc68d71d2a858c748dbb1539201010bbc5758dc6 10-Nov-2010 Duncan Sands <baldrick@free.fr> Reduce the maximum recursion depth, 5 seems pointlessly too much.
Probably it should just be 1, but compromise with 3.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118718 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
a74a58c83be492b7d5b7383656f049909394cff4 10-Nov-2010 Duncan Sands <baldrick@free.fr> Teach InstructionSimplify how to look through PHI nodes. Since PHI
nodes can be used in loops, this could result in infinite looping
if there is no recursion limit, so add such a limit. It is also
used for the SelectInst case because in theory there could be an
infinite loop there too if the basic block is unreachable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118694 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
b2cbdc35ba85c04df15b0e991d9be371691ab08c 10-Nov-2010 Duncan Sands <baldrick@free.fr> Simplify binary operations where one operand is a select instruction.
The simplifications performed here never create new instructions, they
only return existing instructions (or a constant), and so are always a
win. In theory they should transform (for example)
%z = and i32 %x, %y
%s = select i1 %cond, i32 %y, i32 %z
%r = and i32 %x, %s
into
%r = and i32 %x, y
but in practice they get into a fight with instcombine, and lose.
Unfortunately instcombine does a poor job in this case. Nonetheless
I'm committing this transform to make it easier to discuss what to
do to make peace with instcombine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118679 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
3bbb0cc42b67b4bf2c488285666999963bab0f7e 09-Nov-2010 Duncan Sands <baldrick@free.fr> Factorize code, no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118516 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
92826def593df7a422c7b07f09342febce81ddd3 07-Nov-2010 Duncan Sands <baldrick@free.fr> Add simplification of floating point comparisons with the result
of a select instruction, the same as already exists for integer
comparisons.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118379 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
1ac7c9979a2d723ff4649ffad58df02732872a5f 07-Nov-2010 Duncan Sands <baldrick@free.fr> Fix a README item: when doing a comparison with the result
of a select instruction, see if doing the compare with the
true and false values of the select gives the same result.
If so, that can be used as the value of the comparison.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118378 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
4e282decf3960bfa6b1fe3fd77bb51ff96121515 16-Sep-2010 Owen Anderson <resistor@mac.com> Revert r114097, adding back in the assertion against replacing an Instruction by itself. Now that CorrelatedValuePropagation is
more careful not to call SimplifyInstructionsInBlock() on an unreachable block, the issue has been fixed at a higher level. Add
a big warning to SimplifyInstructionsInBlock() to hopefully prevent this in the future.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114117 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
4b91c3ac96fd93c7e9794d427787c29c68c25f68 16-Sep-2010 Owen Anderson <resistor@mac.com> Fix PR8161, in which an unreachable loop causes recursive instruction simplification to try
to replace an instruction with itself. Add a predicate to the simplifier to prevent this case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114097 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
6844c8ea5a67e551be7106d6b7b9e1a64eecbe51 11-Sep-2010 Benjamin Kramer <benny.kra@googlemail.com> Teach InstructionSimplify to fold (A & B) & A -> A & B and (A | B) | A -> A | B.

Reassociate does this but it doesn't catch all cases (e.g. if the operands are i1).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113651 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
d2bfe54b0a9f28c021d4f0790bdb5224d5579447 15-Jul-2010 Chris Lattner <sabre@nondot.org> Fix PR7647, handling the case when 'To' ends up being
mutated by recursive simplification. This also enhances
ReplaceAndSimplifyAllUses to actually do a real RAUW
at the end of it, which updates any value handles
pointing to "From" to start pointing to "To". This
seems useful for debug info and random other VH users.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108415 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
e2f93131fb78cf5650db9ca78b4aec3cc45f00be 15-Jul-2010 Eli Friedman <eli.friedman@gmail.com> Revert r108401; it breaks bootstrap :(



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108407 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
3ed60a2a2253fd519a2b2e48cacce10856198b62 15-Jul-2010 Eli Friedman <eli.friedman@gmail.com> Add AssertingVH which makes PR7647 break consistently.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108401 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
047542669a20505fc7c5f2d93caa5610aa3db2c5 20-Apr-2010 Chris Lattner <sabre@nondot.org> move some select simplifications out out instcombine into
inst simplify. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101873 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
c8e14b3d37b80abb6adb4b831af0452d9ecbf2b2 03-Mar-2010 Chris Lattner <sabre@nondot.org> fix incorrect folding of icmp with undef, PR6481.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97659 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
6b617a7213e159097a7e5c7216ed9b04921de4e1 22-Feb-2010 Dan Gohman <gohman@apple.com> Constant-fold certain comparisons with infinity and negative infinity.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96777 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
8aee8efc0c2e387faa7dae39fdf613a22889b566 27-Nov-2009 Chris Lattner <sabre@nondot.org> factor some logic out of instcombine into a new SimplifyAddInst method.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90011 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
c514c1f5218b8fe7499a0b9a4737860344cf4c43 27-Nov-2009 Chris Lattner <sabre@nondot.org> factor some instcombine simplifications for getelementptr out to a new
SimplifyGEPInst method in InstructionSimplify.h. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89980 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
40d8c28b27377199b7465ba2c5a2c59c6fd12fa9 10-Nov-2009 Chris Lattner <sabre@nondot.org> move some generally useful functions out of jump threading
into libanalysis and transformutils.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86735 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
70ce6d0819ffd5822bb176fffe94bcf29a1deda4 10-Nov-2009 Chris Lattner <sabre@nondot.org> I misread the parens, not so redundant after all.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86648 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
9f3ce36d7e58ec76442a2545782c69fcbac2a757 10-Nov-2009 Chris Lattner <sabre@nondot.org> remove some redundant parens.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86645 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
e34537856a544c83513e390ac9552a8bc3823346 10-Nov-2009 Chris Lattner <sabre@nondot.org> add a new SimplifyInstruction API, which is like ConstantFoldInstruction,
except that the result may not be a constant. Switch jump threading to
use it so that it gets things like (X & 0) -> 0, which occur when phi preds
are deleted and the remaining phi pred was a zero.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86637 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
d06094f0682f2ede03caff4892b1a57469896d48 10-Nov-2009 Chris Lattner <sabre@nondot.org> factor simplification logic for AND and OR out to InstSimplify from instcombine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86635 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
210c5d4880b525e064088b6fec713260128c16eb 10-Nov-2009 Chris Lattner <sabre@nondot.org> pull a bunch of logic out of instcombine into instsimplify for compare
simplification, this handles the foldable fcmp x,x cases among many others.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86627 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
9dbb42944c4d7caddab21016b24cca31019a3faf 10-Nov-2009 Chris Lattner <sabre@nondot.org> rename SimplifyCompare -> SimplifyCmpInst and split it into
Simplify[IF]Cmp pieces. Add some predicates to CmpInst to
determine whether a predicate is fp or int.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86624 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
8f73deaa8732a556046bf4ac6207be55972e3b74 10-Nov-2009 Chris Lattner <sabre@nondot.org> fix ConstantFoldCompareInstOperands to take the LHS/RHS as
individual operands instead of taking a temporary array


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86619 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp
9f3c25aeb3df77a336693308dc0f19a4983c99af 09-Nov-2009 Chris Lattner <sabre@nondot.org> stub out a new libanalysis "instruction simplify" interface that
takes decimated instructions and applies identities to them. This
is pretty minimal at this point, but I plan to pull some instcombine
logic out into these and similar routines.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86613 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/InstructionSimplify.cpp