LLVM 20.0.0git
|
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/BlockFrequencyInfo.h"
#include "llvm/Analysis/CallGraph.h"
#include "llvm/Analysis/CaptureTracking.h"
#include "llvm/Analysis/IndirectCallVisitor.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/MemoryProfileInfo.h"
#include "llvm/Analysis/ObjCARCAnalysisUtils.h"
#include "llvm/Analysis/ObjCARCUtil.h"
#include "llvm/Analysis/ProfileSummaryInfo.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/Analysis/VectorUtils.h"
#include "llvm/IR/Argument.h"
#include "llvm/IR/AttributeMask.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/CFG.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/ConstantRange.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/EHPersonalities.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/MDBuilder.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/ProfDataUtils.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/User.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Transforms/Utils/AssumeBundleBuilder.h"
#include "llvm/Transforms/Utils/Cloning.h"
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Transforms/Utils/ValueMapper.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <iterator>
#include <limits>
#include <optional>
#include <string>
#include <utility>
#include <vector>
Go to the source code of this file.
Macros | |
#define | DEBUG_TYPE "inline-function" |
#define | DEBUG_TYPE "assignment-tracking" |
#define | DEBUG_TYPE "inline-function" |
Typedefs | |
using | ProfileCount = Function::ProfileCount |
using | UnwindDestMemoTy = DenseMap< Instruction *, Value * > |
Functions | |
static Value * | getParentPad (Value *EHPad) |
Helper for getUnwindDestToken/getUnwindDestTokenHelper. | |
static Value * | getUnwindDestTokenHelper (Instruction *EHPad, UnwindDestMemoTy &MemoMap) |
Helper for getUnwindDestToken that does the descendant-ward part of the search. | |
static Value * | getUnwindDestToken (Instruction *EHPad, UnwindDestMemoTy &MemoMap) |
Given an EH pad, find where it unwinds. | |
static BasicBlock * | HandleCallsInBlockInlinedThroughInvoke (BasicBlock *BB, BasicBlock *UnwindEdge, UnwindDestMemoTy *FuncletUnwindMap=nullptr) |
When we inline a basic block into an invoke, we have to turn all of the calls that can throw into invokes. | |
static void | HandleInlinedLandingPad (InvokeInst *II, BasicBlock *FirstNewBlock, ClonedCodeInfo &InlinedCodeInfo) |
If we inlined an invoke site, we need to convert calls in the body of the inlined function into invokes. | |
static void | HandleInlinedEHPad (InvokeInst *II, BasicBlock *FirstNewBlock, ClonedCodeInfo &InlinedCodeInfo) |
If we inlined an invoke site, we need to convert calls in the body of the inlined function into invokes. | |
static bool | haveCommonPrefix (MDNode *MIBStackContext, MDNode *CallsiteStackContext) |
static void | removeMemProfMetadata (CallBase *Call) |
static void | removeCallsiteMetadata (CallBase *Call) |
static void | updateMemprofMetadata (CallBase *CI, const std::vector< Metadata * > &MIBList) |
static void | propagateMemProfHelper (const CallBase *OrigCall, CallBase *ClonedCall, MDNode *InlinedCallsiteMD) |
static void | propagateMemProfMetadata (Function *Callee, CallBase &CB, bool ContainsMemProfMetadata, const ValueMap< const Value *, WeakTrackingVH > &VMap) |
static void | PropagateCallSiteMetadata (CallBase &CB, Function::iterator FStart, Function::iterator FEnd) |
When inlining a call site that has !llvm.mem.parallel_loop_access, !llvm.access.group, !alias.scope or !noalias metadata, that metadata should be propagated to all memory-accessing cloned instructions. | |
static void | PropagateOperandBundles (Function::iterator InlinedBB, Instruction *CallSiteEHPad) |
Bundle operands of the inlined function must be added to inlined call sites. | |
static void | AddAliasScopeMetadata (CallBase &CB, ValueToValueMapTy &VMap, const DataLayout &DL, AAResults *CalleeAAR, ClonedCodeInfo &InlinedFunctionInfo) |
If the inlined function has noalias arguments, then add new alias scopes for each noalias argument, tag the mapped noalias parameters with noalias metadata specifying the new scope, and tag all non-derived loads, stores and memory intrinsics with the new alias scopes. | |
static bool | MayContainThrowingOrExitingCallAfterCB (CallBase *Begin, ReturnInst *End) |
static void | AddParamAndFnBasicAttributes (const CallBase &CB, ValueToValueMapTy &VMap) |
static AttrBuilder | IdentifyValidUBGeneratingAttributes (CallBase &CB) |
static AttrBuilder | IdentifyValidPoisonGeneratingAttributes (CallBase &CB) |
static void | AddReturnAttributes (CallBase &CB, ValueToValueMapTy &VMap) |
static void | AddAlignmentAssumptions (CallBase &CB, InlineFunctionInfo &IFI) |
If the inlined function has non-byval align arguments, then add @llvm.assume-based alignment assumptions to preserve this information. | |
static void | HandleByValArgumentInit (Type *ByValType, Value *Dst, Value *Src, Module *M, BasicBlock *InsertBlock, InlineFunctionInfo &IFI, Function *CalledFunc) |
static Value * | HandleByValArgument (Type *ByValType, Value *Arg, Instruction *TheCall, const Function *CalledFunc, InlineFunctionInfo &IFI, MaybeAlign ByValAlignment) |
When inlining a call site that has a byval argument, we have to make the implicit memcpy explicit by adding it. | |
static bool | isUsedByLifetimeMarker (Value *V) |
static bool | hasLifetimeMarkers (AllocaInst *AI) |
static bool | allocaWouldBeStaticInEntry (const AllocaInst *AI) |
Return the result of AI->isStaticAlloca() if AI were moved to the entry block. | |
static DebugLoc | inlineDebugLoc (DebugLoc OrigDL, DILocation *InlinedAt, LLVMContext &Ctx, DenseMap< const MDNode *, MDNode * > &IANodes) |
Returns a DebugLoc for a new DILocation which is a clone of OrigDL inlined at InlinedAt . | |
static void | fixupLineNumbers (Function *Fn, Function::iterator FI, Instruction *TheCall, bool CalleeHasDebugInfo) |
Update inlined instructions' line numbers to to encode location where these instructions are inlined. | |
static at::StorageToVarsMap | collectEscapedLocals (const DataLayout &DL, const CallBase &CB) |
Find Alloca and linked DbgAssignIntrinsic for locals escaped by CB . | |
static void | trackInlinedStores (Function::iterator Start, Function::iterator End, const CallBase &CB) |
static void | fixupAssignments (Function::iterator Start, Function::iterator End) |
Update inlined instructions' DIAssignID metadata. | |
static void | updateCallerBFI (BasicBlock *CallSiteBlock, const ValueToValueMapTy &VMap, BlockFrequencyInfo *CallerBFI, BlockFrequencyInfo *CalleeBFI, const BasicBlock &CalleeEntryBlock) |
Update the block frequencies of the caller after a callee has been inlined. | |
static void | updateCallProfile (Function *Callee, const ValueToValueMapTy &VMap, const ProfileCount &CalleeEntryCount, const CallBase &TheCall, ProfileSummaryInfo *PSI, BlockFrequencyInfo *CallerBFI) |
Update the branch metadata for cloned call instructions. | |
static void | inlineRetainOrClaimRVCalls (CallBase &CB, objcarc::ARCInstKind RVCallKind, const SmallVectorImpl< ReturnInst * > &Returns) |
An operand bundle "clang.arc.attachedcall" on a call indicates the call result is implicitly consumed by a call to retainRV or claimRV immediately after the call. | |
Variables | |
static cl::opt< bool > | EnableNoAliasConversion ("enable-noalias-to-md-conversion", cl::init(true), cl::Hidden, cl::desc("Convert noalias attributes to metadata during inlining.")) |
static cl::opt< bool > | UseNoAliasIntrinsic ("use-noalias-intrinsic-during-inlining", cl::Hidden, cl::init(true), cl::desc("Use the llvm.experimental.noalias.scope.decl " "intrinsic during inlining.")) |
static cl::opt< bool > | PreserveAlignmentAssumptions ("preserve-alignment-assumptions-during-inlining", cl::init(false), cl::Hidden, cl::desc("Convert align attributes to assumptions during inlining.")) |
static cl::opt< unsigned > | InlinerAttributeWindow ("max-inst-checked-for-throw-during-inlining", cl::Hidden, cl::desc("the maximum number of instructions analyzed for may throw during " "attribute inference in inlined body"), cl::init(4)) |
#define DEBUG_TYPE "inline-function" |
Definition at line 1916 of file InlineFunction.cpp.
#define DEBUG_TYPE "assignment-tracking" |
Definition at line 1916 of file InlineFunction.cpp.
#define DEBUG_TYPE "inline-function" |
Definition at line 1916 of file InlineFunction.cpp.
using ProfileCount = Function::ProfileCount |
Definition at line 85 of file InlineFunction.cpp.
using UnwindDestMemoTy = DenseMap<Instruction *, Value *> |
Definition at line 244 of file InlineFunction.cpp.
|
static |
If the inlined function has noalias arguments, then add new alias scopes for each noalias argument, tag the mapped noalias parameters with noalias metadata specifying the new scope, and tag all non-derived loads, stores and memory intrinsics with the new alias scopes.
Definition at line 1095 of file InlineFunction.cpp.
References A, llvm::Function::args(), llvm::ValueMap< KeyT, ValueT, Config >::begin(), llvm::MDNode::concatenate(), llvm::SmallPtrSetImpl< PtrType >::contains(), llvm::SmallPtrSetImpl< PtrType >::count(), llvm::MDBuilder::createAnonymousAliasScope(), llvm::MDBuilder::createAnonymousAliasScopeDomain(), llvm::IRBuilderBase::CreateNoAliasScopeDeclaration(), llvm::SmallVectorBase< Size_T >::empty(), EnableNoAliasConversion, llvm::ValueMap< KeyT, ValueT, Config >::end(), llvm::MDNode::get(), llvm::CallBase::getCalledFunction(), llvm::Function::getContext(), llvm::AAResults::getMemoryEffects(), llvm::Instruction::getMetadata(), llvm::Value::getName(), llvm::getUnderlyingObjects(), I, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::isEscapeSource(), llvm::isIdentifiedObject(), llvm::ClonedCodeInfo::isSimplified(), Name, NoAliases, llvm::MemoryEffectsBase< LocationEnum >::onlyAccessesArgPointees(), llvm::MemoryEffectsBase< LocationEnum >::onlyAccessesInaccessibleMem(), llvm::CallBase::paramHasAttr(), llvm::PointerMayBeCapturedBefore(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::DominatorTreeBase< NodeT, IsPostDom >::recalculate(), llvm::Instruction::setMetadata(), llvm::SmallVectorBase< Size_T >::size(), and UseNoAliasIntrinsic.
Referenced by llvm::InlineFunction().
|
static |
If the inlined function has non-byval align arguments, then add @llvm.assume-based alignment assumptions to preserve this information.
Definition at line 1575 of file InlineFunction.cpp.
References llvm::Function::args(), llvm::IRBuilderBase::CreateAlignmentAssumption(), DL, llvm::CallBase::getArgOperand(), llvm::InlineFunctionInfo::GetAssumptionCache, llvm::CallBase::getCalledFunction(), llvm::CallBase::getCaller(), llvm::Instruction::getDataLayout(), llvm::getKnownAlignment(), PreserveAlignmentAssumptions, llvm::DominatorTreeBase< NodeT, IsPostDom >::recalculate(), and llvm::AssumptionCache::registerAssumption().
Referenced by llvm::InlineFunction().
|
static |
Definition at line 1351 of file InlineFunction.cpp.
References llvm::CallBase::arg_size(), llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::SmallVectorImpl< T >::emplace_back(), llvm::Argument::getArgNo(), llvm::CallBase::getCalledFunction(), llvm::Function::getContext(), llvm::Value::getContext(), llvm::getUnderlyingObject(), I, llvm::ValueMap< KeyT, ValueT, Config >::lookup(), and llvm::CallBase::paramHasAttr().
Referenced by llvm::InlineFunction().
|
static |
Definition at line 1458 of file InlineFunction.cpp.
References llvm::AttrBuilder::addRangeAttr(), llvm::AttributeList::addRetAttributes(), llvm::AttrBuilder::getAlignment(), llvm::AttrBuilder::getAttribute(), llvm::CallBase::getCalledFunction(), llvm::Function::getContext(), llvm::AttrBuilder::getDereferenceableBytes(), llvm::AttrBuilder::getDereferenceableOrNullBytes(), llvm::User::getOperand(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), llvm::Attribute::getRange(), llvm::AttrBuilder::hasAttributes(), llvm::CallBase::hasRetAttr(), IdentifyValidPoisonGeneratingAttributes(), IdentifyValidUBGeneratingAttributes(), llvm::ConstantRange::intersectWith(), llvm::Attribute::isValid(), llvm::ValueMap< KeyT, ValueT, Config >::lookup(), MayContainThrowingOrExitingCallAfterCB(), llvm::AttrBuilder::removeAttribute(), and llvm::MaybeAlign::valueOrOne().
Referenced by llvm::InlineFunction().
|
static |
Return the result of AI->isStaticAlloca() if AI were moved to the entry block.
Allocas used in inalloca calls and allocas of dynamic array size cannot be static.
Definition at line 1719 of file InlineFunction.cpp.
References llvm::AllocaInst::getArraySize(), and llvm::AllocaInst::isUsedWithInAlloca().
Referenced by fixupLineNumbers(), and llvm::InlineFunction().
|
static |
Find Alloca and linked DbgAssignIntrinsic for locals escaped by CB
.
Definition at line 1844 of file InlineFunction.cpp.
References llvm::CallBase::args(), assert(), llvm::sampleprof::Base, DL, llvm::errs(), llvm::for_each(), llvm::at::getAssignmentMarkers(), llvm::at::getDVRAssignmentMarkers(), I, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert(), llvm::SmallPtrSetImpl< PtrType >::insert(), and LLVM_DEBUG.
Referenced by trackInlinedStores().
|
static |
Update inlined instructions' DIAssignID metadata.
We need to do this otherwise a function inlined more than once into the same function will cause DIAssignID to be shared by many instructions.
Definition at line 1906 of file InlineFunction.cpp.
References End, I, and llvm::at::remapAssignID().
Referenced by llvm::InlineFunction().
|
static |
Update inlined instructions' line numbers to to encode location where these instructions are inlined.
Definition at line 1735 of file InlineFunction.cpp.
References allocaWouldBeStaticInEntry(), assert(), DL, llvm::Function::end(), llvm::DebugLoc::get(), llvm::Function::getContext(), llvm::MDNode::getContext(), llvm::Instruction::getDebugLoc(), llvm::Function::hasFnAttribute(), I, inlineDebugLoc(), and llvm::updateLoopMetadataDebugLocations().
Referenced by llvm::InlineFunction().
Helper for getUnwindDestToken/getUnwindDestTokenHelper.
Definition at line 238 of file InlineFunction.cpp.
Referenced by getUnwindDestToken(), and getUnwindDestTokenHelper().
|
static |
Given an EH pad, find where it unwinds.
If it unwinds to an EH pad, return that pad instruction. If it unwinds to caller, return ConstantTokenNone. If it does not have a definitive unwind destination, return nullptr.
This routine gets invoked for calls in funclets in inlinees when inlining an invoke. Since many funclets don't have calls inside them, it's queried on-demand rather than building a map of pads to unwind dests up front. Determining a funclet's unwind dest may require recursively searching its descendants, and also ancestors and cousins if the descendants don't provide an answer. Since most funclets will have their unwind dest immediately available as the unwind dest of a catchswitch or cleanupret, this routine searches top-down from the given pad and then up. To avoid worst-case quadratic run-time given that approach, it uses a memo map to avoid re-processing funclet trees. The callers that rewrite the IR as they go take advantage of this, for correctness, by checking/forcing rewritten pads' entries to match the original callee view.
Definition at line 399 of file InlineFunction.cpp.
References assert(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::count(), llvm::SmallPtrSetImpl< PtrType >::count(), llvm::SmallVectorBase< Size_T >::empty(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), getParentPad(), getUnwindDestTokenHelper(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::SmallVectorImpl< T >::pop_back_val(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::Value::users().
Referenced by HandleCallsInBlockInlinedThroughInvoke(), HandleInlinedEHPad(), and llvm::InlineFunction().
|
static |
Helper for getUnwindDestToken that does the descendant-ward part of the search.
Definition at line 248 of file InlineFunction.cpp.
References assert(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::count(), llvm::SmallVectorBase< Size_T >::empty(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::ConstantTokenNone::get(), llvm::BasicBlock::getFirstNonPHI(), getParentPad(), llvm::SmallVectorImpl< T >::pop_back_val(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::Value::users().
Referenced by getUnwindDestToken().
|
static |
When inlining a call site that has a byval argument, we have to make the implicit memcpy explicit by adding it.
Definition at line 1637 of file InlineFunction.cpp.
References DL, llvm::InlineFunctionInfo::GetAssumptionCache, llvm::Instruction::getFunction(), llvm::Value::getName(), llvm::getOrEnforceKnownAlignment(), llvm::Type::getPointerAddressSpace(), llvm::Value::getType(), llvm::Instruction::insertBefore(), llvm::Function::onlyReadsMemory(), llvm::InlineFunctionInfo::StaticAllocas, and llvm::MaybeAlign::valueOrOne().
Referenced by llvm::InlineFunction().
|
static |
Definition at line 1612 of file InlineFunction.cpp.
References llvm::BasicBlock::begin(), llvm::IRBuilderBase::CreateMemCpy(), llvm::Instruction::getDebugLoc(), llvm::IRBuilderBase::getInt64(), llvm::BasicBlock::getParent(), llvm::Function::getSubprogram(), llvm::Instruction::setDebugLoc(), and Size.
Referenced by llvm::InlineFunction().
|
static |
When we inline a basic block into an invoke, we have to turn all of the calls that can throw into invokes.
This function analyze BB to see if there are any calls, and if so, it rewrites them to be invokes that jump to InvokeDest and fills in the PHI nodes in that block with the values specified in InvokeDestPHIValues.
Definition at line 543 of file InlineFunction.cpp.
References assert(), llvm::changeToInvokeAndSplitBasicBlock(), llvm::CallBase::doesNotThrow(), F, llvm::CallBase::getCalledFunction(), llvm::CallBase::getOperandBundle(), getUnwindDestToken(), I, llvm::make_early_inc_range(), and llvm::LLVMContext::OB_funclet.
Referenced by HandleInlinedEHPad(), and HandleInlinedLandingPad().
|
static |
If we inlined an invoke site, we need to convert calls in the body of the inlined function into invokes.
II is the invoke instruction being inlined. FirstNewBlock is the first block of the inlined code (the last block is the end of the function), and InlineCodeInfo is information about the code that got inlined.
Definition at line 659 of file InlineFunction.cpp.
References assert(), llvm::BasicBlock::begin(), llvm::ClonedCodeInfo::ContainsCalls, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::count(), llvm::CleanupReturnInst::Create(), llvm::CatchSwitchInst::Create(), llvm::ConstantTokenNone::get(), llvm::BasicBlock::getFirstNonPHI(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::Value::getName(), llvm::BasicBlock::getParent(), getUnwindDestToken(), HandleCallsInBlockInlinedThroughInvoke(), I, II, llvm::Instruction::isEHPad(), llvm_unreachable, PHI, llvm::BasicBlock::phis(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::BasicBlock::removePredecessor(), llvm::Value::takeName(), and UpdatePHINodes().
Referenced by llvm::InlineFunction().
|
static |
If we inlined an invoke site, we need to convert calls in the body of the inlined function into invokes.
II is the invoke instruction being inlined. FirstNewBlock is the first block of the inlined code (the last block is the end of the function), and InlineCodeInfo is information about the code that got inlined.
Definition at line 602 of file InlineFunction.cpp.
References llvm::ClonedCodeInfo::ContainsCalls, llvm::LandingPadInst::getClause(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::LandingPadInst::getNumClauses(), llvm::BasicBlock::getParent(), HandleCallsInBlockInlinedThroughInvoke(), I, II, llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::LandingPadInst::isCleanup(), and llvm::BasicBlock::removePredecessor().
Referenced by llvm::InlineFunction().
|
static |
Definition at line 1699 of file InlineFunction.cpp.
References llvm::Type::getContext(), llvm::Type::getPointerAddressSpace(), llvm::AllocaInst::getType(), isUsedByLifetimeMarker(), and llvm::Value::users().
Referenced by llvm::InlineFunction().
Definition at line 782 of file InlineFunction.cpp.
References assert(), llvm::MDNode::getNumOperands(), llvm::MDNode::op_begin(), and llvm::MDNode::op_end().
Referenced by propagateMemProfHelper().
|
static |
Definition at line 1447 of file InlineFunction.cpp.
References llvm::AttrBuilder::addAlignmentAttr(), llvm::AttrBuilder::addAttribute(), llvm::AttrBuilder::addRangeAttr(), llvm::Value::getContext(), llvm::CallBase::getRange(), llvm::CallBase::getRetAlign(), llvm::CallBase::hasRetAttr(), and Range.
Referenced by AddReturnAttributes().
|
static |
Definition at line 1432 of file InlineFunction.cpp.
References llvm::AttrBuilder::addAttribute(), llvm::AttrBuilder::addDereferenceableAttr(), llvm::AttrBuilder::addDereferenceableOrNullAttr(), llvm::Value::getContext(), llvm::CallBase::getRetDereferenceableBytes(), llvm::CallBase::getRetDereferenceableOrNullBytes(), and llvm::CallBase::hasRetAttr().
Referenced by AddReturnAttributes().
|
static |
Returns a DebugLoc for a new DILocation which is a clone of OrigDL
inlined at InlinedAt
.
IANodes
is an inlined-at cache.
Definition at line 1725 of file InlineFunction.cpp.
References llvm::DebugLoc::appendInlinedAt(), llvm::DebugLoc::getCol(), llvm::DebugLoc::getLine(), and llvm::DebugLoc::getScope().
Referenced by fixupLineNumbers().
|
static |
An operand bundle "clang.arc.attachedcall" on a call indicates the call result is implicitly consumed by a call to retainRV or claimRV immediately after the call.
This function inlines the retainRV/claimRV calls.
There are three cases to consider:
Definition at line 2043 of file InlineFunction.cpp.
References llvm::CallBase::addOperandBundle(), assert(), llvm::IRBuilderBase::CreateCall(), llvm::objcarc::getAttachedARCFunction(), llvm::Value::getContext(), llvm::Intrinsic::getDeclaration(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::Instruction::getModule(), llvm::User::getOperand(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), llvm::objcarc::GetRCIdentityRoot(), llvm::objcarc::hasAttachedCallOpBundle(), I, II, llvm::objcarc::isRetainOrClaimRV(), llvm::make_early_inc_range(), llvm::make_range(), Mod, llvm::LLVMContext::OB_clang_arc_attachedcall, and llvm::IRBuilderBase::SetInsertPoint().
Referenced by llvm::InlineFunction().
Definition at line 1689 of file InlineFunction.cpp.
References II.
Referenced by hasLifetimeMarkers().
|
static |
Definition at line 1338 of file InlineFunction.cpp.
References assert(), End, llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), InlinerAttributeWindow, and llvm::isGuaranteedToTransferExecutionToSuccessor().
Referenced by AddReturnAttributes().
|
static |
When inlining a call site that has !llvm.mem.parallel_loop_access, !llvm.access.group, !alias.scope or !noalias metadata, that metadata should be propagated to all memory-accessing cloned instructions.
Definition at line 916 of file InlineFunction.cpp.
References llvm::MDNode::concatenate(), llvm::Instruction::getMetadata(), I, llvm::make_range(), and llvm::uniteAccessGroups().
Referenced by llvm::InlineFunction().
|
static |
Definition at line 830 of file InlineFunction.cpp.
References assert(), llvm::MDNode::concatenate(), llvm::Instruction::getMetadata(), llvm::memprof::getMIBStackNode(), llvm::MDNode::getNumOperands(), haveCommonPrefix(), llvm::MDNode::operands(), removeCallsiteMetadata(), removeMemProfMetadata(), llvm::Instruction::setMetadata(), and updateMemprofMetadata().
Referenced by propagateMemProfMetadata().
|
static |
Definition at line 884 of file InlineFunction.cpp.
References llvm::Instruction::getMetadata(), propagateMemProfHelper(), removeCallsiteMetadata(), and removeMemProfMetadata().
Referenced by llvm::InlineFunction().
|
static |
Bundle operands of the inlined function must be added to inlined call sites.
Definition at line 957 of file InlineFunction.cpp.
References llvm::CallBase::Create(), llvm::SmallVectorImpl< T >::emplace_back(), I, II, llvm::make_early_inc_range(), llvm::IntrinsicInst::mayLowerToFunctionCall(), llvm::LLVMContext::OB_funclet, and llvm::Value::takeName().
Referenced by llvm::InlineFunction().
|
static |
Definition at line 807 of file InlineFunction.cpp.
Referenced by propagateMemProfHelper(), propagateMemProfMetadata(), and updateMemprofMetadata().
|
static |
Definition at line 803 of file InlineFunction.cpp.
Referenced by propagateMemProfHelper(), propagateMemProfMetadata(), and updateMemprofMetadata().
|
static |
Definition at line 1894 of file InlineFunction.cpp.
References collectEscapedLocals(), DL, End, llvm::errs(), llvm::CallBase::getCalledFunction(), llvm::Instruction::getDataLayout(), llvm::Value::getName(), LLVM_DEBUG, and llvm::at::trackAssignments().
Referenced by llvm::InlineFunction().
|
static |
Update the block frequencies of the caller after a callee has been inlined.
Each block cloned into the caller has its block frequency scaled by the ratio of CallSiteFreq/CalleeEntryFreq. This ensures that the cloned copy of callee's entry block gets the same frequency as the callsite block and the relative frequencies of all cloned blocks remain the same after cloning.
Definition at line 1924 of file InlineFunction.cpp.
References llvm::BlockFrequencyInfo::getBlockFreq(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::ValueMap< KeyT, ValueT, Config >::lookup(), llvm::BlockFrequencyInfo::setBlockFreq(), and llvm::BlockFrequencyInfo::setBlockFreqAndScale().
Referenced by llvm::InlineFunction().
|
static |
Update the branch metadata for cloned call instructions.
Definition at line 1952 of file InlineFunction.cpp.
References llvm::Function::ProfileCount::getCount(), llvm::ProfileSummaryInfo::getProfileCount(), llvm::Function::ProfileCount::isSynthetic(), and llvm::updateProfileCallee().
Referenced by llvm::InlineFunction().
|
static |
Definition at line 811 of file InlineFunction.cpp.
References assert(), llvm::Instruction::hasMetadata(), removeCallsiteMetadata(), and removeMemProfMetadata().
Referenced by propagateMemProfHelper().
|
static |
Referenced by AddAliasScopeMetadata().
|
static |
Referenced by MayContainThrowingOrExitingCallAfterCB().
|
static |
Referenced by AddAlignmentAssumptions().
|
static |
Referenced by AddAliasScopeMetadata().