summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* While SimplifyDemandedBits constant folds this, we can't rely on it here.Benjamin Kramer2011-04-021-2/+7
| | | | | | | | | | It's possible to craft an input that hits the recursion limits in a way that SimplifyDemandedBits doesn't simplify the icmp but ComputeMaskedBits can infer which bits are zero. No test case as it depends on too many other things. Fixes PR9609. llvm-svn: 128777
* Fix comment.Benjamin Kramer2011-04-011-2/+2
| | | | llvm-svn: 128745
* Tweaks to the icmp+sext-to-shifts optimization to address Frits' comments:Benjamin Kramer2011-04-011-6/+6
| | | | | | | | | | - Localize the check if an icmp has one use to a place where we know we're introducing something that's likely more expensive than a sext from i1. - Add an assert to make sure a case that would lead to a miscompilation is folded away earlier. - Fix a typo. llvm-svn: 128744
* Fix build.Benjamin Kramer2011-04-011-1/+2
| | | | llvm-svn: 128733
* InstCombine: Turn icmp + sext into bitwise/integer ops when the input has ↵Benjamin Kramer2011-04-011-0/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | only one unknown bit. int test1(unsigned x) { return (x&8) ? 0 : -1; } int test3(unsigned x) { return (x&8) ? -1 : 0; } before (x86_64): _test1: andl $8, %edi cmpl $1, %edi sbbl %eax, %eax ret _test3: andl $8, %edi cmpl $1, %edi sbbl %eax, %eax notl %eax ret after: _test1: shrl $3, %edi andl $1, %edi leal -1(%rdi), %eax ret _test3: shll $28, %edi movl %edi, %eax sarl $31, %eax ret llvm-svn: 128732
* InstCombine: Move (sext icmp) transforms into their own method. No intended ↵Benjamin Kramer2011-04-012-37/+43
| | | | | | functionality change. llvm-svn: 128731
* Instcombile optimization: extractelement(cast) -> cast(extractelement)Nadav Rotem2011-03-311-1/+9
| | | | llvm-svn: 128683
* InstCombine: APFloat can't perform arithmetic on PPC double doubles, don't ↵Benjamin Kramer2011-03-311-2/+4
| | | | | | | | even try. Thanks Eli! llvm-svn: 128676
* InstCombine: Fix transform to use the swapped predicate.Benjamin Kramer2011-03-311-2/+2
| | | | | | Thanks Frits! llvm-svn: 128628
* InstCombine: fold fcmp (fneg x), (fneg y) -> fcmp x, yBenjamin Kramer2011-03-311-0/+5
| | | | llvm-svn: 128627
* InstCombine: fold fcmp pred (fneg x), C -> fcmp swap(pred) x, -CBenjamin Kramer2011-03-311-0/+8
| | | | llvm-svn: 128626
* InstCombine: Shrink "fcmp (fpext x), C" to "fcmp x, C" if C can be ↵Benjamin Kramer2011-03-311-0/+34
| | | | | | | | losslessly converted to the type of x. Fixes PR9592. llvm-svn: 128625
* InstCombine: fold fcmp (fpext x), (fpext y) -> fcmp x, y.Benjamin Kramer2011-03-311-0/+7
| | | | llvm-svn: 128624
* * The DSE code that tested for overlapping needed to take into account the factBill Wendling2011-03-301-1/+3
| | | | | | | | | | | | that one of the numbers is signed while the other is unsigned. This could lead to a wrong result when the signed was promoted to an unsigned int. * Add the data layout line to the testcase so that it will test the appropriate thing. Patch by David Terei! llvm-svn: 128577
* InstCombine: If the divisor of an fdiv has an exact inverse, turn it into an ↵Benjamin Kramer2011-03-301-0/+12
| | | | | | | | fmul. Fixes PR9587. llvm-svn: 128546
* Remove PHINode::reserveOperandSpace(). Instead, add a parameter toJay Foad2011-03-3025-62/+44
| | | | | | PHINode::Create() giving the (known or expected) number of operands. llvm-svn: 128537
* (Almost) always call reserveOperandSpace() on newly created PHINodes.Jay Foad2011-03-3019-15/+38
| | | | llvm-svn: 128535
* InstCombine: Add a few missing combines for ANDs and ORs of sign bit tests.Benjamin Kramer2011-03-291-0/+24
| | | | | | | | On x86 we now compile "if (a < 0 && b < 0)" into testl %edi, %esi js IF.THEN llvm-svn: 128496
* DSE: Remove an early exit optimization that depended on the ordering of a ↵Benjamin Kramer2011-03-291-13/+0
| | | | | | | | SmallPtrSet. Fixes PR9569 and will hopefully make selfhost on ASLR-enabled systems more deterministic. llvm-svn: 128482
* Do some simple copy propagation through integer loads and stores when promotingCameron Zwarich2011-03-291-9/+14
| | | | | | | vector types. This helps a lot with inlined functions when using the ARM soft float ABI. Fixes <rdar://problem/9184212>. llvm-svn: 128453
* Remove tabs I accidentally added.Nick Lewycky2011-03-281-15/+15
| | | | llvm-svn: 128413
* Make more use of PHINode::getNumIncomingValues().Jay Foad2011-03-282-5/+5
| | | | llvm-svn: 128406
* Add some debug output when -instcombine uses RAUW. This can make debug ↵Frits van Bommel2011-03-271-1/+4
| | | | | | output for those cases much clearer since without this it only showed that the original instruction was removed, not what it was replaced with. llvm-svn: 128399
* Teach the transformation that moves binary operators around selects to preserveNick Lewycky2011-03-271-8/+22
| | | | | | the subclass optional data. llvm-svn: 128388
* Use APInt's umul_ov instead of rolling our own overflow detection.Benjamin Kramer2011-03-271-5/+6
| | | | llvm-svn: 128380
* Add a small missed optimization: turn X == C ? X : Y into X == C ? C : Y. ThisNick Lewycky2011-03-271-0/+13
| | | | | | | | | | removes one use of X which helps it pass the many hasOneUse() checks. In my analysis, this turns up very often where X = A >>exact B and that can't be simplified unless X has one use (except by increasing the lifetime of A which is generally a performance loss). llvm-svn: 128373
* Simplification noticed by Frits.Bill Wendling2011-03-261-3/+2
| | | | llvm-svn: 128333
* Rework the logic that determines if a store completely overlaps an ealier store.Bill Wendling2011-03-261-15/+23
| | | | | | | | | | | There are two ways that a later store can comletely overlap a previous store: 1. They both start at the same offset, but the earlier store's size is <= the later's size, or 2. The earlier store's offset is > the later's offset, but it's offset + size doesn't extend past the later's offset + size. llvm-svn: 128332
* Fix a typo and add a test.Cameron Zwarich2011-03-261-1/+1
| | | | llvm-svn: 128331
* PR9561: A store with a negative offset (via GEP) could erroniously say that itBill Wendling2011-03-261-0/+2
| | | | | | | completely overlaps a previous store, thus mistakenly deleting that store. Check for this condition. llvm-svn: 128319
* No functionality change, just adjust some whitespace for coding style ↵Nick Lewycky2011-03-251-2/+2
| | | | | | compliance. llvm-svn: 128257
* Debug intrinsics must be skipped at the beginning and ends of blocks, lest theyCameron Zwarich2011-03-241-2/+6
| | | | | | affect the generated code. llvm-svn: 128217
* It is enough for the CallInst to have no uses to be made a tail call with a retCameron Zwarich2011-03-241-1/+1
| | | | | | void; it doesn't need to have a void type. llvm-svn: 128212
* s/UpdateDT/ModifiedDT/gDevang Patel2011-03-241-8/+8
| | | | llvm-svn: 128211
* Do early taildup of ret in CodeGenPrepare for potential tail calls that have aCameron Zwarich2011-03-241-17/+37
| | | | | | void return type. This fixes PR9487. llvm-svn: 128197
* Use an early return instead of a long if block.Cameron Zwarich2011-03-241-51/+51
| | | | llvm-svn: 128196
* When UpdateDT is set, DT is invalid, which could cause problems when trying toCameron Zwarich2011-03-241-2/+3
| | | | | | use it later. I couldn't make a test that hits this with the current code. llvm-svn: 128195
* Check for TLI so that -codegenprepare can be used from opt.Cameron Zwarich2011-03-241-0/+3
| | | | llvm-svn: 128194
* Fix PR9464 by correcting some math that just happened to be right in most casesCameron Zwarich2011-03-231-11/+10
| | | | | | that were hit in practice. llvm-svn: 128146
* Handle another case that Frits suggested.Anders Carlsson2011-03-221-2/+4
| | | | llvm-svn: 128068
* Simplify.Devang Patel2011-03-211-5/+4
| | | | llvm-svn: 128030
* More cleanups to the OptimizeEmptyGlobalCXXDtors GlobalOpt function.Anders Carlsson2011-03-211-15/+9
| | | | llvm-svn: 127997
* As suggested by Nick Lewycky, ignore debugging intrinsics when trying to ↵Anders Carlsson2011-03-211-0/+7
| | | | | | decide whether a destructor is empty or not. llvm-svn: 127985
* Fix commentsNick Lewycky2011-03-211-2/+2
| | | | llvm-svn: 127984
* Re-apply r127953 with fixes: eliminate empty return block if it has no ↵Evan Cheng2011-03-211-10/+122
| | | | | | predecessors; update dominator tree if cfg is modified. llvm-svn: 127981
* Don't try to eliminate invokes to __cxa_atexit.Anders Carlsson2011-03-201-0/+6
| | | | llvm-svn: 127976
* Don't segfault on mutual recursion, as pointed out by Frits.Anders Carlsson2011-03-201-4/+6
| | | | llvm-svn: 127975
* Address comments from Frits van Bommel.Anders Carlsson2011-03-201-7/+16
| | | | llvm-svn: 127974
* Add an optimization to GlobalOpt that eliminates calls to __cxa_atexit, if ↵Anders Carlsson2011-03-201-0/+101
| | | | | | the function passed is empty. llvm-svn: 127970
* Revert r127953, "SimplifyCFG has stopped duplicating returns into predecessorsDaniel Dunbar2011-03-191-99/+4
| | | | | | to canonicalize IR", it broke a lot of things. llvm-svn: 127954
OpenPOWER on IntegriCloud