summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/FunctionAttrs.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
* Add a missing break.Rafael Espindola2014-03-301-0/+1
| | | | | | | | | | Patch by Tobias Güntner. I tried to write a test, but the only difference is the Changed value that gets returned. It can be tested with "opt -debug-pass=Executions -functionattrs, but that doesn't seem worth it. llvm-svn: 205121
* [C++11] Add range based accessors for the Use-Def chain of a Value.Chandler Carruth2014-03-091-11/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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] Make this interface accept const Use pointers and use overrideChandler Carruth2014-03-051-1/+1
| | | | | | | | to ensure we don't mess up any of the overrides. Necessary for cleaning up the Value use iterators and enabling range-based traversing of use lists. llvm-svn: 202958
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-051-4/+4
| | | | | | class. llvm-svn: 202953
* [Modules] Move InstIterator out of the Support library, where it had noChandler Carruth2014-03-041-1/+1
| | | | | | | | | | | | | business. This header includes Function and BasicBlock and directly uses the interfaces of both classes. It has to do with the IR, it even has that in the name. =] Put it in the library it belongs to. This is one step toward making LLVM's Support library survive a C++ modules bootstrap. llvm-svn: 202814
* cleanup: scc_iterator consumers should use isAtEndDuncan P. N. Exon Smith2014-02-041-2/+1
| | | | | | | | | | | | | | No functional change. Updated loops from: for (I = scc_begin(), E = scc_end(); I != E; ++I) to: for (I = scc_begin(); !I.isAtEnd(); ++I) for teh win. llvm-svn: 200789
* Update optimization passes to handle inalloca argumentsReid Kleckner2014-01-281-0/+4
| | | | | | | | | | | | | | | 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
* Make nocapture analysis work with addrspacecastMatt Arsenault2014-01-141-0/+2
| | | | llvm-svn: 199246
* [PM] Split the CallGraph out from the ModulePass which creates theChandler Carruth2013-11-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CallGraph. This makes the CallGraph a totally generic analysis object that is the container for the graph data structure and the primary interface for querying and manipulating it. The pass logic is separated into its own class. For compatibility reasons, the pass provides wrapper methods for most of the methods on CallGraph -- they all just forward. This will allow the new pass manager infrastructure to provide its own analysis pass that constructs the same CallGraph object and makes it available. The idea is that in the new pass manager, the analysis pass's 'run' method returns a concrete analysis 'result'. Here, that result is a 'CallGraph'. The 'run' method will typically do only minimal work, deferring much of the work into the implementation of the result object in order to be lazy about computing things, but when (like DomTree) there is *some* up-front computation, the analysis does it prior to handing the result back to the querying pass. I know some of this is fairly ugly. I'm happy to change it around if folks can suggest a cleaner interim state, but there is going to be some amount of unavoidable ugliness during the transition period. The good thing is that this is very limited and will naturally go away when the old pass infrastructure goes away. It won't hang around to bother us later. Next up is the initial new-PM-style call graph analysis. =] llvm-svn: 195722
* Merge CallGraph and BasicCallGraph.Rafael Espindola2013-10-311-1/+1
| | | | llvm-svn: 193734
* Avoid a compiler warning about Found not being used when assertions areDuncan Sands2013-09-131-0/+1
| | | | | | disabled. llvm-svn: 190668
* Declare missing dependency on AliasAnalysis. Patch by Liu Xin!Nick Lewycky2013-09-051-0/+1
| | | | llvm-svn: 190035
* Fix annotation of unlink. Should fix builder.Nick Lewycky2013-07-061-1/+1
| | | | llvm-svn: 185738
* Extend 'readonly' and 'readnone' to work on function arguments as well asNick Lewycky2013-07-061-37/+364
| | | | | | | functions. Make the function attributes pass add it to known library functions and when it can deduce it. llvm-svn: 185735
* Tabs to spaces. No functionality change.Nick Lewycky2013-07-041-10/+10
| | | | llvm-svn: 185612
* Added support in FunctionAttrs for adding relevant function/argument ↵Michael Gottesman2013-07-031-0/+10
| | | | | | | | | | attributes for the posix call gettimeofday. This implies annotating it as nounwind and its arguments as nocapture. To be conservative, we do not annotate the arguments with noalias since some platforms do not have restrict on the declaration for gettimeofday. llvm-svn: 185502
* Add missing break statements. Noticed by inspection.Nick Lewycky2013-07-021-0/+2
| | | | llvm-svn: 185414
* Revert "FunctionAttrs: Merge attributes once instead of doing it for every ↵Benjamin Kramer2013-06-221-46/+32
| | | | | | | | argument." It doesn't work as I intended it to. This reverts commit r184638. llvm-svn: 184641
* FunctionAttrs: Merge attributes once instead of doing it for every argument.Benjamin Kramer2013-06-221-32/+46
| | | | | | It has become an expensive operation. No functionality change. llvm-svn: 184638
* Move library call prototype attribute inference to functionattrsMeador Inge2013-03-211-2/+739
| | | | | | | | | | | | The simplify-libcalls pass implemented a doInitialization hook to infer function prototype attributes for well-known functions. Given that the simplify-libcalls pass is going away *and* that the functionattrs pass is already in place to deduce function attributes, I am moving this logic to the functionattrs pass. This approach was discussed during patch review: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20121126/157465.html. llvm-svn: 177619
* Remove the last of uses that use the Attribute object as a collection of ↵Bill Wendling2013-01-231-4/+6
| | | | | | | | | attributes. Collections of attributes are handled via the AttributeSet class now. This finally frees us up to make significant changes to how attributes are structured. llvm-svn: 173228
* Use the AttributeSet when removing multiple attributes. Use Attribute::AttrKindBill Wendling2013-01-231-2/+3
| | | | | | when removing one attribute. This further encapsulates the use of the attributes. llvm-svn: 173214
* Use the AttributeSet when adding multiple attributes and an Attribute::AttrKindBill Wendling2013-01-231-3/+1
| | | | | | when adding a single attribute to the function. llvm-svn: 173210
* Move CallGraphSCCPass.h into the Analysis tree; that's where theChandler Carruth2013-01-071-1/+1
| | | | | | implementation lives already. llvm-svn: 171746
* 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
* Rename the 'Attributes' class to 'Attribute'. It's going to represent a ↵Bill Wendling2012-12-191-11/+11
| | | | | | single attribute in the future. llvm-svn: 170502
* s/AttrListPtr/AttributeSet/g to better label what this class is going to be ↵Bill Wendling2012-12-071-2/+2
| | | | | | in the near future. llvm-svn: 169651
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-031-7/+7
| | | | | | | | | | | | | | | | | 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
* Replace some instances of UniqueVector with SetVector, which is slightly ↵Benjamin Kramer2012-10-311-3/+3
| | | | | | | | cheaper. No functionality change. llvm-svn: 167116
* Move the Attributes::Builder outside of the Attributes class and into its ↵Bill Wendling2012-10-151-2/+2
| | | | | | own class named AttrBuilder. No functionality change. llvm-svn: 165960
* Add an enum for the return and function indexes into the AttrListPtr object. ↵Bill Wendling2012-10-151-2/+4
| | | | | | This gets rid of some magic numbers. llvm-svn: 165924
* Attributes RewriteBill Wendling2012-10-151-6/+8
| | | | | | | | | | Convert the internal representation of the Attributes class into a pointer to an opaque object that's uniqued by and stored in the LLVMContext object. The Attributes class then becomes a thin wrapper around this opaque object. Eventually, the internal representation will be expanded to include attributes that represent code generation options, etc. llvm-svn: 165917
* Remove the final bits of Attributes being declared in the AttributeBill Wendling2012-10-101-6/+14
| | | | | | | namespace. Use the attribute's enum value instead. No functionality change intended. llvm-svn: 165610
* Use the attribute enums to query if a parameter has an attribute.Bill Wendling2012-10-091-1/+1
| | | | llvm-svn: 165550
* Give CaptureTracker::shouldExplore a base implementation. Most users want to doNick Lewycky2012-10-081-2/+0
| | | | | | the same thing. No functionality change. llvm-svn: 165435
* Add method to query for 'NoAlias' attribute on call/invoke instructions.Bill Wendling2012-10-041-1/+1
| | | | llvm-svn: 165208
* SCCCaptured is trivially false on entry to this loop and not modified inside it.Nick Lewycky2012-01-051-1/+1
| | | | | | Eliminate the dead test for it on each loop iteration. No functionality change. llvm-svn: 147616
* Change CaptureTracking to pass a Use* instead of a Value* when a value isNick Lewycky2011-12-281-5/+222
| | | | | | | | | | | | | | captured. This allows the tracker to look at the specific use, which may be especially interesting for function calls. Use this to fix 'nocapture' deduction in FunctionAttrs. The existing one does not iterate until a fixpoint and does not guarantee that it produces the same result regardless of iteration order. The new implementation builds up a graph of how arguments are passed from function to function, and uses a bottom-up walk on the argument-SCCs to assign nocapture. This gets us nocapture more often, and does so rather efficiently and independent of iteration order. llvm-svn: 147327
* Revert a bit of r137667; the logic in question can safely handle atomic ↵Eli Friedman2011-08-161-4/+4
| | | | | | load/store. llvm-svn: 137702
* Update inter-procedural optimizations for atomic load/store.Eli Friedman2011-08-151-2/+2
| | | | llvm-svn: 137667
* Add helper functions for computing the Location of load, store,Dan Gohman2010-11-111-10/+3
| | | | | | and vaarg instructions. llvm-svn: 118845
* Add a doesAccessArgPointees helper function, and update code to useDan Gohman2010-11-101-1/+1
| | | | | | it, and to be consistent. llvm-svn: 118692
* Factor out the code for testing whether a function accessesDan Gohman2010-11-101-3/+2
| | | | | | arbitrary memory into a helper function, and adjust some comments. llvm-svn: 118687
* Make ModRefBehavior a lattice. Use this to clean up AliasAnalysisDan Gohman2010-11-101-44/+31
| | | | | | chaining and simplify FunctionAttrs' GetModRefBehavior logic. llvm-svn: 118660
* Teach FunctionAttrs about the VAArg instruction.Dan Gohman2010-11-091-0/+7
| | | | llvm-svn: 118627
* Use the AliasAnalysis interface to determine how a Function accessesDan Gohman2010-11-091-2/+3
| | | | | | | memory. This isn't a real improvement with present day AliasAnalysis implementations; it's mainly for consistency. llvm-svn: 118624
* Teach FunctionAttrs about AccessesArgumentsReadonly.Dan Gohman2010-11-091-0/+19
| | | | llvm-svn: 118617
* Fix a thinko that Duncan spotted.Dan Gohman2010-11-081-1/+1
| | | | llvm-svn: 118430
* Make FunctionAttrs TBAA-aware.Dan Gohman2010-11-081-12/+24
| | | | llvm-svn: 118417
OpenPOWER on IntegriCloud