summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/InlineFunction.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* It's possible that an all-zero GEP may be used as the argument to lifetimeNick Lewycky2011-06-131-2/+6
| | | | | | | | | intrinsics. In fact, we'll optimize a bitcast to that when possible. Detect it when looking for the lifetime intrinsics. No test case, noticed by inspection. llvm-svn: 132906
* SplitCriticalEdge can sometimes split the edge from an invoke to a landingJohn McCall2011-06-091-28/+184
| | | | | | | | | | | | pad, separating the exception and selector calls from the new lpad. Teaching it not to do that, or to properly adjust the CFG afterwards, is out of scope because it would require the other edges to the landing pad to be split as well (effectively). Instead, just recover from the most likely cases during inlining. The best long-term solution is to change the exception representation and commit to either requiring or not requiring the more complex edge-splitting logic; this is just a shorter-term hack. llvm-svn: 132799
* Teach the CallGraph to ignore calls to intrinsics.John McCall2011-06-091-41/+7
| | | | llvm-svn: 132797
* First, do no harm -- even if we can't find a selector for an enclosingJohn McCall2011-06-011-4/+18
| | | | | | | landing pad, forward llvm.eh.resume calls to it instead of turning them invalidly into invokes. llvm-svn: 132382
* Fix this to work correctly with phis; test case to follow if this successfullyJohn McCall2011-05-291-0/+1
| | | | | | fixes self-host. llvm-svn: 132275
* Implement and document the llvm.eh.resume intrinsic, which isJohn McCall2011-05-281-62/+181
| | | | | | | | | | | | | | | | | transformed by the inliner into a branch to the enclosing landing pad (when inlined through an invoke). If not so optimized, it is lowered DWARF EH preparation into a call to _Unwind_Resume (or _Unwind_SjLj_Resume as appropriate). Its chief advantage is that it takes both the exception value and the selector value as arguments, meaning that there is zero effort in recovering these; however, the frontend is required to pass these down, which is not actually particularly difficult. Also document the behavior of landing pads a bit better, and make it clearer that it's okay that personality functions don't always land at landing pads. This is just a fact of life. Don't write optimizations that rely on pushing things over an unwind edge. llvm-svn: 132253
* Fix the inliner to maintain the current de facto invoke semantics:John McCall2011-05-271-42/+155
| | | | | | | | | | | | | | - the selector for the landing pad must provide all available information about the handlers, filters, and cleanups within that landing pad - calls to _Unwind_Resume must be converted to branches to the enclosing lpad so as to avoid re-entering the unwinder when the lpad claimed it was going to handle the exception in some way This is quite specific to libUnwind-based unwinding. In an effort to not interfere too badly with other unwinders, and with existing hacks in frontends, this only triggers on _Unwind_Resume (not _Unwind_Resume_or_Rethrow) and does nothing with selectors if it cannot find a selector call for either lpad. llvm-svn: 132200
* Teach the inliner to emit llvm.lifetime.start/end, to scope the local variablesNick Lewycky2011-05-221-0/+70
| | | | | | of the inlinee to the code representing the original function. llvm-svn: 131838
* Fix a ton of comment typos found by codespell. Patch byChris Lattner2011-04-151-1/+1
| | | | | | Luis Felipe Strano Moraes! llvm-svn: 129558
* Remove PHINode::reserveOperandSpace(). Instead, add a parameter toJay Foad2011-03-301-2/+1
| | | | | | PHINode::Create() giving the (known or expected) number of operands. llvm-svn: 128537
* (Almost) always call reserveOperandSpace() on newly created PHINodes.Jay Foad2011-03-301-0/+1
| | | | llvm-svn: 128535
* switch the inliner alignment enforcement stuff to use theChris Lattner2010-12-251-27/+8
| | | | | | | getOrEnforceKnownAlignment function, which simplifies the code and makes it stronger. llvm-svn: 122555
* when eliding a byval copy due to inlining a readonly function, we haveChris Lattner2010-12-201-4/+43
| | | | | | to make sure that the reused alloca has sufficient alignment. llvm-svn: 122236
* pull byval processing out to its own helper function.Chris Lattner2010-12-201-56/+72
| | | | llvm-svn: 122235
* fix PR8769, a miscompilation by inliner when inlining a function with a byvalChris Lattner2010-12-201-6/+10
| | | | | | | | argument. The generated alloca has to have at least the alignment of the byval, if not, the client may be making assumptions that the new alloca won't satisfy. llvm-svn: 122234
* improve commentChris Lattner2010-12-061-2/+1
| | | | llvm-svn: 120994
* Simplify code. No change in functionality.Benjamin Kramer2010-11-201-1/+1
| | | | llvm-svn: 119908
* Have InlineFunction use SimplifyInstruction rather thanDuncan Sands2010-11-171-9/+11
| | | | | | | | | hasConstantValue. I was leery of using SimplifyInstruction while the IR was still in a half-baked state, which is the reason for delaying the simplification until the IR is fully cooked. llvm-svn: 119494
* Be more consistent in using ValueToValueMapTy.Rafael Espindola2010-10-131-3/+3
| | | | llvm-svn: 116387
* Reapply r112091 and r111922, support for metadata linking, with aDan Gohman2010-08-261-1/+2
| | | | | | | | | | | | | | fix: add a flag to MapValue and friends which indicates whether any module-level mappings are being made. In the common case of inlining, no module-level mappings are needed, so MapValue doesn't need to examine non-function-local metadata, which can be very expensive in the case of a large module with really deep metadata (e.g. a large C++ program compiled with -g). This flag is a little awkward; perhaps eventually it can be moved into the ClonedCodeInfo class. llvm-svn: 112190
* simplify: CallSite::get --> CallSite constructorGabor Greif2010-07-271-4/+4
| | | | llvm-svn: 109506
* use callsite to obtain all argumentsGabor Greif2010-06-241-1/+2
| | | | llvm-svn: 106728
* Use ValueMap instead of DenseMap.Devang Patel2010-06-241-3/+3
| | | | | | The ValueMapper used by various cloning utility maps MDNodes also. llvm-svn: 106706
* Cosmetic change.Devang Patel2010-06-231-8/+8
| | | | | | Do not use "ValueMap" as a name for a local variable or an argument. llvm-svn: 106698
* Fix PR7272: when inlining through a callsite with byval arguments,Duncan Sands2010-05-311-0/+4
| | | | | | | the newly created allocas may be used by inlined calls, so these need to have their tail call flags cleared. Fixes PR7272. llvm-svn: 105255
* rename InlineInfo.DevirtualizedCalls -> InlinedCalls toChris Lattner2010-05-011-5/+5
| | | | | | | reflect that it includes all inlined calls now, not just devirtualized ones. llvm-svn: 102824
* Implement rdar://6295824 and PR6724 with two tiny changesChris Lattner2010-05-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | that can have a big effect :). The first is to enable the iterative SCC passmanager juice that kicks in when the scc passmgr detects that a function pass has devirtualized a call. In this case, it will rerun all the passes it manages on the SCC, up to the iteration count limit (4). This is useful because a function pass may devirualize a call, and we want the inliner to inline it, or pruneeh to infer stuff about it, etc. The second patch is to add *all* call sites to the DevirtualizedCalls list the inliner uses. This list is about to get renamed, but the jist of this is that the inliner now reconsiders *all* inlined call sites as candidates for further inlining. The intuition is this that in cases like this: f() { g(1); } g(int x) { h(x); } We analyze this bottom up, and may decide that it isn't profitable to inline H into G. Next step, we decide that it is profitable to inline G into F, and do so, which means that F now calls H. Even though the call from G -> H may not have been profitable to inline, the call from F -> H may be (in this case because a constant allows folding etc). In my spot checks, this doesn't have a big impact on code. For example, the LLC output for 252.eon grew from 0.02% (from 317252 to 317308) and 176.gcc actually shrunk by .3% (from 1525612 to 1520964 bytes). 252.eon never iterated in the SCC Passmgr, 176.gcc iterated at most 1 time. llvm-svn: 102823
* switch InlineInfo.DevirtualizedCalls's list to be of WeakVH.Chris Lattner2010-04-231-1/+1
| | | | | | | | | This fixes a bug where calls inlined into an invoke would get changed into an invoke but the array would keep pointing to the (now dead) call. The improved inliner behavior is still disabled for now. llvm-svn: 102196
* The inliner was choosing to not consider call sitesChris Lattner2010-04-221-2/+7
| | | | | | | | | | that appear in the SCC as a result of inlining as candidates for inlining. Change this so that it *does* consider call sites that change from being indirect to being direct as a result of inlining. This allows it to completely "devirtualize" the testcase. llvm-svn: 102146
* refactor the interface to InlineFunction so that most of the in/outChris Lattner2010-04-221-21/+21
| | | | | | | | arguments are handled with a new InlineFunctionInfo class. This makes it easier to extend InlineFunction to return more info in the future. llvm-svn: 102137
* when inlining something like this:Chris Lattner2010-04-221-2/+16
| | | | | | | | | | | | | | | | | | | | | | | define void @f3(void (i8*)* %__f) ssp { entry: call void %__f(i8* undef) unreachable } define void @f4(i8* %this) ssp align 2 { entry: call void @f3(void (i8*)* @f2) ssp ret void } The inliner is turning the indirect call to %__f into a direct call to F2. Make the call graph more precise when this happens. The inliner doesn't revisit call sites introduced by inlining, so there isn't an easy way to test for this, but a more precise callgraph is a good thing. llvm-svn: 102131
* eliminate dead #include.Chris Lattner2010-04-221-1/+0
| | | | llvm-svn: 102119
* Revert 101465, it broke internal OpenGL testing.Eric Christopher2010-04-161-1/+1
| | | | | | | Probably the best way to know that all getOperand() calls have been handled is to replace that API instead of updating. llvm-svn: 101579
* reapply r101434Gabor Greif2010-04-161-1/+1
| | | | | | | | | | | | | with a fix for self-hosting rotate CallInst operands, i.e. move callee to the back of the operand array the motivation for this patch are laid out in my mail to llvm-commits: more efficient access to operands and callee, faster callgraph-construction, smaller compiler binary llvm-svn: 101465
* back out r101423 and r101397, they break llvm-gcc self-host on darwin10Gabor Greif2010-04-161-1/+1
| | | | llvm-svn: 101434
* reapply r101364, which has been backed out in r101368Gabor Greif2010-04-151-1/+1
| | | | | | | | | | | | | with a fix rotate CallInst operands, i.e. move callee to the back of the operand array the motivation for this patch are laid out in my mail to llvm-commits: more efficient access to operands and callee, faster callgraph-construction, smaller compiler binary llvm-svn: 101397
* back out r101364, as it trips the linux nightlybot on some clang C++ testsGabor Greif2010-04-151-1/+1
| | | | llvm-svn: 101368
* rotate CallInst operands, i.e. move callee to the backGabor Greif2010-04-151-1/+1
| | | | | | | | | | of the operand array the motivation for this patch are laid out in my mail to llvm-commits: more efficient access to operands and callee, faster callgraph-construction, smaller compiler binary llvm-svn: 101364
* Reapply address space patch after fixing an issue in MemCopyOptimizer.Mon P Wang2010-04-041-5/+6
| | | | | | | Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset, e.g., llvm.memcpy.i32(i8*, i8*, i32, i32) -> llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1) llvm-svn: 100304
* Revert r100191 since it breaks objc in clang Mon P Wang2010-04-021-6/+5
| | | | llvm-svn: 100199
* Reapply address space patch after fixing an issue in MemCopyOptimizer.Mon P Wang2010-04-021-5/+6
| | | | | | | Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset, e.g., llvm.memcpy.i32(i8*, i8*, i32, i32) -> llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1) llvm-svn: 100191
* Revert Mon Ping's change 99928, since it broke all the llvm-gcc buildbots.Bob Wilson2010-03-301-6/+5
| | | | llvm-svn: 99948
* Added support for address spaces and added a isVolatile field to memcpy, ↵Mon P Wang2010-03-301-5/+6
| | | | | | | | | memmove, and memset, e.g., llvm.memcpy.i32(i8*, i8*, i32, i32) -> llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1) A update of langref will occur in a subsequent checkin. llvm-svn: 99928
* Temporarily revert this, it's causing an issue with an internal project.Eric Christopher2010-03-241-3/+1
| | | | llvm-svn: 99451
* add some accessors to callsite/callinst/invokeinst to checkChris Lattner2010-03-231-1/+3
| | | | | | | | for the noinline attribute, and make the inliner refuse to inline a call site when the call site is marked noinline even if the callee isn't. This fixes PR6682. llvm-svn: 99341
* Remove dead debug info intrinsics.Devang Patel2010-01-051-45/+0
| | | | | | | | | | Intrinsic::dbg_stoppoint Intrinsic::dbg_region_start Intrinsic::dbg_region_end Intrinsic::dbg_func_start AutoUpgrade simply ignores these intrinsics now. llvm-svn: 92557
* Implement support to debug inlined functions.Devang Patel2009-11-101-1/+1
| | | | llvm-svn: 86748
* Fix a pretty serious misfeature of the inliner: if it inlines a functionChris Lattner2009-10-271-0/+9
| | | | | | | | | | with multiple return values it inserts a PHI to merge them all together. However, if the return values are all the same, it ends up with a pointless PHI and this pointless PHI happens to really block SRoA from happening in at least a silly C++ example written by Doug, but probably others. This fixes rdar://7339069. llvm-svn: 85206
* Simplify some code (first hunk) and fix PR5208 (second hunk) byChris Lattner2009-10-171-8/+6
| | | | | | updating the callgraph when introducing a call. llvm-svn: 84310
* Introduce and use convenience methods for getting pointer typesDuncan Sands2009-10-061-1/+1
| | | | | | | where the element is of a basic builtin type. For example, to get an i8* use getInt8PtrTy. llvm-svn: 83379
OpenPOWER on IntegriCloud