summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/InlineFunction.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Don't insert lifetime.end markers between a musttail call and retReid Kleckner2014-05-151-2/+12
| | | | | | | | | | | The allocas going out of scope are immediately killed by the return instruction. Reviewers: chandlerc Differential Revision: http://reviews.llvm.org/D3630 llvm-svn: 208912
* Teach the inliner how to preserve musttail invariantsReid Kleckner2014-05-151-26/+112
| | | | | | | | | | | | | | | | | | | | The interesting case is what happens when you inline a musttail call through a musttail call site. In this case, we can't break perfect forwarding or allow any stack growth. Instead of merging control flow from the inlined return instruction after a musttail call into the body of the caller, leave the inlined return instruction in the caller so that the musttail call stays in the tail position. More work is required in http://reviews.llvm.org/D3630 to handle the case where the inlined function has dynamic allocas or byval arguments. Reviewers: chandlerc Differential Revision: http://reviews.llvm.org/D3491 llvm-svn: 208910
* [C++] Use 'nullptr'. Transforms edition.Craig Topper2014-04-251-13/+13
| | | | llvm-svn: 207196
* Remove more default address space argument usage.Matt Arsenault2014-04-231-3/+6
| | | | | | These places are inconsequential in practice. llvm-svn: 207021
* Fix PR7272 in -tailcallelim instead of the inlinerReid Kleckner2014-04-211-8/+1
| | | | | | | | | | | | | | | | The -tailcallelim pass should be checking if byval or inalloca args can be captured before marking calls as tail calls. This was the real root cause of PR7272. With a better fix in place, revert the inliner change from r105255. The test case it introduced still passes and has been moved to test/Transforms/Inline/byval-tail-call.ll. Reviewers: chandlerc Differential Revision: http://reviews.llvm.org/D3403 llvm-svn: 206789
* Add lifetime markers for allocas created to hold byval arguments, make themJulien Lerouge2014-04-151-0/+1
| | | | | | appear in the InlineFunctionInfo. llvm-svn: 206308
* Split byval argument initialization so the memcpy(s) are injected at theJulien Lerouge2014-04-151-29/+42
| | | | | | beginning of the first new block after inlining. llvm-svn: 206307
* [C++11] Add range based accessors for the Use-Def chain of a Value.Chandler Carruth2014-03-091-8/+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
* [Layering] Move DebugInfo.h into the IR library where its implementationChandler Carruth2014-03-061-1/+1
| | | | | | already lives. llvm-svn: 203046
* [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
* Rename some member variables from TD to DL.Rafael Espindola2014-02-181-9/+9
| | | | | | TargetData was renamed DataLayout back in r165242. llvm-svn: 201581
* Fix inlining to not lose the "cleanup" clause from landingpadsMark Seaborn2013-12-081-0/+2
| | | | | | | This fixes PR17872. This bug can lead to C++ destructors not being called when they should be, when an exception is thrown. llvm-svn: 196711
* Fix inlining to not produce duplicate landingpad clausesMark Seaborn2013-12-081-20/+12
| | | | | | | | | | | | | | | | | | | | | | | Before this change, inlining one "invoke" into an outer "invoke" call site can lead to the outer landingpad's catch/filter clauses being copied multiple times into the resulting landingpad. This happens: * when the inlined function contains multiple "resume" instructions, because forwardResume() copies the clauses but is called multiple times; * when the inlined function contains a "resume" and a "call", because HandleCallsInBlockInlinedThroughInvoke() copies the clauses but is redundant with forwardResume(). Fix this by deduplicating the code. This problem doesn't lead to any incorrect execution; it's only untidy. This change will make fixing PR17872 a little easier. llvm-svn: 196710
* InlineFunction.cpp: Remove a return value that is always falseMark Seaborn2013-12-021-11/+3
| | | | | | | | Remove some associated dead code. This cleanup is associated with PR17872. llvm-svn: 196147
* Revert "Inliner: Handle readonly attribute per argument when adding memcpy"David Majnemer2013-11-031-13/+10
| | | | | | | | This reverts commit r193356, it caused PR17781. A reduced test case covering this regression has been added to the test suite. llvm-svn: 193955
* Do not convert "call asm" to "invoke asm" in Inliner.Manman Ren2013-10-311-1/+2
| | | | | | | | | | | | | | | | Given that backend does not handle "invoke asm" correctly ("invoke asm" will be handled by SelectionDAGBuilder::visitInlineAsm, which does not have the right setup for LPadToCallSiteMap) and we already made the assumption that inline asm does not throw in InstCombiner::visitCallSite, we are going to make the same assumption in Inliner to make sure we don't convert "call asm" to "invoke asm". If it becomes necessary to add support for "invoke asm" later on, we will need to modify the backend as well as remove the assumptions that inline asm does not throw. Fix rdar://15317907 llvm-svn: 193808
* Inliner: Handle readonly attribute per argument when adding memcpyTom Stellard2013-10-241-10/+13
| | | | | | Patch by: Vincent Lejeune llvm-svn: 193356
* Fix a use after free. RI is freed before the call to getDebugLoc(). ToRichard Trieu2013-04-301-4/+5
| | | | | | prevent this, capture the location before RI is freed. llvm-svn: 180824
* Spelling. Thanks, Eric.Adrian Prantl2013-04-301-1/+1
| | | | llvm-svn: 180794
* Set debug locations for branch instructions created during inlining, evenAdrian Prantl2013-04-301-2/+10
| | | | | | | | the inlined function has multiple returns. rdar://problem/12415623 llvm-svn: 180793
* Make sure the instruction right after an inlined function has aAdrian Prantl2013-04-231-4/+10
| | | | | | | | | | debug location. This solves a problem where range of an inlined subroutine is emitted wrongly. Patch by Manman Ren. Fixes rdar://problem/12415623 llvm-svn: 180140
* Add all clauses when merging the landing pads. Duplicates will be handled ↵Bill Wendling2013-03-221-24/+14
| | | | | | later on. llvm-svn: 177757
* Don't use the removed API.Bill Wendling2013-03-221-5/+2
| | | | llvm-svn: 177749
* Always forward 'resume' instructions to the outter landing pad.Bill Wendling2013-03-211-16/+39
| | | | | | | | | | | | | | | | | How did this ever work? Basically, if you have a function that's inlined into the caller, it may not have any 'call' instructions, but any 'resume' instructions it may have should still be forwarded to the outer (caller's) landing pad. This requires that all of the 'landingpad' instructions in the callee have their clauses merged with the caller's outer 'landingpad' instruction (hence the bit of ugly code in the `forwardResume' method). Testcase in a follow commit to the test-suite repository. <rdar://problem/13360379> & PR15555 llvm-svn: 177680
* Move all of the header files which are involved in modelling the LLVM IRChandler Carruth2013-01-021-9/+9
| | | | | | | | | | | | | | | | | | | | | 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-5/+5
| | | | | | | | | | | | | | | | | 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
* Figure out <size> argument of llvm.lifetime intrinsics at the moment they ↵Alexey Samsonov2012-11-131-2/+21
| | | | | | are created (during function inlining) llvm-svn: 167821
* Move TargetData to DataLayout.Micah Villmow2012-10-081-2/+2
| | | | llvm-svn: 165402
* Move llvm/Support/IRBuilder.h -> llvm/IRBuilder.hChandler Carruth2012-06-291-6/+6
| | | | | | | | | | | | | | | | | This was always part of the VMCore library out of necessity -- it deals entirely in the IR. The .cpp file in fact was already part of the VMCore library. This is just a mechanical move. I've tried to go through and re-apply the coding standard's preferred header sort, but at 40-ish files, I may have gotten some wrong. Please let me know if so. I'll be committing the corresponding updates to Clang and Polly, and Duncan has DragonEgg. Thanks to Bill and Eric for giving the green light for this bit of cleanup. llvm-svn: 159421
* Move lib/Analysis/DebugInfo.cpp to lib/VMCore/DebugInfo.cpp andBill Wendling2012-06-281-1/+1
| | | | | | | | | include/llvm/Analysis/DebugInfo.h to include/llvm/DebugInfo.h. The reasoning is because the DebugInfo module is simply an interface to the debug info MDNodes and has nothing to do with analysis. llvm-svn: 159312
* Convert comments to proper Doxygen comments.Dmitri Gribenko2012-06-091-4/+4
| | | | llvm-svn: 158248
* Tidy.Eric Christopher2012-03-261-1/+1
| | | | llvm-svn: 153456
* Tidy.Eric Christopher2012-03-261-6/+9
| | | | llvm-svn: 153455
* Add support for disabling llvm.lifetime intrinsics in the AlwaysInliner. TheseChad Rosier2012-02-251-6/+6
| | | | | | | | are optimization hints, but at -O0 we're not optimizing. This becomes a problem when the alwaysinline attribute is abused. rdar://10921594 llvm-svn: 151429
* [unwind removal] Remove all of the code for the dead 'unwind' instruction. ThereBill Wendling2012-02-061-49/+4
| | | | | | | were no 'unwind' instructions being generated before this, so this is in effect a no-op. llvm-svn: 149906
* s/getInnerUnwindDest/getInnerResumeDest/gBill Wendling2012-01-311-4/+4
| | | | llvm-svn: 149328
* Remove ivar which is identical to another ivar.Bill Wendling2012-01-311-10/+6
| | | | llvm-svn: 149323
* Remove unused ivars and s/getOuterUnwindDest/getOuterResumeDest/g.Bill Wendling2012-01-311-9/+4
| | | | llvm-svn: 149322
* Remove more dead functions.Bill Wendling2012-01-311-211/+0
| | | | llvm-svn: 149318
* s/getInnerUnwindDestNewEH/getInnerUnwindDest/gBill Wendling2012-01-311-4/+3
| | | | llvm-svn: 149317
* Remove some unused, old-EH methods.Bill Wendling2012-01-311-116/+3
| | | | llvm-svn: 149316
* Get rid of references to dead intrinsics.Bill Wendling2012-01-311-53/+5
| | | | | | | The eh.selector and eh.resume intrinsics aren't used anymore. Get rid of some calls to them. llvm-svn: 149314
* Formatting cleanups. No functionality change.Bill Wendling2012-01-311-20/+20
| | | | llvm-svn: 149312
* Remove no-longer-useful dyn_casts and pals.Bill Wendling2012-01-311-21/+10
| | | | llvm-svn: 149307
* Fix quadratic behavior in InlineFunction by fetching the personality ↵Benjamin Kramer2011-12-021-29/+33
| | | | | | | | | | function of the callee once and not for every invoke in the caller. The callee is usually smaller than the caller, too. This reduces the compile time of ARMDisassembler.cpp by 32% (Release build). It still takes ages to compile though. llvm-svn: 145690
* Refactor code to use new attribute getters on CallSite for NoCapture and ByVal.Nick Lewycky2011-11-201-1/+1
| | | | | | | | Suggested in code review by Eli. That code in InstCombine looks kinda suspicious. llvm-svn: 145013
* Add inlining for the new EH scheme.Bill Wendling2011-08-141-17/+146
| | | | | | | | | | | | | This builds off of the current scheme, but instead of llvm.eh.exception and llvm.eh.selector, it uses the landingpad instruction. And instead of llvm.eh.resume, it uses the resume instruction. Because of the invariants in the landing pad instruction, a lot of code that's currently needed to find the appropriate intrinsic calls for an invoke instruction won't be needed once we go to the new EH scheme. The "FIXME"s tell us what to remove after we switch. llvm-svn: 137576
* Distinguish between two copies of one inlined variable. Take 2.Devang Patel2011-08-101-1/+8
| | | | llvm-svn: 137253
* Temporarily revert r135528 which distinguishes between two copies of oneChandler Carruth2011-08-051-8/+1
| | | | | | | | | | | | | | | | | | | inlined variable, based on the discussion in PR10542. This explodes the runtime of several passes down the pipeline due to a large number of "copies" remaining live across a large function. This only shows up with both debug and opt, but when it does it creates a many-minute compile when self-hosting LLVM+Clang. There are several other cases that show these types of regressions. All of this is tracked in PR10542, and progress is being made on fixing the issue. Once its addressed, the re-instated, but until then this restores the performance for self-hosting and other opt+debug builds. Devang, let me know if this causes any trouble, or impedes fixing it in any way, and thanks for working on this! llvm-svn: 136953
* Revert r136253, r136263, r136269, r136313, r136325, r136326, r136329, r136338,Bill Wendling2011-07-301-142/+19
| | | | | | | r136339, r136341, r136369, r136387, r136392, r136396, r136429, r136430, r136444, r136445, r136446, r136253 pending review. llvm-svn: 136556
OpenPOWER on IntegriCloud