aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/IPO
Commit message (Collapse)AuthorAgeFilesLines
* Check noinline note and ignore other notes.Devang Patel2008-09-031-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55711 91177308-0d34-0410-b5e6-96231b3b80d8
* Handle "noinline" note inside the simple inliner.Devang Patel2008-09-032-4/+7
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55708 91177308-0d34-0410-b5e6-96231b3b80d8
* s/FP_AlwaysInline/FN_NOTE_AlwaysInline/gDevang Patel2008-09-021-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55676 91177308-0d34-0410-b5e6-96231b3b80d8
* respect inline=never and inline=always notes.Devang Patel2008-09-021-1/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55673 91177308-0d34-0410-b5e6-96231b3b80d8
* Use empty() instead of begin() == end().Dan Gohman2008-08-141-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54780 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace two for loops with while(!X->use_empty()) loops. This preventsMatthijs Kooijman2008-08-141-10/+8
| | | | | | | | | | invalidating the iterator by deleting the current use. This fixes a segfault on 64 bit linux reported in PR2675. Also remove an unneeded if. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54778 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove tabs.Bill Wendling2008-08-121-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54707 91177308-0d34-0410-b5e6-96231b3b80d8
* Let SRETPromotion properly preserve the function name instead of (implicitly)Matthijs Kooijman2008-08-071-1/+2
| | | | | | | postfixing it with a number. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54468 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix SRETPromotion, it was generating functions without returns statements sinceMatthijs Kooijman2008-08-071-1/+1
| | | | | | | | r53941 (but this was not noticed due to the lack of a basic test for SRETPromotion). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54467 91177308-0d34-0410-b5e6-96231b3b80d8
* Add some debug output to SRETPromotion.Matthijs Kooijman2008-08-071-0/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54464 91177308-0d34-0410-b5e6-96231b3b80d8
* Restructure ArgumentPromotion a bit. Instead of just having a single booleanMatthijs Kooijman2008-07-291-99/+235
| | | | | | | | | | | | | | | that says "unconditional loads from this argument are safe", we now keep track of the safety per set of indices from which loads happen. This prevents ArgPromotion from promoting loads that aren't really valid. As an added effect, this will now disregard the the type of the indices passed to a GEP, so "load GEP %A, i32 1" and "load GEP %A, i64 1" will result in a single argument, not two. This fixes PR2598, for which a testcase has been added as well. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54159 91177308-0d34-0410-b5e6-96231b3b80d8
* Enable first-class aggregates support.Dan Gohman2008-07-232-22/+6
| | | | | | | | | | | | | Remove the GetResultInst instruction. It is still accepted in LLVM assembly and bitcode, where it is now auto-upgraded to ExtractValueInst. Also, remove support for return instructions with multiple values. These are auto-upgraded to use InsertValueInst instructions. The IRBuilder still accepts multiple-value returns, and auto-upgrades them to InsertValueInst instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53941 91177308-0d34-0410-b5e6-96231b3b80d8
* Make GlobalOpt preserve address spaces when scalar replacing aggregate globals.Matthijs Kooijman2008-07-171-2/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53716 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow deadargelim to change return types even though now values were dead. ThisMatthijs Kooijman2008-07-151-11/+1
| | | | | | | again canonicalizes {i32} into i32 and {} into void. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53610 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r53606. It turns out that explicitely tracking the liveness of theMatthijs Kooijman2008-07-151-97/+103
| | | | | | | | | | | | return value as a whole in deadargelim is really not needed now that we simply rebuild the old return value and actually prevents some canonicalization from taking place. This revert stops deadargelim from changing {i32} into i32 for now, but I'll fix that next. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53609 91177308-0d34-0410-b5e6-96231b3b80d8
* Make deadargelim a bit less smart, so it doesn't choke on nested structs asMatthijs Kooijman2008-07-151-38/+21
| | | | | | | | | | | | | return values that are still (partially) live. Instead of updating all uses of a call instruction after removing some elements, it now just rebuilds the original struct (With undef gaps where the unused values were) and leaves it to instcombine to clean this up. The added testcase still fails currently, but this is due to instcombine which isn't good enough yet. I will fix that part next. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53608 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't use isa when we can reuse a previous dyn_cast.Matthijs Kooijman2008-07-151-3/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53607 91177308-0d34-0410-b5e6-96231b3b80d8
* Make DeadArgElim keep liveness of the return value as a whole in addition toMatthijs Kooijman2008-07-151-126/+124
| | | | | | | | | | | | only the liveness of partial return values (for functions returning a struct). This is more explicit to prevent unwanted changes in the return value. In particular, deadargelim now canonicalizes a function returning {i32} to returning i32 and {} to void, if the struct returned is not used in its entirety, but only the single element is used. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53606 91177308-0d34-0410-b5e6-96231b3b80d8
* Let DAE keep a list of live functions, instead of simply marking all argumentsMatthijs Kooijman2008-07-151-6/+14
| | | | | | | | and return values live for those functions. This doesn't change anything yet, but prepares for the coming commits. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53601 91177308-0d34-0410-b5e6-96231b3b80d8
* Split DAE::MarkLive into MarkLive and PropagateLiveness.Matthijs Kooijman2008-07-151-0/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53600 91177308-0d34-0410-b5e6-96231b3b80d8
* Pass around const RetOrArg references instead of copying values. Also, markMatthijs Kooijman2008-07-151-3/+3
| | | | | | | RetOrArg::getDescription() as const. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53599 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify debug code by using RetOrArg::getDescription().Matthijs Kooijman2008-07-151-6/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53598 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix indentation (intentionally left out of the previous commit).Matthijs Kooijman2008-07-151-51/+51
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53592 91177308-0d34-0410-b5e6-96231b3b80d8
* Move the deadargelim code for intrinsically alive functions into its ownMatthijs Kooijman2008-07-151-23/+25
| | | | | | | method, to slightly simplify control flow. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53591 91177308-0d34-0410-b5e6-96231b3b80d8
* Use find instead of lower_bound.Dan Gohman2008-07-111-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53474 91177308-0d34-0410-b5e6-96231b3b80d8
* Restructure dead argument elimination, try #3 :-)Matthijs Kooijman2008-07-101-381/+551
| | | | | | | | | | | | | | | | | | Rewrite the DeadArgumentElimination pass, to use a more explicit tracking of dependencies between return values and/or arguments. Also make the handling of arguments and return values the same. The pass now looks properly inside returned structs, but only at the first level (ie, not inside nested structs). This version fixed a few more bugs and was cleaned up a bit. It now passes all of LLVM's testing, and should still pass SPEC2006. There is still a minor bug with regard to returning nested structs. Since there is currently nothing that emits such IR, I will fix that in a seperate commit (partly because it requires a non-trivial fix). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53400 91177308-0d34-0410-b5e6-96231b3b80d8
* Restore DeadArgElim back to 52570. It's breaking 447.dealII.Evan Cheng2008-06-251-527/+374
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52736 91177308-0d34-0410-b5e6-96231b3b80d8
* Pacify gcc-4.3.Duncan Sands2008-06-251-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52723 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a (false) warning on darwin.Matthijs Kooijman2008-06-251-1/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52705 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix some cosmetics in comments.Matthijs Kooijman2008-06-251-6/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52704 91177308-0d34-0410-b5e6-96231b3b80d8
* Commit the new DeadArgElim pass again, this time with the gcc bootstrap ↵Matthijs Kooijman2008-06-241-374/+525
| | | | | | | | | failures fixed. Also add a testcase to reproduce the gcc bootstrap failure in very much reduced form. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52677 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename a few variables to be more consistent.Matthijs Kooijman2008-06-241-3/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52672 91177308-0d34-0410-b5e6-96231b3b80d8
* Use Instruction::eraseFromParent().Dan Gohman2008-06-212-4/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52606 91177308-0d34-0410-b5e6-96231b3b80d8
* Back out Matthijs' DAE patches. It's miscompiling gcc driver.Evan Cheng2008-06-211-518/+367
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52570 91177308-0d34-0410-b5e6-96231b3b80d8
* 80 column and trailing whitespace fixes.Matthijs Kooijman2008-06-201-49/+72
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52539 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't let DeadArgumentElimination attempt to update callers when the returnMatthijs Kooijman2008-06-201-9/+12
| | | | | | | type wasn't changed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52538 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't let DeadArgElimination change the return type ({} into void and {T}Matthijs Kooijman2008-06-201-7/+13
| | | | | | | into T) when no return values are actually dead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52537 91177308-0d34-0410-b5e6-96231b3b80d8
* Explicitely track if any arguments or return values were removed inMatthijs Kooijman2008-06-201-1/+10
| | | | | | | | | | DeadArgumentElimination and assert that the function type does not change if nothing was changed. This should catch subtle changes in function type that are not intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52536 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove debug output.Matthijs Kooijman2008-06-201-4/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52535 91177308-0d34-0410-b5e6-96231b3b80d8
* Recommit r52459, rewriting of the dead argument elimination pass.Matthijs Kooijman2008-06-201-369/+483
| | | | | | | | | | | | | This is a fixed version that no longer uses multimap::equal_range, which resulted in a pointer invalidation problem. Also, DAE::InspectedFunctions was not really necessary, so it got removed. Lastly, this version no longer applies the extra arg hack on functions who did not have any arguments to start with. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52532 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the common API for adding instructions to basic blocks instead ofDan Gohman2008-06-191-11/+6
| | | | | | | using BasicBlock::getInstList. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52500 91177308-0d34-0410-b5e6-96231b3b80d8
* Use a CallSite to find the nth argument of a call/invoke instruction instead ofMatthijs Kooijman2008-06-191-11/+11
| | | | | | | | using getOperand() directly. This makes things work with invoke instructions as well. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52489 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r52459, which was causing an infinite loop or massive slowdown on ↵Owen Anderson2008-06-181-469/+369
| | | | | | | | | MultiSource/Applications/SPASS, and possibly others as well. Please reapply once this is fixed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52465 91177308-0d34-0410-b5e6-96231b3b80d8
* Rewrite the DeadArgumentElimination pass, to use a more explicit tracking ofMatthijs Kooijman2008-06-181-369/+469
| | | | | | | | | | | | | | dependencies between return values and/or arguments. Also make the handling of arguments and return values the same. The pass now looks properly inside returned structs, but only at the first level (ie, not inside nested structs). Also add a testcase for testing various variations of (multiple) dead rerturn values. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52459 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply r52397 (make IPConstProp promote returned arguments), but fixed thisMatthijs Kooijman2008-06-181-3/+18
| | | | | | | | | time. Sorry for the trouble! This time, also add a testcase, which I should have done in the first place... git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52455 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply r52396, it was unrelated to the breakage (that was caused by r52397, myMatthijs Kooijman2008-06-181-53/+76
| | | | | | | commit after this). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52453 91177308-0d34-0410-b5e6-96231b3b80d8
* revert recent patch which is causing widespread breakage.Chris Lattner2008-06-171-85/+53
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52415 91177308-0d34-0410-b5e6-96231b3b80d8
* Learn IPConstProp to propagate arguments that are directly returned. StrictlyMatthijs Kooijman2008-06-171-2/+11
| | | | | | | | | | speaking these are not constant values. However, when a function always returns one of its arguments, then from the point of view of each caller the return value is constant (or at least a known value) and can be replaced. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52397 91177308-0d34-0410-b5e6-96231b3b80d8
* Learn IPConstProp to look at individual return values and propagate themMatthijs Kooijman2008-06-171-53/+76
| | | | | | | | | | | | individually. Also learn IPConstProp how returning first class aggregates work, in addition to old style multiple return instructions. Modify the return-constants testscase to confirm this behaviour. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52396 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR2411, where ip constant prop would propagate theChris Lattner2008-06-091-0/+5
| | | | | | | result of a weak function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52137 91177308-0d34-0410-b5e6-96231b3b80d8