aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Don't delete asm's just because their inputs are undefined;Dale Johannesen2009-07-141-0/+11
| | | | | | | | 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
* PR4548: optimize zext+udiv+trunc to udiv.Eli Friedman2009-07-131-0/+19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75539 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix bug in run-line.Eli Friedman2009-07-131-3/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75534 91177308-0d34-0410-b5e6-96231b3b80d8
* Canonicalize boolean +/- a constant to a select.Eli Friedman2009-07-131-0/+31
| | | | | | | | | | (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
* Reapply 75252, with a fix to avoid the infinite recursion case. TheDan Gohman2009-07-131-1/+0
| | | | | | | | 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
* Move the re-sort of invalidated NonLocalPointerDeps cache earlierChris Lattner2009-07-131-0/+67
| | | | | | | | | | | | 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
* Revert r75252 which was causing some crashes at compile time.Nick Lewycky2009-07-111-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75384 91177308-0d34-0410-b5e6-96231b3b80d8
* Generalize ScalarEvolution's cast-folding code to support more kindsDan Gohman2009-07-101-0/+143
| | | | | | | | 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
* There's no need to consider PHI nodes in the same block as the instructionNick Lewycky2009-07-092-0/+74
| | | | | | | 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
* Remove the vicmp and vfcmp instructions. Because we never had a release withNick Lewycky2009-07-081-12/+12
| | | | | | | | 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
* do not try to analyze bitcasts from i64 to <2 x i32> in ComputedMaskedBits. ↵Chris Lattner2009-07-021-0/+15
| | | | | | | | | | 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
* Fix an instcombine abort on a scalar-to-vector bitcast. This fixes PR4487.Dan Gohman2009-07-011-0/+14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74646 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't cache PHI exit values from exhaustive evaluations, becauseDan Gohman2009-06-291-0/+78
| | | | | | | | | 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
* Don't try to split a loop when the controlling icmp instructionDan Gohman2009-06-271-0/+195
| | | | | | | 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
* Teach LoopSimplify how to merge multiple loop exits into a single exit,Dan Gohman2009-06-271-0/+45
| | | | | | | | | | | | | | | | | 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
* When a value is used multiple times within a single PHI, instructionsDan Gohman2009-06-271-0/+33
| | | | | | | | | 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
* Add some testcases for some of the recent ScalarEvolution bug fixes.Dan Gohman2009-06-261-0/+33
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74353 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix LCSSA to avoid emitting a PHI node for the unwind destination ofDan Gohman2009-06-261-0/+143
| | | | | | | | 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
* Simplify [su]max(MAX, n) to MAX. This comes up in loop tripcountDan Gohman2009-06-242-3/+66
| | | | | | | | | | 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
* When inserting code into a loop preheader, insert it before theDan Gohman2009-06-241-0/+61
| | | | | | | | | 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
* Fix ScalarEvolution's backedge-taken count computations to check forDan Gohman2009-06-211-2/+4
| | | | | | | | | 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
* Expand this test to handle more cases (remainder and shifts) of zero.Nick Lewycky2009-06-211-0/+11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73839 91177308-0d34-0410-b5e6-96231b3b80d8
* implement PR4424: 0/x is always 0 for integer division.Chris Lattner2009-06-211-0/+12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73835 91177308-0d34-0410-b5e6-96231b3b80d8
* Tweak this test to be a little less unusual.Dan Gohman2009-06-201-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73808 91177308-0d34-0410-b5e6-96231b3b80d8
* Generalize isLoopGuardedByCond's checking to consider twoDan Gohman2009-06-201-0/+107
| | | | | | | | | | | 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
* Don't (unconditionally) use getSCEVAtScope to simplify the stepDan Gohman2009-06-191-0/+18
| | | | | | | | | 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
* make jump threading handle lexically identical compare instructionsChris Lattner2009-06-191-0/+30
| | | | | | | | | 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
* Teach jump threading to look at comparisons between phi nodes and non-constants.Nick Lewycky2009-06-191-0/+21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73755 91177308-0d34-0410-b5e6-96231b3b80d8
* Improve tail call elim to move loads above readonly callsChris Lattner2009-06-192-0/+165
| | | | | | | | 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
* part of PR4405: disable a contentious optimization forChris Lattner2009-06-191-10/+0
| | | | | | | | | strcmp -> memcmp when the lengths of the strings are unknown. Patch by Nick Lewycky! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73751 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the code from IVUsers that attempted to handleDan Gohman2009-06-182-2/+5
| | | | | | | | | | | | casted induction variables in cases where the cast isn't foldable. It ended up being a pessimization in many cases. This could be fixed, but it would require a bunch of complicated code in IVUsers' clients. The advantages of this approach aren't visible enough to justify it at this time. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73706 91177308-0d34-0410-b5e6-96231b3b80d8
* Generalize the zext(trunc(t) & C) instcombine to work even withDan Gohman2009-06-181-1/+16
| | | | | | | | C is not a low-bits mask, and add a similar instcombine for zext((trunc(t) & C) ^ C). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73705 91177308-0d34-0410-b5e6-96231b3b80d8
* Instcombine zext(trunc(x) & mask) to x&mask, even if the trunc hasDan Gohman2009-06-171-0/+23
| | | | | | | multiple users. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73656 91177308-0d34-0410-b5e6-96231b3b80d8
* Add -disable-output to a bunch of tests that don't care about the output.Dan Gohman2009-06-171-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73633 91177308-0d34-0410-b5e6-96231b3b80d8
* This fixes a bug introduced in 72661, which canDale Johannesen2009-06-172-4/+77
| | | | | | | | | | | | | | | | | move loads back past a check that the load address is valid, see new testcase. The test that went in with 72661 has exactly this case, except that the conditional it's moving past is checking something else; I've settled for changing that test to reference a global, not a pointer. It may be possible to scan all the tests you pass and make sure none of them are checking any component of the address, but it's not trivial and I'm not trying to do that here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73632 91177308-0d34-0410-b5e6-96231b3b80d8
* Correct an accidental duplication of the test (patch doesn't handle Eli Friedman2009-06-171-9/+0
| | | | | | | | creating new files very well). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73599 91177308-0d34-0410-b5e6-96231b3b80d8
* PR3439: Correct a silly mistake in the SimplifyDemandedUseBits code for Eli Friedman2009-06-171-0/+18
| | | | | | | | SRem. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73598 91177308-0d34-0410-b5e6-96231b3b80d8
* Generalize a few more instcombines to be vector/scalar-independent.Dan Gohman2009-06-162-0/+15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73541 91177308-0d34-0410-b5e6-96231b3b80d8
* Instcombine's ShrinkDemandedConstant may strip bits out of constants,Dan Gohman2009-06-161-0/+14
| | | | | | | | | obscuring what would otherwise be a low-bits mask. Use ComputeMaskedBits to compute what ShrinkDemandedConstant knew about to reconstruct a low-bits mask value. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73540 91177308-0d34-0410-b5e6-96231b3b80d8
* Testcase for r73506Chris Lattner2009-06-161-0/+15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73508 91177308-0d34-0410-b5e6-96231b3b80d8
* Support vector casts in more places, fixing a variety of assertionDan Gohman2009-06-151-0/+55
| | | | | | | | | | | | | | | | failures. To support this, add some utility functions to Type to help support vector/scalar-independent code. Change ConstantInt::get and ConstantFP::get to support vector types, and add an overload to ConstantInt::get that uses a static IntegerType type, for convenience. Introduce a new getConstant method for ScalarEvolution, to simplify common use cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73431 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the crash in this test. This is basically the sameDale Johannesen2009-06-151-0/+557
| | | | | | | | | | problem addressed in 31284, but the patch there only addressed the case where an invoke is the first thing in a block. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73416 91177308-0d34-0410-b5e6-96231b3b80d8
* fix testcase to properly check for the patch in r73195.Chris Lattner2009-06-151-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73380 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement more aggressive folding of add operand lists whenDan Gohman2009-06-141-0/+38
| | | | | | | | | | | they contain multiplications of constants with add operations. This helps simplify several kinds of things; in particular it helps simplify expressions like ((-1 * (%a + %b)) + %a) to %b, as expressions like this often come up in loop trip count computations. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73361 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach SCEVExpander's visitAddRecExpr to reuse an existing canonicalDan Gohman2009-06-132-1/+25
| | | | | | | | | | | | | | | | | | induction variable when the addrec to be expanded does not require a wider type. This eliminates the need for IndVarSimplify to micro-manage SCEV expansions, because SCEVExpander now automatically expands them in the form that IndVarSimplify considers to be canonical. (LSR still micro-manages its SCEV expansions, because it's optimizing for the target, rather than for other optimizations.) Also, this uses the new getAnyExtendExpr, which has more clever expression simplification logic than the IndVarSimplify code it replaces, and this cleans up some ugly expansions in code such as the included masked-iv.ll testcase. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73294 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't do (x - (y - z)) --> (x + (z - y)) on floating-point types, becauseDan Gohman2009-06-121-0/+8
| | | | | | | it may round differently. This fixes PR4374. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73243 91177308-0d34-0410-b5e6-96231b3b80d8
* Given two identical weak functions, produce one internal function and two weakNick Lewycky2009-06-121-0/+13
| | | | | | | thunks. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73230 91177308-0d34-0410-b5e6-96231b3b80d8
* This test is wrong. If you have two weak functions F and G you can't makeNick Lewycky2009-06-121-11/+0
| | | | | | | | either one call the other since either one can be replaced at link time, and they need to be independent. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73225 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix 4366: store to null in non-default addr space should not beChris Lattner2009-06-111-0/+7
| | | | | | | turned into unreachable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73195 91177308-0d34-0410-b5e6-96231b3b80d8
* PR4340: Run SimplifyDemandedVectorElts on insertelement instructions; Eli Friedman2009-06-061-0/+14
| | | | | | | | sometimes it can find simplifications that won't be found otherwise. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73006 91177308-0d34-0410-b5e6-96231b3b80d8