summaryrefslogtreecommitdiff
path: root/lib/Transforms/IPO
Commit message (Collapse)AuthorAge
...
* Restructure dead argument elimination, try #3 :-)Matthijs Kooijman2008-07-10
| | | | | | | | | | | | | | | | | | 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-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52736 91177308-0d34-0410-b5e6-96231b3b80d8
* Pacify gcc-4.3.Duncan Sands2008-06-25
| | | | 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-25
| | | | 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-25
| | | | 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-24
| | | | | | | | | 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-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52672 91177308-0d34-0410-b5e6-96231b3b80d8
* Use Instruction::eraseFromParent().Dan Gohman2008-06-21
| | | | 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-21
| | | | 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-20
| | | | 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-20
| | | | | | | 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-20
| | | | | | | 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-20
| | | | | | | | | | 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-20
| | | | 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-20
| | | | | | | | | | | | | 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-19
| | | | | | | 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-19
| | | | | | | | 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-18
| | | | | | | | | 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-18
| | | | | | | | | | | | | | 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-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-18
| | | | | | | 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-17
| | | | 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-17
| | | | | | | | | | 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-17
| | | | | | | | | | | | 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-09
| | | | | | | result of a weak function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52137 91177308-0d34-0410-b5e6-96231b3b80d8
* Let StructRetPromotion check if all if its users are really calls or invokesn,Matthijs Kooijman2008-06-05
| | | | | | | not other instructions. This fixes a crash with the added testcase. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51992 91177308-0d34-0410-b5e6-96231b3b80d8
* Let StructRetPromotion check if it's users are really calling it and notMatthijs Kooijman2008-06-05
| | | | | | | passing its pointer. Fixes test with added testcase. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51991 91177308-0d34-0410-b5e6-96231b3b80d8
* Use use_iterator::getOperandNo instead of CallSite::hasArgument to check if aMatthijs Kooijman2008-06-05
| | | | | | | | function is passed as an argument instead of called. Also do this check a bit earlier. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51990 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace two manual loops with calls to CallSite::hasArguments (no functional ↵Matthijs Kooijman2008-06-04
| | | | | | changes). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51947 91177308-0d34-0410-b5e6-96231b3b80d8
* Use eraseFromParent() instead of doing that manually in two places.Matthijs Kooijman2008-05-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51770 91177308-0d34-0410-b5e6-96231b3b80d8
* convert more operand loops to iterator formulationGabor Greif2008-05-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51663 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix some constructs that gcc-4.4 warns about.Duncan Sands2008-05-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51591 91177308-0d34-0410-b5e6-96231b3b80d8
* Factor code to copy global value attributes likeDuncan Sands2008-05-26
| | | | | | | | | | | | | | | | the section or the visibility from one global value to another: copyAttributesFrom. This is particularly useful for duplicating functions: previously this was done by explicitly copying each attribute in turn at each place where a new function was created out of an old one, with the result that obscure attributes were regularly forgotten (like the collector or the section). Hopefully now everything is uniform and nothing is forgotten. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51567 91177308-0d34-0410-b5e6-96231b3b80d8
* Indent fix.Matthijs Kooijman2008-05-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51477 91177308-0d34-0410-b5e6-96231b3b80d8
* Use isSingleValueType instead of isFirstClassType toDan Gohman2008-05-23
| | | | | | | exclude struct and array types. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51459 91177308-0d34-0410-b5e6-96231b3b80d8
* Use isSingleValueType instead of isFirstClassType toDan Gohman2008-05-23
| | | | | | | exclude struct and array types. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51456 91177308-0d34-0410-b5e6-96231b3b80d8
* Less conservative verison of previous patch,Dale Johannesen2008-05-16
| | | | | | | | suggested by Duncan. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51211 91177308-0d34-0410-b5e6-96231b3b80d8
* Weak functions not declared non-throwing might beDale Johannesen2008-05-16
| | | | | | | | | | | replaced at linktime with a body that throws, even if the body in this file does not. Make PruneEH be more conservative in this case. g++.dg/eh/weak1.C git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51207 91177308-0d34-0410-b5e6-96231b3b80d8
* API change for {BinaryOperator|CmpInst|CastInst}::create*() --> Create. ↵Gabor Greif2008-05-16
| | | | | | Legacy interfaces will be in place for some time. (Merge from use-diet branch.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51200 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a bunch of 80col violations that arose from the Create API change. Tweak ↵Gabor Greif2008-05-15
| | | | | | makefile targets to find these better. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51143 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify internalize pass. Add test case.Devang Patel2008-05-14
| | | | | | | Patch by Matthijs Kooijman! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51114 91177308-0d34-0410-b5e6-96231b3b80d8
* 80 col / tabs fixesNate Begeman2008-05-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51021 91177308-0d34-0410-b5e6-96231b3b80d8
* Clean up the use of static and anonymous namespaces. This turned upDan Gohman2008-05-13
| | | | | | | | several things that were neither in an anonymous namespace nor static but not intended to be global. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51017 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a type and formatting.Duncan Sands2008-05-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50900 91177308-0d34-0410-b5e6-96231b3b80d8
* Improve pass documentation and comments.Gordon Henriksen2008-05-08
| | | | | | Patch by Matthijs Kooijman! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50861 91177308-0d34-0410-b5e6-96231b3b80d8
* Check linkage.Devang Patel2008-05-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50851 91177308-0d34-0410-b5e6-96231b3b80d8
* Make several variable declarations static.Dan Gohman2008-05-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50696 91177308-0d34-0410-b5e6-96231b3b80d8
* Delete the IPO simplify-libcalls and completely reimplement it asChris Lattner2008-05-01
| | | | | | | | | a FunctionPass. This makes it simpler, fixes dozens of bugs, adds a couple of minor features, and shrinks is considerably: from 2214 to 1437 lines. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50520 91177308-0d34-0410-b5e6-96231b3b80d8
* use string length computation to generalize several xforms.Chris Lattner2008-04-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50464 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement more aggressive support for analyzing string length. ThisChris Lattner2008-04-29
| | | | | | | | | | | | generalizes the previous code to handle the case when the string is not an immediate to the strlen call (for example, crazy stuff like strlen(c ? "foo" : "bart"+1) -> 3). This implements gcc.c-torture/execute/builtins/strlen-2.c. I will generalize other cases in simplifylibcalls to use the same routine later. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50408 91177308-0d34-0410-b5e6-96231b3b80d8