aboutsummaryrefslogtreecommitdiff
path: root/test/Transforms
AgeCommit message (Collapse)Author
2009-07-23merge vector-casts-0.ll into vector-casts.llChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76864 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-23Make some existing optimizations that would only trigger on scalarsChris Lattner
also apply to vectors. This allows us to compile this: #include <emmintrin.h> __m128i a(__m128 a, __m128 b) { return a==a & b==b; } __m128i b(__m128 a, __m128 b) { return a!=a | b!=b; } to: _a: cmpordps %xmm1, %xmm0 ret _b: cmpunordps %xmm1, %xmm0 ret with clang instead of to a ton of horrible code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76863 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-23convert a test to filecheck format. This fixes an endemic problemChris Lattner
with negative tests: this test wasn't checking what it thought it was because it was grepping .bc, not .ll. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76861 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-23rename testChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76860 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-21Add a testcase for PR2831.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76527 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-20The upper argument of ConstantRange is exclusive, not inclusive.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76492 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-20Revert the addition of hasNoPointerOverflow to GEPOperator.Dan Gohman
Getelementptrs that are defined to wrap are virtually useless to optimization, and getelementptrs that are undefined on any kind of overflow are too restrictive -- it's difficult to ensure that all intermediate addresses are within bounds. I'm going to take a different approach. Remove a few optimizations that depended on this flag. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76437 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-18Canonicalize bitcasts between types like <1 x i64> and i64 to Eli Friedman
insertelement/extractelement. I'm not entirely sure this is precisely what we want to do: should we prefer bitcast(insertelement) or insertelement(bitcast)? Similarly. should we prefer extractelement(bitcast) or bitcast(extractelement)? git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76345 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-18Back out 76300; apparently the preference is to canonicalize the other Eli Friedman
way (bitcast -> insert/extractelement). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76325 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-18Add combine: X sdiv (1 << Y) -> X udiv (1 << Y) when X doesn't have the Eli Friedman
sign bit set. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76304 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-18Canonicalize insert/extractelement from single-element vectors into Eli Friedman
bitcasts. It would also be possible to canonicalize the other way; does anyone have a preference? git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76300 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-18Fix simplifylibcalls memset recognition to work on 64-bit platforms Eli Friedman
where int is 32 bits. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76293 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-16Fill in some holes in ScalarEvolution's loop iteration conditionDan Gohman
analysis. This allows indvars to emit a simpler loop trip count expression. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76085 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-15Switch invars away from using isTrapping when it really shouldn't be Eli Friedman
using it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75852 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-15Don't restrict the set of instructions where we try to constant-fold the Eli Friedman
operands; it's possible to end up with a constant-foldable operand to most instructions, even those which can't trap. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75845 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14Fix the expansion of umax and smax in the case where one or more ofDan Gohman
the operands have pointer type, so that the resulting type matches the original SCEV type, and so that unnecessary ptrtoints are avoided in common cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75680 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14Add a testcase for a bug fixed by r75634.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75644 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14Revert 75571; I'm convinced this isn't the right thing to do.Dale Johannesen
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75642 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14Fix trivial todo in instcombine.Eli Friedman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75586 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14Update LoopSimplify and LoopUnswitch to use the new makeLoopInvariantDan Gohman
function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75584 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14Fix indvars to not assume that a loop with a single unique exitDan Gohman
block has a single unique exiting block. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75579 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14Don't delete asm's just because their inputs are undefined;Dale Johannesen
xor R, R is a common and valid idiom for zeroing a register, for example. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75571 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-13PR4548: optimize zext+udiv+trunc to udiv.Eli Friedman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75539 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-13Fix bug in run-line.Eli Friedman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75534 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-13Canonicalize boolean +/- a constant to a select.Eli Friedman
(I think it's reasonably clear that we want to have a canonical form for constructs like this; if anyone thinks that a select is not the best canonical form, please tell me.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75531 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-13Reapply 75252, with a fix to avoid the infinite recursion case. TheDan Gohman
check for avoiding re-analyzing a widening cast needed to happen earlier, as getSCEV itself may result in a isLoopGuardedByCond query. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75511 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-13Move the re-sort of invalidated NonLocalPointerDeps cache earlierChris Lattner
so that all code paths get it. PR4256 was about a case where the phi translation loop would find all preds in the Visited cache, so it could get by without re-sorting the NonLocalPointerDeps cache. Fix this by resorting it earlier, there is no reason not to do this. This patch inspired by Jakub Staszak's patch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75476 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-11Revert r75252 which was causing some crashes at compile time.Nick Lewycky
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75384 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-10Generalize ScalarEvolution's cast-folding code to support more kindsDan Gohman
of loops. Add several new functions to for working with ScalarEvolution's add-hoc value-range analysis functionality. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75252 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-09There's no need to consider PHI nodes in the same block as the instructionNick Lewycky
we're inserting sigma/phi functions for. Patch by Andre Tavares. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75138 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-08Remove the vicmp and vfcmp instructions. Because we never had a release withNick Lewycky
these instructions, no autoupgrade or backwards compatibility support is provided. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74991 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-02do not try to analyze bitcasts from i64 to <2 x i32> in ComputedMaskedBits. ↵Chris Lattner
While we could do this, doing so requires adjusting the demanded mask and the code isn't doing that yet. This fixes PR4495 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74699 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01Fix an instcombine abort on a scalar-to-vector bitcast. This fixes PR4487.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74646 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-29Don't cache PHI exit values from exhaustive evaluations, becauseDan Gohman
an individual exhaustive evaluation reflects only the exit value implied by an individual exit, which may differ from the actual exit value of the loop if there are other exits. This fixes PR4477. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74447 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-27Don't try to split a loop when the controlling icmp instructionDan Gohman
doesn't have an IV-based operand. This fixes PR4471. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74399 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-27Teach LoopSimplify how to merge multiple loop exits into a single exit,Dan Gohman
when one of them can be converted to a trivial icmp and conditional branch. This addresses what is essentially a phase ordering problem. SimplifyCFG knows how to do this transformation, but it doesn't do so if the primary block has any instructions in it other than an icmp and a branch. In the given testcase, the block contains other instructions, however they are loop-invariant and can be hoisted. SimplifyCFG doesn't have LoopInfo though, so it can't hoist them. And, it's important that the blocks be merged before LoopRotation, as it doesn't support multiple-exit loops. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74396 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-27When a value is used multiple times within a single PHI, instructionsDan Gohman
inserted to replace that value must dominate all of of the basic blocks associated with the uses of the value in the PHI, not just one of them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74376 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26Add some testcases for some of the recent ScalarEvolution bug fixes.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74353 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26Fix LCSSA to avoid emitting a PHI node for the unwind destination ofDan Gohman
an invoke instruction, since the value isn't really live across that edge. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74242 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24Simplify [su]max(MAX, n) to MAX. This comes up in loop tripcountDan Gohman
computations in loops with multiple exits. Adjust the testcase for PR4436 so that the relevant portion isn't optimized away. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74073 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24When inserting code into a loop preheader, insert it before theDan Gohman
terminator, instead of after the last phi. This fixes a bug exposed by ScalarEvolution analyzing more kinds of loops. This fixes PR4436. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74072 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-21Fix ScalarEvolution's backedge-taken count computations to check forDan Gohman
overflow when computing a integer division to round up. Thanks to Nick Lewycky for noticing this! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73862 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-21Expand this test to handle more cases (remainder and shifts) of zero.Nick Lewycky
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73839 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-21implement PR4424: 0/x is always 0 for integer division.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73835 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-20Tweak this test to be a little less unusual.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73808 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-20Generalize isLoopGuardedByCond's checking to consider twoDan Gohman
SCEVUnknowns with identical Instructions to be equal. This allows it to analze cases such as the attached testcase, where the front-end has cloned the loop controlling expression. Along with r73805, this lets IndVarSimplify eliminate all the sign-extend casts in the loop in the attached testcase. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73807 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-19Don't (unconditionally) use getSCEVAtScope to simplify the stepDan Gohman
expression in IVUsers, because in the case of a use of a non-linear addrec outside of a loop, this causes the addrec to be evaluated as a linear addrec. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73774 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-19make jump threading handle lexically identical compare instructionsChris Lattner
as if they were multiple uses of the same instruction. This interacts well with the existing loadpre that j-t does to open up many new jump threads earlier. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73768 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-19Teach jump threading to look at comparisons between phi nodes and non-constants.Nick Lewycky
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73755 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-19Improve tail call elim to move loads above readonly callsChris Lattner
when it allows forming a tail call. Patch by Frits van Bommel. This implements PR4323. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73752 91177308-0d34-0410-b5e6-96231b3b80d8