summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/InlineFunction.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Some minor cleanups. No functionalitical change.Bill Wendling2011-07-281-17/+10
| | | | llvm-svn: 136341
* Leverage some of the code that John wrote to manage the landing pads.Bill Wendling2011-07-281-32/+56
| | | | | | | The new EH is more simple in many respects. Mainly, we don't have to worry about the "llvm.eh.exception" and "llvm.eh.selector" calls being in weird places. llvm-svn: 136339
* Automatically merge the landingpad clauses when we come across a callee'sBill Wendling2011-07-281-28/+12
| | | | | | landingpad. llvm-svn: 136329
* Initial stab at getting inlining working with the EH rewrite.Bill Wendling2011-07-281-10/+98
| | | | | | | | | This takes the new 'resume' instruction and turns it into a direct jump to the caller's landing pad code. The caller's landingpad instruction is merged with the landingpad instructions of the callee. This is a bit rough and makes some assumptions in how the code works. But it passes a simple test. llvm-svn: 136313
* Refuse to inline two functions which use different personality functions.Bill Wendling2011-07-271-0/+34
| | | | llvm-svn: 136269
* Distinguish between two copies of one inlined variable.Devang Patel2011-07-191-1/+8
| | | | llvm-svn: 135528
* land David Blaikie's patch to de-constify Type, with a few tweaks.Chris Lattner2011-07-181-3/+3
| | | | llvm-svn: 135375
* Convert CallInst and InvokeInst APIs to use ArrayRef.Jay Foad2011-07-151-6/+3
| | | | llvm-svn: 135265
* Change Intrinsic::getDeclaration and friends to take an ArrayRef.Benjamin Kramer2011-07-141-1/+1
| | | | llvm-svn: 135154
* Second attempt at de-constifying LLVM Types in FunctionType::get(),Jay Foad2011-07-121-2/+2
| | | | | | StructType::get() and TargetData::getIntPtrType(). llvm-svn: 134982
* Revert r134893 and r134888 (and related patches in other trees). It was causingBill Wendling2011-07-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | an assert on Darwin llvm-gcc builds. Assertion failed: (castIsValid(op, S, Ty) && "Invalid cast!"), function Create, file /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.llvm-gcc-i386-darwin9-RA/llvm.src/lib/VMCore/Instructions.cpp, li\ ne 2067. etc. http://smooshlab.apple.com:8013/builders/llvm-gcc-i386-darwin9-RA/builds/2354 --- Reverse-merging r134893 into '.': U include/llvm/Target/TargetData.h U include/llvm/DerivedTypes.h U tools/bugpoint/ExtractFunction.cpp U unittests/Support/TypeBuilderTest.cpp U lib/Target/ARM/ARMGlobalMerge.cpp U lib/Target/TargetData.cpp U lib/VMCore/Constants.cpp U lib/VMCore/Type.cpp U lib/VMCore/Core.cpp U lib/Transforms/Utils/CodeExtractor.cpp U lib/Transforms/Instrumentation/ProfilingUtils.cpp U lib/Transforms/IPO/DeadArgumentElimination.cpp U lib/CodeGen/SjLjEHPrepare.cpp --- Reverse-merging r134888 into '.': G include/llvm/DerivedTypes.h U include/llvm/Support/TypeBuilder.h U include/llvm/Intrinsics.h U unittests/Analysis/ScalarEvolutionTest.cpp U unittests/ExecutionEngine/JIT/JITTest.cpp U unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp U unittests/VMCore/PassManagerTest.cpp G unittests/Support/TypeBuilderTest.cpp U lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp U lib/Target/Blackfin/BlackfinIntrinsicInfo.cpp U lib/VMCore/IRBuilder.cpp G lib/VMCore/Type.cpp U lib/VMCore/Function.cpp G lib/VMCore/Core.cpp U lib/VMCore/Module.cpp U lib/AsmParser/LLParser.cpp U lib/Transforms/Utils/CloneFunction.cpp G lib/Transforms/Utils/CodeExtractor.cpp U lib/Transforms/Utils/InlineFunction.cpp U lib/Transforms/Instrumentation/GCOVProfiling.cpp U lib/Transforms/Scalar/ObjCARC.cpp U lib/Transforms/Scalar/SimplifyLibCalls.cpp U lib/Transforms/Scalar/MemCpyOptimizer.cpp G lib/Transforms/IPO/DeadArgumentElimination.cpp U lib/Transforms/IPO/ArgumentPromotion.cpp U lib/Transforms/InstCombine/InstCombineCompares.cpp U lib/Transforms/InstCombine/InstCombineAndOrXor.cpp U lib/Transforms/InstCombine/InstCombineCalls.cpp U lib/CodeGen/DwarfEHPrepare.cpp U lib/CodeGen/IntrinsicLowering.cpp U lib/Bitcode/Reader/BitcodeReader.cpp llvm-svn: 134949
* De-constify Types in FunctionType::get().Jay Foad2011-07-111-2/+2
| | | | llvm-svn: 134888
* Refactor. It is inliner's responsibility to update line number information.Devang Patel2011-07-081-0/+38
| | | | llvm-svn: 134708
* Reinstate r133513 (reverted in r133700) with an additional fix for aJay Foad2011-06-231-5/+5
| | | | | | -Wshorten-64-to-32 warning in Instructions.h. llvm-svn: 133708
* Revert r133513:Eric Christopher2011-06-231-5/+5
| | | | | | | | | "Reinstate r133435 and r133449 (reverted in r133499) now that the clang self-hosted build failure has been fixed (r133512)." Due to some additional warnings. llvm-svn: 133700
* Reinstate r133435 and r133449 (reverted in r133499) now that the clangJay Foad2011-06-211-5/+5
| | | | | | self-hosted build failure has been fixed (r133512). llvm-svn: 133513
* Revert r133435 and r133449 to appease buildbots.Chad Rosier2011-06-211-5/+5
| | | | llvm-svn: 133499
* Change how PHINodes store their operands.Jay Foad2011-06-201-5/+5
| | | | | | | | | | | | | | | | | | | Change PHINodes to store simple pointers to their incoming basic blocks, instead of full-blown Uses. Note that this loses an optimization in SplitCriticalEdge(), because we can no longer walk the use list of a BasicBlock to find phi nodes. See the comment I removed starting "However, the foreach loop is slow for blocks with lots of predecessors". Extend replaceAllUsesWith() on a BasicBlock to also update any phi nodes in the block's successors. This mimics what would have happened when PHINodes were proper Users of their incoming blocks. (Note that this only works if OldBB->replaceAllUsesWith(NewBB) is called when OldBB still has a terminator instruction, so it still has some successors.) llvm-svn: 133435
* Use IRBuilder to make our intrinsic calls in the inliner so that we pick upJohn McCall2011-06-141-10/+9
| | | | | | line info correctly. llvm-svn: 132961
* Use Value::stripPointerCasts instead of reinventing part of the wheel.Nick Lewycky2011-06-141-6/+2
| | | | llvm-svn: 132954
* 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
OpenPOWER on IntegriCloud