summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/IPConstantPropagation.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Modules] Fix potential ODR violations by sinking the DEBUG_TYPEChandler Carruth2014-04-221-1/+2
| | | | | | | | | | | | | | | | | definition below all of the header #include lines, lib/Transforms/... edition. This one is tricky for two reasons. We again have a couple of passes that define something else before the includes as well. I've sunk their name macros with the DEBUG_TYPE. Also, InstCombine contains headers that need DEBUG_TYPE, so now those headers #define and #undef DEBUG_TYPE around their code, leaving them well formed modular headers. Fixing these headers was a large motivation for all of these changes, as "leaky" macros of this form are hard on the modules implementation. llvm-svn: 206844
* [C++11] Add range based accessors for the Use-Def chain of a Value.Chandler Carruth2014-03-091-12/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This requires a number of steps. 1) Move value_use_iterator into the Value class as an implementation detail 2) Change it to actually be a *Use* iterator rather than a *User* iterator. 3) Add an adaptor which is a User iterator that always looks through the Use to the User. 4) Wrap these in Value::use_iterator and Value::user_iterator typedefs. 5) Add the range adaptors as Value::uses() and Value::users(). 6) Update *all* of the callers to correctly distinguish between whether they wanted a use_iterator (and to explicitly dig out the User when needed), or a user_iterator which makes the Use itself totally opaque. Because #6 requires churning essentially everything that walked the Use-Def chains, I went ahead and added all of the range adaptors and switched them to range-based loops where appropriate. Also because the renaming requires at least churning every line of code, it didn't make any sense to split these up into multiple commits -- all of which would touch all of the same lies of code. The result is still not quite optimal. The Value::use_iterator is a nice regular iterator, but Value::user_iterator is an iterator over User*s rather than over the User objects themselves. As a consequence, it fits a bit awkwardly into the range-based world and it has the weird extra-dereferencing 'operator->' that so many of our iterators have. I think this could be fixed by providing something which transforms a range of T&s into a range of T*s, but that *can* be separated into another patch, and it isn't yet 100% clear whether this is the right move. However, this change gets us most of the benefit and cleans up a substantial amount of code around Use and User. =] llvm-svn: 203364
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-051-1/+1
| | | | | | class. llvm-svn: 202953
* [Modules] Move CallSite into the IR library where it belogs. It isChandler Carruth2014-03-041-1/+1
| | | | | | | abstracting between a CallInst and an InvokeInst, both of which are IR concepts. llvm-svn: 202816
* Update optimization passes to handle inalloca argumentsReid Kleckner2014-01-281-1/+1
| | | | | | | | | | | | | | | Summary: I searched Transforms/ and Analysis/ for 'ByVal' and updated those call sites to check for inalloca if appropriate. I added tests for any change that would allow an optimization to fire on inalloca. Reviewers: nlewycky Differential Revision: http://llvm-reviews.chandlerc.com/D2449 llvm-svn: 200281
* Correct word hyphenationsAlp Toker2013-12-051-1/+1
| | | | | | | This patch tries to avoid unrelated changes other than fixing a few hyphen-related ambiguities and contractions in nearby lines. llvm-svn: 196471
* Move all of the header files which are involved in modelling the LLVM IRChandler Carruth2013-01-021-3/+3
| | | | | | | | | | | | | | | | | | | | | into their new header subdirectory: include/llvm/IR. This matches the directory structure of lib, and begins to correct a long standing point of file layout clutter in LLVM. There are still more header files to move here, but I wanted to handle them in separate commits to make tracking what files make sense at each layer easier. The only really questionable files here are the target intrinsic tablegen files. But that's a battle I'd rather not fight today. I've updated both CMake and Makefile build systems (I think, and my tests think, but I may have missed something). I've also re-sorted the includes throughout the project. I'll be committing updates to Clang, DragonEgg, and Polly momentarily. llvm-svn: 171366
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-031-3/+3
| | | | | | | | | | | | | | | | | Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] llvm-svn: 169131
* land David Blaikie's patch to de-constify Type, with a few tweaks.Chris Lattner2011-07-181-1/+1
| | | | llvm-svn: 135375
* Remove some support for ReturnInsts with multiple operands, and forJay Foad2011-04-041-1/+1
| | | | | | | returning a scalar value in a function whose return type is a single- element structure or array. llvm-svn: 128810
* Get rid of static constructors for pass registration. Instead, every pass ↵Owen Anderson2010-10-191-1/+3
| | | | | | | | | | | | | | | | | exposes an initializeMyPassFunction(), which must be called in the pass's constructor. This function uses static dependency declarations to recursively initialize the pass's dependencies. Clients that only create passes through the createFooPass() APIs will require no changes. Clients that want to use the CommandLine options for passes will need to manually call the appropriate initialization functions in PassInitialization.h before parsing commandline arguments. I have tested this with all standard configurations of clang and llvm-gcc on Darwin. It is possible that there are problems with the static dependencies that will only be visible with non-standard options. If you encounter any crash in pass registration/creation, please send the testcase to me directly. llvm-svn: 116820
* Now with fewer extraneous semicolons!Owen Anderson2010-10-071-1/+1
| | | | llvm-svn: 115996
* Reapply r110396, with fixes to appease the Linux buildbot gods.Owen Anderson2010-08-061-1/+1
| | | | llvm-svn: 110460
* Revert r110396 to fix buildbots.Owen Anderson2010-08-061-1/+1
| | | | llvm-svn: 110410
* Don't use PassInfo* as a type identifier for passes. Instead, use the ↵Owen Anderson2010-08-051-1/+1
| | | | | | | | address of the static ID member as the sole unique type identifier. Clean up APIs related to this change. llvm-svn: 110396
* simplify by using CallSite constructors; virtually eliminates CallSite::get ↵Gabor Greif2010-07-281-2/+2
| | | | | | from the tree llvm-svn: 109687
* Fix batch of converting RegisterPass<> to INTIALIZE_PASS().Owen Anderson2010-07-211-2/+2
| | | | llvm-svn: 109045
* cache result of operator*Gabor Greif2010-07-121-3/+4
| | | | llvm-svn: 108145
* Remove unused LLVMContext.Nick Lewycky2009-11-231-5/+2
| | | | llvm-svn: 89642
* teach ipsccp and ipconstprop that a blockaddress doesn't 'take the address' ↵Chris Lattner2009-11-011-0/+3
| | | | | | | | | of a function in a way that should prevent ip constprop. This allows clang/test/CodeGen/indirect-goto.c to pass with the new indirect goto lowering. llvm-svn: 85709
* Remove includes of Support/Compiler.h that are no longer needed after theNick Lewycky2009-10-251-1/+0
| | | | | | VISIBILITY_HIDDEN removal. llvm-svn: 85043
* Remove VISIBILITY_HIDDEN from class/struct found inside anonymous namespaces.Nick Lewycky2009-10-251-1/+1
| | | | | | | Chris claims we should never have visibility_hidden inside any .cpp file but that's still not true even after this commit. llvm-svn: 85042
* Constant propagating byval pointer is safe if function is readonly.Torok Edwin2009-09-241-2/+2
| | | | llvm-svn: 82700
* Don't constant propagate byval pointers, since they are not really pointers, butTorok Edwin2009-09-241-1/+2
| | | | | | | rather structs passed by value. This fixes PR5038. llvm-svn: 82689
* Push LLVMContexts through the IntegerType APIs.Owen Anderson2009-08-131-1/+1
| | | | llvm-svn: 78948
* Move more code back to 2.5 APIs.Owen Anderson2009-07-301-3/+3
| | | | llvm-svn: 77635
* Get rid of the Pass+Context magic.Owen Anderson2009-07-221-5/+5
| | | | llvm-svn: 76702
* Move the ConstantInt uniquing table into LLVMContextImpl. This exposed a ↵Owen Anderson2009-07-161-0/+2
| | | | | | | | number of issues in our current context-passing stuff, which is also fixed here llvm-svn: 76089
* Finish LLVMContext-ing lib/Analysis. This required pushing LLVMContext's ↵Owen Anderson2009-07-061-1/+1
| | | | | | through the ValueTracking API. llvm-svn: 74873
* More LLVMContext-ification.Owen Anderson2009-07-061-3/+4
| | | | llvm-svn: 74811
* Use cast<> instead of dyn_cast<> for things that are known to beJay Foad2009-06-061-5/+1
| | | | | | Instructions. llvm-svn: 73002
* introduce a useful abstraction to find out if a Use is in the call position ↵Gabor Greif2009-01-221-3/+4
| | | | | | of an instruction llvm-svn: 62788
* Add the private linkage.Rafael Espindola2009-01-151-1/+1
| | | | llvm-svn: 62279
* Clean up some multiple-return-value code that is no longerDan Gohman2008-10-031-5/+1
| | | | | | applicable. llvm-svn: 57033
* remove redundant test (mayBeOverriden() includes hasLinkOnceLinkage)Nuno Lopes2008-09-291-1/+1
| | | | llvm-svn: 56786
* Rename isWeakForLinker to mayBeOverridden. Use itDuncan Sands2008-09-291-1/+1
| | | | | | | instead of hasWeakLinkage in a bunch of optimization passes. llvm-svn: 56782
* Tidy up several unbeseeming casts from pointer to intptr_t.Dan Gohman2008-09-041-1/+1
| | | | llvm-svn: 55779
* Enable first-class aggregates support.Dan Gohman2008-07-231-3/+1
| | | | | | | | | | | | 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. llvm-svn: 53941
* 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. llvm-svn: 52489
* 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... llvm-svn: 52455
* Reapply r52396, it was unrelated to the breakage (that was caused by r52397, myMatthijs Kooijman2008-06-181-53/+76
| | | | | | commit after this). llvm-svn: 52453
* revert recent patch which is causing widespread breakage.Chris Lattner2008-06-171-85/+53
| | | | llvm-svn: 52415
* 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. llvm-svn: 52397
* 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. llvm-svn: 52396
* Fix PR2411, where ip constant prop would propagate theChris Lattner2008-06-091-0/+5
| | | | | | result of a weak function. llvm-svn: 52137
* Clean up the use of static and anonymous namespaces. This turned upDan Gohman2008-05-131-2/+4
| | | | | | | several things that were neither in an anonymous namespace nor static but not intended to be global. llvm-svn: 51017
* simplify code for propagation of constant arguments into Chris Lattner2008-04-231-46/+49
| | | | | | callees. llvm-svn: 50142
* Fix a number of bugs in ipconstantprop, simplify the code, fit in 80 cols,Chris Lattner2008-04-231-41/+39
| | | | | | fix read after free bug (PR2238). llvm-svn: 50141
* Incorporate feedback.Devang Patel2008-03-201-24/+24
| | | | | | | | - Fix loop nest. - Use RetVals.size() - Check for null return value. llvm-svn: 48605
* Handle multiple ret values.Devang Patel2008-03-111-21/+59
| | | | llvm-svn: 48254
OpenPOWER on IntegriCloud