summaryrefslogtreecommitdiff
path: root/lib/Transforms/IPO/DeadArgumentElimination.cpp
Commit message (Collapse)AuthorAge
* Tidy up several unbeseeming casts from pointer to intptr_t.Dan Gohman2008-09-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55779 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow deadargelim to change return types even though now values were dead. ThisMatthijs Kooijman2008-07-15
| | | | | | | 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-15
| | | | | | | | | | | | 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-15
| | | | | | | | | | | | | 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-15
| | | | 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-15
| | | | | | | | | | | | 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-15
| | | | | | | | 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-15
| | | | 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-15
| | | | | | | 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-15
| | | | 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-15
| | | | 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-15
| | | | | | | method, to slightly simplify control flow. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53591 91177308-0d34-0410-b5e6-96231b3b80d8
* 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
* 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
* 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
* 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
* 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
* 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
* API changes for class Use size reduction, wave 1.Gabor Greif2008-04-06
| | | | | | | | | Specifically, introduction of XXX::Create methods for Users that have a potentially variable number of Uses. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49277 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't include <map> in Pass.h, which doesn't need it. This requiresDan Gohman2008-03-21
| | | | | | | adding <map> to many files that actually do need it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48667 91177308-0d34-0410-b5e6-96231b3b80d8
* Reimplement the parameter attributes support, phase #1. hilights:Chris Lattner2008-03-12
| | | | | | | | | | | | | | | | | | | | | | | | | 1. There is now a "PAListPtr" class, which is a smart pointer around the underlying uniqued parameter attribute list object, and manages its refcount. It is now impossible to mess up the refcount. 2. PAListPtr is now the main interface to the underlying object, and the underlying object is now completely opaque. 3. Implementation details like SmallVector and FoldingSet are now no longer part of the interface. 4. You can create a PAListPtr with an arbitrary sequence of ParamAttrsWithIndex's, no need to make a SmallVector of a specific size (you can just use an array or scalar or vector if you wish). 5. All the client code that had to check for a null pointer before dereferencing the pointer is simplified to just access the PAListPtr directly. 6. The interfaces for adding attrs to a list and removing them is a bit simpler. Phase #2 will rename some stuff (e.g. PAListPtr) and do other less invasive changes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48289 91177308-0d34-0410-b5e6-96231b3b80d8
* s/isReturnStruct()/hasStructRetAttr()/gDevang Patel2008-03-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47857 91177308-0d34-0410-b5e6-96231b3b80d8
* Split ParameterAttributes.h, putting the complicatedDale Johannesen2008-02-22
| | | | | | | | | stuff into ParamAttrsList.h. Per feedback from ParamAttrs changes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47504 91177308-0d34-0410-b5e6-96231b3b80d8
* Expand ParameterAttributes to 32 bits (in preparationDale Johannesen2008-02-19
| | | | | | | | | for adding alignment info, not there yet). Clean up interfaces to reference ParameterAttributes consistently. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47342 91177308-0d34-0410-b5e6-96231b3b80d8
* DAE bug fix. Don't lose parameter attributes on vararg arguments.Evan Cheng2008-01-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46113 91177308-0d34-0410-b5e6-96231b3b80d8
* When DAE drops the varargs part of a function, ensure anyDuncan Sands2008-01-11
| | | | | | | attributes on the vararg call arguments are also dropped. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45892 91177308-0d34-0410-b5e6-96231b3b80d8
* Small cleanup for handling of type/parameter attributeDuncan Sands2008-01-07
| | | | | | | incompatibility. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45704 91177308-0d34-0410-b5e6-96231b3b80d8
* The transform that tries to turn calls to bitcast functions intoDuncan Sands2008-01-06
| | | | | | | | | | direct calls bails out unless caller and callee have essentially equivalent parameter attributes. This is illogical - the callee's attributes should be of no relevance here. Rework the logic, which incidentally fixes a crash when removed arguments have attributes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45658 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove attribution from file headers, per discussion on llvmdev.Chris Lattner2007-12-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45418 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixing several transforms which would drop the collector attributeGordon Henriksen2007-12-25
| | | | | | when copying functions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45356 91177308-0d34-0410-b5e6-96231b3b80d8
* Make DAE not wipe out attributes on calls, and not dropDuncan Sands2007-12-21
| | | | | | | | | | | | | | | | return attributes on the floor. In the case of a call to a varargs function where the varargs arguments are being removed, any call attributes on those arguments need to be dropped. I didn't do this because I plan to make it illegal to have such attributes (see next patch). With this change, compiling the gcc filter2 eh test at -O0 and then running opt -std-compile-opts on it results in a correctly working program (compiling at -O1 or higher results in the test failing due to a problem with how we output eh info into the IR). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45285 91177308-0d34-0410-b5e6-96231b3b80d8
* Rather than having special rules like "intrinsics cannotDuncan Sands2007-12-03
| | | | | | | | | | throw exceptions", just mark intrinsics with the nounwind attribute. Likewise, mark intrinsics as readnone/readonly and get rid of special aliasing logic (which didn't use anything more than this anyway). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44544 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR1146: parameter attributes are longer part ofDuncan Sands2007-11-27
| | | | | | | | | | | | | the function type, instead they belong to functions and function calls. This is an updated and slightly corrected version of Reid Spencer's original patch. The only known problem is that auto-upgrading of bitcode files doesn't seem to work properly (see test/Bitcode/AutoUpgradeIntrinsics.ll). Hopefully a bitcode guru (who might that be? :) ) will fix it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44359 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR1788 by taking the approach suggested by Richard Smith.Chris Lattner2007-11-15
| | | | | | | Thanks to him for his detailed analysis of the problem. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44162 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR1735 and Transforms/DeadArgElim/2007-10-18-VarargsReturn.ll byChris Lattner2007-10-18
| | | | | | | fixing some obviously broken code :( git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43141 91177308-0d34-0410-b5e6-96231b3b80d8
* Update InvokeInst to work like CallInstDavid Greene2007-08-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41506 91177308-0d34-0410-b5e6-96231b3b80d8