summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Use Duncan's patch to delete the instructions in reverse order (minus the ↵Bill Wendling2011-09-041-6/+10
| | | | | | landingpad and terminator). llvm-svn: 139090
* Update comments to reflect reality.Bill Wendling2011-09-021-2/+1
| | | | llvm-svn: 139023
* Reduce indentation. No functionality change.Bill Wendling2011-09-011-17/+18
| | | | llvm-svn: 138968
* Change worklist driven deletion to be an iterative process.Bill Wendling2011-09-011-26/+5
| | | | | | Duncan noticed this! llvm-svn: 138967
* Resubmit with fix. Properly remove the instructions except for landingpad, ↵Bill Wendling2011-09-011-9/+28
| | | | | | which should be removed only when its invokes are. llvm-svn: 138932
* Submitted this too early.Bill Wendling2011-09-011-5/+0
| | | | llvm-svn: 138931
* Don't DCE the landingpad instruction.Bill Wendling2011-09-011-0/+5
| | | | | | The landingpad instruction can be removed only when its invokes are removed. llvm-svn: 138930
* Revert r137655. There is some question about whether the 'landingpad'Bill Wendling2011-08-171-1/+2
| | | | | | instruction should be marked as potentially reading and/or writing memory. llvm-svn: 137863
* Use the getFirstInsertionPt() method instead of getFirstNonPHI + an 'isa<>'Bill Wendling2011-08-161-2/+1
| | | | | | check for a LandingPadInst. llvm-svn: 137745
* Don't sink the instruction to before a landingpad instruction.Bill Wendling2011-08-151-1/+1
| | | | llvm-svn: 137672
* Update instcombine for atomic load/store.Eli Friedman2011-08-151-1/+1
| | | | llvm-svn: 137664
* Duncan pointed out that the LandingPadInst might read memory. (It might alsoBill Wendling2011-08-151-3/+2
| | | | | | write to memory.) Marking it as such makes some checks for immobility go away. llvm-svn: 137655
* Don't try to sink the landingpad instruction. It's immobile.Bill Wendling2011-08-151-2/+3
| | | | llvm-svn: 137629
* This transform is not safe. Thanks to Eli for pointing that out!Nick Lewycky2011-08-141-8/+1
| | | | llvm-svn: 137575
* Don't attempt to add 'nsw' when intermediate instructions had no such guarantee.Nick Lewycky2011-08-141-4/+7
| | | | llvm-svn: 137572
* Teach instcombine to preserve the nsw bit by doing an after-the-fact analysisNick Lewycky2011-08-141-3/+54
| | | | | | when combining add and sub instructions. Patch by Pranav Bhandarkar! llvm-svn: 137570
* Small cleanups:Nick Lewycky2011-08-031-3/+2
| | | | | | | | | - use SmallVectorImpl& for the function argument. - ignore the operands on the GEP, even if they aren't constant! Much as we pretend the malloc succeeds, we pretend that malloc + whatever-you-GEP'd-by is not null. It's magic! llvm-svn: 136757
* Fix logical error when detecting lifetime intrinsics.Nick Lewycky2011-08-031-33/+34
| | | | | | | | | Don't replace a gep/bitcast with 'undef' because that will form a "free(undef)" which in turn means "unreachable". What we wanted was a no-op. Instead, analyze the whole tree and look for all the instructions we need to delete first, then delete them second, not relying on the use_list to stay consistent. llvm-svn: 136752
* Teach InstCombine that lifetime intrincs aren't a real user on the result of aNick Lewycky2011-08-021-11/+35
| | | | | | malloc call. llvm-svn: 136732
* Add a small gep optimization I noticed was missing while reading some IL.Rafael Espindola2011-07-311-11/+13
| | | | llvm-svn: 136585
* Convert GetElementPtrInst to use ArrayRef.Jay Foad2011-07-251-6/+4
| | | | llvm-svn: 135904
* Convert IRBuilder::CreateGEP and IRBuilder::CreateInBoundsGEP to useJay Foad2011-07-221-10/+7
| | | | | | ArrayRef. llvm-svn: 135761
* Convert SimplifyGEPInst to use ArrayRef.Jay Foad2011-07-191-1/+1
| | | | llvm-svn: 135482
* Migrate LLVM and Clang to use the new makeArrayRef(...) functions where ↵Frits van Bommel2011-07-181-2/+2
| | | | | | | | previously explicit non-default constructors were used. Mostly mechanical with some manual reformatting. llvm-svn: 135390
* land David Blaikie's patch to de-constify Type, with a few tweaks.Chris Lattner2011-07-181-17/+17
| | | | llvm-svn: 135375
* Convert InsertValueInst and ExtractValueInst APIs to use ArrayRef.Jay Foad2011-07-131-5/+5
| | | | llvm-svn: 135040
* Don't duplicate the work done by a gep into a "bitcast" if the gep hasRafael Espindola2011-07-111-0/+8
| | | | | | | | more than one use. Fixes PR10322. llvm-svn: 134883
* Final step of instcombine debuginfo; switch a couple more places over to ↵Eli Friedman2011-05-271-2/+3
| | | | | | InsertNewInstWith, and use setDebugLoc for the cases which can't be easily handled by the automated mechanisms. llvm-svn: 132167
* Make instcombine O(N) instead of O(N^2) in code where the same simplifiable ↵Eli Friedman2011-05-241-10/+11
| | | | | | | | constant is used many times. Part of rdar://9471075. llvm-svn: 131979
* More instcombine cleanup, towards improving debug line info.Eli Friedman2011-05-181-6/+6
| | | | llvm-svn: 131604
* Start trying to make InstCombine preserve more debug info. The idea here is ↵Eli Friedman2011-05-181-0/+1
| | | | | | | | | | to set the debug location on the IRBuilder, which will be then right location in most cases. This should magically give many transformations debug locations, and fixing places which are missing a debug location will usually just means changing the code creating it to use the IRBuilder. As an example, the change to InstCombineCalls catches a common case where a call to a bitcast of a function is rewritten. Chris, does this approach look reasonable? llvm-svn: 131516
* Use ReplaceInstUsesWith instead of replaceAllUsesWith where appropriate in ↵Eli Friedman2011-05-181-3/+3
| | | | | | instcombine. llvm-svn: 131512
* Stop trying to have instcombine preserve LCSSA form: this was notDuncan Sands2011-04-271-2/+0
| | | | | | | | | | effective in avoiding recomputation of LCSSA form; the widespread use of instsimplify (which looks through phi nodes) means it was not preserving LCSSA form anyway; and instcombine is no longer scheduled in the middle of the loop passes so this doesn't matter anymore. llvm-svn: 130301
* InstCombine optimizes gep(bitcast(x)) even when the bitcasts casts away addressNadav Rotem2011-04-051-8/+11
| | | | | | | space info. We crash with an assert in this case. This change checks that the address space of the bitcasted pointer is the same as the gep ptr. llvm-svn: 128884
* Remove PHINode::reserveOperandSpace(). Instead, add a parameter toJay Foad2011-03-301-2/+1
| | | | | | PHINode::Create() giving the (known or expected) number of operands. llvm-svn: 128537
* Make more use of PHINode::getNumIncomingValues().Jay Foad2011-03-281-1/+1
| | | | llvm-svn: 128406
* Try to not lose variable's debug info during instcombine.Devang Patel2011-03-171-0/+4
| | | | | | | This is done by lowering dbg.declare intrinsic into dbg.value intrinsic. Radar 9143931. llvm-svn: 127834
* Do not forget DebugLoc!Devang Patel2011-02-151-0/+1
| | | | llvm-svn: 125547
* Conservatively, clear optional flags, such as nsw, when performingDan Gohman2011-02-021-0/+15
| | | | | | | reassociation. No testcase, because I wasn't able to create a testcase which actually demonstrates a problem. llvm-svn: 124713
* fix PR9013, an infinite loop in instcombine.Chris Lattner2011-01-211-2/+10
| | | | llvm-svn: 123968
* update obsolete comment.Chris Lattner2011-01-211-4/+3
| | | | llvm-svn: 123965
* Don't try to pull vector bitcasts that change the number of elements throughNick Lewycky2011-01-211-3/+17
| | | | | | | a select. A vector select is pairwise on each element so we'd need a new condition with the right number of elements to select on. Fixes PR8994. llvm-svn: 123963
* remove a dead check, this was needed before we had an explicit veto on uses ↵Chris Lattner2011-01-161-5/+0
| | | | | | of phis. llvm-svn: 123569
* enhance FoldOpIntoPhi in instcombine to try harder when a phi hasChris Lattner2011-01-161-3/+19
| | | | | | | | multiple uses. In some cases, all the uses are the same operation, so instcombine can go ahead and promote the phi. In the testcase this pushes an add out of the loop. llvm-svn: 123568
* remove the AllowAggressive argument to FoldOpIntoPhi. It is forced to false ↵Chris Lattner2011-01-161-8/+3
| | | | | | | | in the first line of the function because it isn't a good idea, even for compares. llvm-svn: 123566
* more cleanups: use the IR builder.Chris Lattner2011-01-161-38/+39
| | | | llvm-svn: 123565
* tidy up code.Chris Lattner2011-01-161-16/+20
| | | | llvm-svn: 123564
* Add a generic expansion transform: A op (B op' C) -> (A op B) op' (A op C)Duncan Sands2010-12-221-54/+114
| | | | | | | | if both A op B and A op C simplify. This fires fairly often but doesn't make that much difference. On gcc-as-one-file it removes two "and"s and turns one branch into a select. llvm-svn: 122399
* Add some statistics, good for understanding how much more powerfulDuncan Sands2010-12-221-2/+12
| | | | | | instcombine is compared to instsimplify. llvm-svn: 122397
* fix an oversight caught by Frits!Chris Lattner2010-12-191-3/+4
| | | | llvm-svn: 122204
OpenPOWER on IntegriCloud