51#define DEBUG_TYPE "pre-isel-intrinsic-lowering"
57 "mem-intrinsic-expand-size",
64 "bounded-memset-inline-size",
65 cl::desc(
"Set maximum bound of a variable-length memset to expand inline"),
70struct PreISelIntrinsicLowering {
80 const bool UseMemIntrinsicLibFunc;
82 explicit PreISelIntrinsicLowering(
88 bool UseMemIntrinsicLibFunc_ =
true)
89 : TM(TM_), ModuleLibcalls(ModuleLibcalls_), LookupTTI(LookupTTI_),
90 LookupTLI(LookupTLI_), LookupAC(LookupAC_),
91 UseMemIntrinsicLibFunc(UseMemIntrinsicLibFunc_) {}
93 static bool shouldExpandMemIntrinsicWithSize(
Value *
Size,
94 const TargetTransformInfo &
TTI);
95 bool tryExpandBoundedMemSet(MemSetInst *Memset,
96 const TargetTransformInfo &
TTI)
const;
99 DenseMap<Constant *, GlobalVariable *> &CMap)
const;
100 bool lowerIntrinsics(
Module &M)
const;
111 Use *LastUse =
nullptr;
113 while (!Intrin.
use_empty() && (!LastUse || LastUse->getNext())) {
114 Use *U = LastUse ? LastUse->getNext() : &*Intrin.
use_begin();
115 bool Removed =
false;
119 Changed |= Removed = Callback(CI);
135 if (!CI || CI->getCalledOperand() != &
F)
139 Value *Ptr = CI->getArgOperand(0);
140 Value *OffsetPtr =
B.CreatePtrAddWithSExtOrTrunc(Ptr, CI->getArgOperand(1));
141 Value *OffsetI32 =
B.CreateAlignedLoad(Int32Ty, OffsetPtr,
Align(4));
143 Value *ResultPtr =
B.CreatePtrAddWithSExtOrTrunc(Ptr, OffsetI32);
145 CI->replaceAllUsesWith(ResultPtr);
146 CI->eraseFromParent();
167 Result = Builder.getFalse();
189 "Pre-ISel intrinsics do lower into regular function calls");
201 M->getOrInsertFunction(NewFnName,
F.getFunctionType());
204 Fn->setLinkage(
F.getLinkage());
208 Fn->addFnAttr(Attribute::NonLazyBind);
217 if (CB->getCalledFunction() != &
F) {
219 "use expected to be the argument of operand bundle "
220 "\"clang.arc.attachedcall\"");
226 assert(CI->getCalledFunction() &&
"Cannot lower an indirect call!");
231 CI->getOperandBundlesAsDefs(BundleList);
232 CallInst *NewCI = Builder.CreateCall(FCache, Args, BundleList);
250 if (
F.getAttributes().hasAttrSomewhere(Attribute::Returned, &Index) &&
252 NewCI->
addParamAttr(Index - AttributeList::FirstArgIndex,
253 Attribute::Returned);
255 if (!CI->use_empty())
256 CI->replaceAllUsesWith(NewCI);
257 CI->eraseFromParent();
265bool PreISelIntrinsicLowering::shouldExpandMemIntrinsicWithSize(
277 return SizeVal > Threshold || Threshold == 0;
286 return Lowering.getLibcallImpl(LC) != RTLIB::Unsupported;
294 return Lowering.getMemcpyImpl() != RTLIB::Unsupported;
299bool PreISelIntrinsicLowering::tryExpandBoundedMemSet(
300 MemSetInst *Memset,
const TargetTransformInfo &
TTI)
const {
319 SQ.AC = &LookupAC(*
F);
327 if (RangeAttr.isValid())
352 Type *VTy =
V->getType();
355 if (!RTLCI.
isAvailable(RTLIB::impl_memset_pattern16))
371 if (
DL.isBigEndian())
394bool PreISelIntrinsicLowering::expandMemIntrinsicUses(
395 Function &
F, DenseMap<Constant *, GlobalVariable *> &CMap)
const {
403 case Intrinsic::memcpy: {
405 Function *ParentFunc = Memcpy->getFunction();
406 const TargetTransformInfo &
TTI = LookupTTI(*ParentFunc);
407 if (shouldExpandMemIntrinsicWithSize(Memcpy->getLength(),
TTI)) {
408 if (UseMemIntrinsicLibFunc &&
415 Memcpy->eraseFromParent();
420 case Intrinsic::memcpy_inline: {
429 const TargetTransformInfo &
TTI = LookupTTI(*ParentFunc);
432 Memcpy->eraseFromParent();
435 case Intrinsic::memmove: {
438 const TargetTransformInfo &
TTI = LookupTTI(*ParentFunc);
439 if (shouldExpandMemIntrinsicWithSize(Memmove->getLength(),
TTI)) {
440 if (UseMemIntrinsicLibFunc &&
446 Memmove->eraseFromParent();
452 case Intrinsic::memset: {
455 const TargetTransformInfo &
TTI = LookupTTI(*ParentFunc);
456 if (tryExpandBoundedMemSet(Memset,
TTI)) {
461 if (shouldExpandMemIntrinsicWithSize(Memset->
getLength(),
TTI)) {
462 if (UseMemIntrinsicLibFunc &&
473 case Intrinsic::memset_inline: {
482 const TargetTransformInfo &
TTI = LookupTTI(*ParentFunc);
488 case Intrinsic::experimental_memset_pattern: {
491 const RTLIB::RuntimeLibcallsInfo &RTLCI =
497 const TargetTransformInfo &
TTI = LookupTTI(*ParentFunc);
517 "Should have skipped if non-zero AS");
519 auto It = CMap.
find(PatternValue);
520 if (It != CMap.
end()) {
523 GV =
new GlobalVariable(
524 *M, PatternValue->
getType(),
true,
527 GlobalValue::UnnamedAddr::Global);
530 CMap[PatternValue] = GV;
532 Value *PatternPtr = GV;
533 Value *NumBytes = Builder.CreateMul(
534 ConstantInt::get(SizeTTy,
536 Builder.CreateZExtOrTrunc(Memset->
getLength(), SizeTTy));
537 CallInst *MemsetPattern16Call =
538 Builder.CreateCall(MSP, {Memset->
getRawDest(), PatternPtr, NumBytes});
578 Intr.
getIntrinsicID() == Intrinsic::ptrauth_auth ?
"__emupac_autda"
586 !
Key ||
Key->getZExtValue() != 2)
590 Attribute FSAttr =
F->getFnAttribute(
"target-features");
594 std::vector<OperandBundleDef> DSBundle;
599 auto *EmuCall =
B.CreateCall(
600 EmuIntr, {
Call->getArgOperand(0),
Call->getArgOperand(2)}, DSBundle);
601 Call->replaceAllUsesWith(EmuCall);
602 Call->eraseFromParent();
619 auto *Pointer =
Call->getArgOperand(0);
633 if (
Op->isNullValue()) {
639 if (
Op->isNullValue()) {
654 DSsToDeactivate.
insert(DS);
657 Call->eraseFromParent();
660 if (!DSsToDeactivate.
empty()) {
671 OldDS->replaceAllUsesWith(DS);
672 OldDS->eraseFromParent();
686 Br->setSuccessor(Br->getParent());
687 Call->eraseFromParent();
695 if (!
Call->getParent()->isEntryBlock() &&
697 [](
Instruction &
I) { return !I.mayHaveSideEffects(); })) {
712 if (BI->getSuccessor(0) ==
Call->getParent()) {
714 Cond = BI->getCondition();
719 Cond =
B.CreateNot(BI->getCondition());
722 B.CreateIntrinsic(Intrinsic::cond_loop,
Cond);
726 B.CreateIntrinsic(Intrinsic::cond_loop,
728 Call->eraseFromParent();
733bool PreISelIntrinsicLowering::lowerIntrinsics(
Module &M)
const {
735 DenseMap<Constant *, GlobalVariable *> CMap;
738 switch (
F.getIntrinsicID()) {
741 case Intrinsic::memcpy:
742 case Intrinsic::memcpy_inline:
743 case Intrinsic::memmove:
744 case Intrinsic::memset:
745 case Intrinsic::memset_inline:
746 case Intrinsic::experimental_memset_pattern:
747 Changed |= expandMemIntrinsicUses(
F, CMap);
749 case Intrinsic::load_relative:
752 case Intrinsic::can_load_speculatively:
755 case Intrinsic::is_constant:
756 case Intrinsic::objectsize:
759 TargetLibraryInfo &
TLI = LookupTLI(*Parent);
765#define BEGIN_REGISTER_VP_INTRINSIC(VPID, MASKPOS, VLENPOS) \
766 case Intrinsic::VPID:
767#include "llvm/IR/VPIntrinsics.def"
770 const TargetTransformInfo &
TTI = LookupTTI(*Parent);
776 Changed |= ED != VPExpansionDetails::IntrinsicUnchanged;
777 bool Removed = ED == VPExpansionDetails::IntrinsicReplaced;
781 case Intrinsic::objc_autorelease:
784 case Intrinsic::objc_autoreleasePoolPop:
787 case Intrinsic::objc_autoreleasePoolPush:
790 case Intrinsic::objc_autoreleaseReturnValue:
793 case Intrinsic::objc_copyWeak:
796 case Intrinsic::objc_destroyWeak:
799 case Intrinsic::objc_initWeak:
802 case Intrinsic::objc_loadWeak:
805 case Intrinsic::objc_loadWeakRetained:
808 case Intrinsic::objc_moveWeak:
811 case Intrinsic::objc_release:
814 case Intrinsic::objc_retain:
817 case Intrinsic::objc_retainAutorelease:
820 case Intrinsic::objc_retainAutoreleaseReturnValue:
824 case Intrinsic::objc_retainAutoreleasedReturnValue:
828 case Intrinsic::objc_claimAutoreleasedReturnValue:
832 case Intrinsic::objc_retainBlock:
835 case Intrinsic::objc_storeStrong:
838 case Intrinsic::objc_storeWeak:
841 case Intrinsic::objc_unsafeClaimAutoreleasedReturnValue:
843 lowerObjCCall(
F, RTLIB::impl_objc_unsafeClaimAutoreleasedReturnValue);
845 case Intrinsic::objc_retainedObject:
848 case Intrinsic::objc_unretainedObject:
851 case Intrinsic::objc_unretainedPointer:
854 case Intrinsic::objc_retain_autorelease:
857 case Intrinsic::objc_sync_enter:
860 case Intrinsic::objc_sync_exit:
863 case Intrinsic::acos:
864 case Intrinsic::asin:
865 case Intrinsic::atan:
867 case Intrinsic::cosh:
869 case Intrinsic::exp2:
870 case Intrinsic::exp10:
872 case Intrinsic::log2:
873 case Intrinsic::log10:
875 case Intrinsic::sinh:
877 case Intrinsic::tanh:
890 case Intrinsic::modf:
891 case Intrinsic::sincos:
892 case Intrinsic::sincospi:
908 LC = RTLIB::getMODF(VT);
911 LC = RTLIB::getSINCOS(VT);
914 LC = RTLIB::getSINCOSPI(VT);
920 const LibcallLoweringInfo &Libcalls =
927 case Intrinsic::ptrauth_sign:
928 case Intrinsic::ptrauth_auth:
931 case Intrinsic::protected_field_ptr:
934 case Intrinsic::cond_loop:
938 case Intrinsic::looptrap:
941 if (
auto *CondLoop =
M.getFunction(
"llvm.cond.loop"))
951class PreISelIntrinsicLoweringLegacyPass :
public ModulePass {
955 PreISelIntrinsicLoweringLegacyPass() : ModulePass(
ID) {}
957 void getAnalysisUsage(AnalysisUsage &AU)
const override {
965 bool runOnModule(
Module &M)
override {
966 const ModuleLibcallLoweringInfo &ModuleLibcalls =
967 getAnalysis<LibcallLoweringInfoWrapper>().getResult(M);
969 auto LookupTTI = [
this](
Function &
F) -> TargetTransformInfo & {
970 return this->getAnalysis<TargetTransformInfoWrapperPass>().getTTI(
F);
972 auto LookupTLI = [
this](
Function &
F) -> TargetLibraryInfo & {
973 return this->getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(
F);
975 auto LookupAC = [
this](
Function &
F) -> AssumptionCache & {
976 return this->getAnalysis<AssumptionCacheTracker>().getAssumptionCache(
F);
979 const auto &TM = getAnalysis<TargetPassConfig>().getTM<TargetMachine>();
980 PreISelIntrinsicLowering
Lowering(TM, ModuleLibcalls, LookupTTI, LookupTLI,
988char PreISelIntrinsicLoweringLegacyPass::ID;
991 "pre-isel-intrinsic-lowering",
992 "Pre-ISel Intrinsic Lowering",
false,
false)
1000 "pre-isel-intrinsic-lowering",
1004 return new PreISelIntrinsicLoweringLegacyPass();
1024 PreISelIntrinsicLowering
Lowering(
TM, LibcallLowering, LookupTTI, LookupTLI,
const AArch64Subtarget & Subtarget
const TargetLowering & TLI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static bool setNonLazyBind(Function &F)
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
Module.h This file contains the declarations for the Module class.
This defines the Use class.
The header file for the LowerConstantIntrinsics pass as used by the new pass manager.
Machine Check Debug Module
This file defines ARC utility functions which are used by various parts of the compiler.
FunctionAnalysisManager FAM
ModuleAnalysisManager MAM
#define INITIALIZE_PASS_DEPENDENCY(depName)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
static cl::opt< int64_t > MemIntrinsicExpandSizeThresholdOpt("mem-intrinsic-expand-size", cl::desc("Set minimum mem intrinsic size to expand in IR"), cl::init(-1), cl::Hidden)
Threshold to leave statically sized memory intrinsic calls.
static bool lowerCanLoadSpeculatively(Function &F, const TargetMachine &TM)
Lower @llvm.can.load.speculatively using target-specific expansion.
static GlobalValue * getDeactivationSymbol(CallInst *Call)
static cl::opt< uint64_t > BoundedMemSetInlineSizeOpt("bounded-memset-inline-size", cl::desc("Set maximum bound of a variable-length memset to expand inline"), cl::Hidden)
Maximum bound of a memset with non-constant length for it to be expanded inline.
static bool canEmitMemcpy(const ModuleLibcallLoweringInfo &ModuleLowering, const TargetMachine &TM, Function *F)
static bool forEachCall(Function &Intrin, T Callback)
static bool expandLoopTrap(Function &Intr)
static bool expandCondLoop(Function &Intr)
static Constant * getMemSetPattern16Value(MemSetPatternInst *Inst, const RTLIB::RuntimeLibcallsInfo &RTLCI)
pre isel intrinsic Pre ISel Intrinsic Lowering
static bool canEmitLibcall(const ModuleLibcallLoweringInfo &ModuleLowering, const TargetMachine &TM, Function *F, RTLIB::Libcall LC)
static CallInst::TailCallKind getOverridingTailCallKind(const Function &F)
static bool expandPtrauthForEmuPAC(Function &Intr)
static bool expandProtectedFieldPtr(Function &Intr)
static bool lowerObjCCall(Function &F, RTLIB::LibcallImpl NewFn, bool setNonLazyBind=false)
static bool lowerLoadRelative(Function &F)
This file contains the declarations for profiling metadata utility functions.
SmallVector< MachineOperand, 4 > Cond
This file describes how to lower LLVM code to machine code.
Target-Independent Code Generator Pass Configuration Options pass.
const AArch64TargetLowering * getTargetLowering() const override
uint64_t getZExtValue() const
Get zero extended value.
bool ugt(const APInt &RHS) const
Unsigned greater than comparison.
AnalysisUsage & addRequired()
static LLVM_ABI ArrayType * get(Type *ElementType, uint64_t NumElements)
This static method is the primary way to construct an ArrayType.
A function analysis which provides an AssumptionCache.
An immutable pass that tracks lazily created AssumptionCache objects.
A cache of @llvm.assume calls within a function.
Functions, function parameters, and return types can have attributes to indicate how they should be t...
LLVM_ABI StringRef getValueAsString() const
Return the attribute's value as a string.
bool isValid() const
Return true if the attribute is any kind of attribute.
InstListType::iterator iterator
Instruction iterators...
void setCallingConv(CallingConv::ID CC)
Attribute getParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const
Get the attribute of a given kind from a given arg.
void setAttributes(AttributeList A)
Set the attributes for this call.
Value * getArgOperand(unsigned i) const
AttributeList getAttributes() const
Return the attributes for this call.
void addParamAttr(unsigned ArgNo, Attribute::AttrKind Kind)
Adds the attribute to the indicated argument.
This class represents a function call, abstracting a target machine's calling convention.
void setTailCallKind(TailCallKind TCK)
static LLVM_ABI Constant * get(ArrayType *T, ArrayRef< Constant * > V)
static LLVM_ABI Constant * getIntToPtr(Constant *C, Type *Ty, bool OnlyIfReduced=false)
static LLVM_ABI ConstantInt * getTrue(LLVMContext &Context)
static LLVM_ABI ConstantInt * getFalse(LLVMContext &Context)
uint64_t getZExtValue() const
Return the constant as a 64-bit unsigned integer value after it has been zero extended as appropriate...
LLVM_ABI APInt getUnsignedMin() const
Return the smallest unsigned value contained in the ConstantRange.
LLVM_ABI bool isEmptySet() const
Return true if this set contains no members.
LLVM_ABI APInt getUnsignedMax() const
Return the largest unsigned value contained in the ConstantRange.
LLVM_ABI ConstantRange intersectWith(const ConstantRange &CR, PreferredRangeType Type=Smallest) const
Return the range that results from the intersection of this range with another range.
This is an important base class in LLVM.
A parsed version of the target data layout string in and methods for querying it.
iterator find(const_arg_type_t< KeyT > Val)
A handy container for a FunctionType+Callee-pointer pair, which can be passed around as a single enti...
FunctionType * getFunctionType()
Type * getParamType(unsigned i) const
Parameter type accessors.
static LLVM_ABI FunctionType * get(Type *Result, ArrayRef< Type * > Params, bool isVarArg)
This static method is the primary way of constructing a FunctionType.
Intrinsic::ID getIntrinsicID() const LLVM_READONLY
getIntrinsicID - This method returns the ID number of the specified function, or Intrinsic::not_intri...
const Function & getFunction() const
static LLVM_ABI GlobalAlias * create(Type *Ty, unsigned AddressSpace, LinkageTypes Linkage, const Twine &Name, Constant *Aliasee, Module *Parent)
If a parent module is specified, the alias is automatically inserted into the end of the specified mo...
void setUnnamedAddr(UnnamedAddr Val)
Module * getParent()
Get the module that this global value is contained inside of...
@ HiddenVisibility
The GV is hidden.
@ PrivateLinkage
Like Internal, but omit from symbol table.
@ ExternalLinkage
Externally visible function.
void setAlignment(Align Align)
Sets the alignment attribute of the GlobalVariable.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
LLVM_ABI const Module * getModule() const
Return the module owning the function this instruction belongs to or nullptr it the function does not...
LLVM_ABI void setAAMetadata(const AAMDNodes &N)
Sets the AA metadata on this instruction from the AAMDNodes structure.
LLVM_ABI InstListType::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
LLVM_ABI const Function * getFunction() const
Return the function this instruction belongs to.
LLVM_ABI AAMDNodes getAAMetadata() const
Returns the AA metadata for this instruction.
LLVM_ABI const DataLayout & getDataLayout() const
Get the data layout of the module this instruction belongs to.
static LLVM_ABI bool mayLowerToFunctionCall(Intrinsic::ID IID)
Check if the intrinsic might lower into a regular function call in the course of IR transformations.
Tracks which library functions to use for a particular subtarget or function.
RTLIB::LibcallImpl getVectorLibcallImplOrMasked(RTLIB::Libcall Call) const
Return the implementation for Call, or for its masked variant if Call has no implementation.
Value * getLength() const
Value * getRawDest() const
const Use & getLengthUse() const
This class wraps the llvm.experimental.memset.pattern intrinsic.
Records a mapping from an opaque lowering context to its LibcallLoweringInfo.
const RTLIB::RuntimeLibcallsInfo & getRuntimeLibcallsInfo() const
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
A Module instance is used to store all the information related to an LLVM module.
static LLVM_ABI PointerType * get(LLVMContext &C, unsigned AddressSpace)
This constructs an opaque pointer to an object in a numbered address space.
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
bool contains(StringRef Other) const
Return true if the given string is a substring of *this, and false otherwise.
Analysis pass providing the TargetTransformInfo.
Analysis pass providing the TargetLibraryInfo.
Provides information about what library functions are available for the current target.
bool isOperationExpand(unsigned Op, EVT VT) const
Return true if the specified operation is illegal on this target or unlikely to be made legal with cu...
int IntrinsicIDToISD(Intrinsic::ID ID) const
Get the ISD node that corresponds to the Intrinsic ID.
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
Primary interface to the complete machine description for the target machine.
CodeGenOptLevel getOptLevel() const
Returns the optimization level: None, Less, Default, or Aggressive.
virtual const TargetSubtargetInfo * getSubtargetImpl(const Function &) const
Virtual method implemented by subclasses that returns a reference to that target's TargetSubtargetInf...
virtual bool canLowerCondLoop() const
Returns whether the backend can lower the llvm.cond.loop intrinsic.
Target-Independent Code Generator Pass Configuration Options.
virtual const TargetLowering * getTargetLowering() const
Triple - Helper class for working with autoconf configuration names.
bool isArm64e() const
Tests whether the target is the Apple "arm64e" AArch64 subarch.
The instances of the Type class are immutable: once they are created, they are never changed.
static LLVM_ABI IntegerType * getInt64Ty(LLVMContext &C)
static LLVM_ABI IntegerType * getInt32Ty(LLVMContext &C)
LLVM_ABI unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
static LLVM_ABI IntegerType * getInt8Ty(LLVMContext &C)
A Use represents the edge between a Value definition and its users.
LLVM_ABI unsigned getOperandNo() const
Return the operand # of this use in its User.
void setOperand(unsigned i, Value *Val)
Value * getOperand(unsigned i) const
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
LLVM_ABI void setName(const Twine &Name)
Change the name of the value.
LLVM_ABI void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
LLVMContext & getContext() const
All values hold a context through their type.
iterator_range< user_iterator > users()
An efficient, type-erasing, non-owning reference to a callable.
const ParentTy * getParent() const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
@ DELETED_NODE
DELETED_NODE - This is an illegal value that is used to catch errors.
@ FMODF
FMODF - Decomposes the operand into integral and fractional parts, each having the same type and sign...
@ FSINCOSPI
FSINCOSPI - Compute both the sine and cosine times pi more accurately than FSINCOS(pi*x),...
@ FSINCOS
FSINCOS - Compute both fsin and fcos as a single operation.
initializer< Ty > init(const Ty &Val)
LLVM_ABI bool IsNeverTail(ARCInstKind Class)
Test if the given class represents instructions which are never safe to mark with the "tail" keyword.
LLVM_ABI bool IsAlwaysTail(ARCInstKind Class)
Test if the given class represents instructions which are always safe to mark with the "tail" keyword...
ARCInstKind
Equivalence classes of instructions in the ARC Model.
LLVM_ABI ARCInstKind GetFunctionClass(const Function *F)
Determine if F is one of the special known Functions.
std::optional< Function * > getAttachedARCFunction(const CallBase *CB)
This function returns operand bundle clang_arc_attachedcall's argument, which is the address of the A...
friend class Instruction
Iterator for Instructions in a `BasicBlock.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI bool lowerUnaryVectorIntrinsicAsLoop(Module &M, CallInst *CI)
Lower CI as a loop.
@ Known
Known to have no common set bits.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
LLVM_ABI bool lowerConstantIntrinsics(Function &F, const TargetLibraryInfo &TLI, DominatorTree *DT)
LLVM_ABI bool expandMemMoveAsLoop(MemMoveInst *MemMove, const TargetTransformInfo &TTI)
Expand MemMove as a loop.
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
LLVM_ABI void computeKnownBits(const Value *V, KnownBits &Known, const DataLayout &DL, AssumptionCache *AC=nullptr, const Instruction *CtxI=nullptr, const DominatorTree *DT=nullptr, bool UseInstrInfo=true, unsigned Depth=0)
Determine which bits of V are known to be either zero or one and return them in the KnownZero/KnownOn...
InnerAnalysisManagerProxy< FunctionAnalysisManager, Module > FunctionAnalysisManagerModuleProxy
Provide the FunctionAnalysisManager to Module proxy.
constexpr bool isPowerOf2_64(uint64_t Value)
Return true if the argument is a power of two > 0 (64 bit edition.)
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Value
LLVM_ABI ModulePass * createPreISelIntrinsicLoweringPass()
This pass lowers the @llvm.load.relative and @llvm.objc.
LLVM_ABI const LibcallLoweringInfo & getLibcallLowering(const ModuleLibcallLoweringInfo &ModuleInfo, const TargetSubtargetInfo &Subtarget)
Resolve the LibcallLoweringInfo for Subtarget from the module-level ModuleInfo, applying the subtarge...
IRBuilder(LLVMContext &, FolderTy, InserterTy) -> IRBuilder< FolderTy, InserterTy >
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
LLVM_ABI MDNode * getExplicitlyUnknownBranchWeightsIfProfiled(Function &F, StringRef PassName)
Returns a metadata node containing unknown branch weights if the function has an entry count,...
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key
LLVM_ABI VPExpansionDetails expandVectorPredicationIntrinsic(VPIntrinsic &VPI, const TargetTransformInfo &TTI)
Expand a vector predication intrinsic.
OperandBundleDefT< Value * > OperandBundleDef
LLVM_ABI ConstantRange computeConstantRangeIncludingKnownBits(const WithCache< const Value * > &V, bool ForSigned, const SimplifyQuery &SQ)
Combine constant ranges from computeConstantRange() and computeKnownBits().
DWARFExpression::Operation Op
LLVM_ABI void expandBoundedMemSet(MemSetInst *MemSet, uint64_t MinLen, uint64_t MaxLen, const KnownBits &LenKnown)
Expand MemSet, whose length is known to be in [MinLen, MaxLen] and to have the known bits LenKnown,...
LLVM_ABI void expandMemSetAsLoop(MemSetInst *MemSet, const TargetTransformInfo *TTI=nullptr)
Expand MemSet as a loop.
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
LLVM_ABI void expandMemSetPatternAsLoop(MemSetPatternInst *MemSet, const TargetTransformInfo *TTI=nullptr)
Expand MemSetPattern as a loop.
auto predecessors(const MachineBasicBlock *BB)
LLVM_ABI void expandMemCpyAsLoop(MemCpyInst *MemCpy, const TargetTransformInfo &TTI, ScalarEvolution *SE=nullptr)
Expand MemCpy as a loop. MemCpy is not deleted.
LLVM_ABI Instruction * SplitBlockAndInsertIfThen(Value *Cond, BasicBlock::iterator SplitBefore, bool Unreachable, MDNode *BranchWeights=nullptr, DomTreeUpdater *DTU=nullptr, LoopInfo *LI=nullptr, BasicBlock *ThenBlock=nullptr)
Split the containing block at the specified instruction - everything before SplitBefore stays in the ...
VPExpansionDetails
Represents the details the expansion of a VP intrinsic.
AnalysisManager< Module > ModuleAnalysisManager
Convenience typedef for the Module analysis manager.
LLVM_ABI void reportFatalUsageError(Error Err)
Report a fatal error that does not indicate a bug in LLVM.
This struct is a compact representation of a valid (non-zero power of two) alignment.
static LLVM_ABI EVT getEVT(Type *Ty, bool HandleUnknown=false)
Return the value type corresponding to the specified type.
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
A simple container for information about the supported runtime calls.
LLVM_ABI FunctionCallee getOrInsertLibcallDecl(Module &M, RTLIB::LibcallImpl LibcallImpl) const
CallingConv::ID getLibcallImplCallingConv(RTLIB::LibcallImpl Call) const
Get the CallingConv that should be used for the specified libcall.
bool isAvailable(RTLIB::LibcallImpl Impl) const
static StringRef getLibcallImplName(RTLIB::LibcallImpl CallImpl)
Get the libcall routine name for the specified libcall implementation.