1//===- StackProtector.cpp - Stack Protector Insertion ---------------------===// 3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4// See https://llvm.org/LICENSE.txt for license information. 5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7//===----------------------------------------------------------------------===// 9// This pass inserts stack protectors into functions which need them. A variable 10// with a random value in it is stored onto the stack before the local variables 11// are allocated. Upon exiting the block, the stored value is checked. If it's 12// changed, then there was some sort of violation and the program aborts. 14//===----------------------------------------------------------------------===// 56#define DEBUG_TYPE "stack-protector" 58STATISTIC(NumFunProtected,
"Number of functions protected");
59STATISTIC(NumAddrTaken,
"Number of local variables that have their address" 67/// InsertStackProtectors - Insert code into the prologue and epilogue of the 70/// - The prologue code loads and stores the stack guard onto the stack. 71/// - The epilogue checks the value stored in the prologue against the original 72/// value. It calls __stack_chk_fail if they differ. 77/// CreateFailBB - Create a basic block to jump to when the stack protector 82return HasPrologue && !HasIRCheck && isa<ReturnInst>(BB.
getTerminator());
98if (LI == Layout.
end())
109Info.RequireStackProtector =
111Info.SSPBufferSize =
F.getFnAttributeAsParsedInteger(
112"stack-protector-buffer-size", SSPLayoutInfo::DefaultSSPBufferSize);
124if (!
Info.RequireStackProtector)
127// TODO(etienneb): Functions with funclets are not correctly supported now. 128// Do nothing if this is funclet-based personality. 129if (
F.hasPersonalityFn()) {
138#ifdef EXPENSIVE_CHECKS 139assert((!DT || DT->
verify(DominatorTree::VerificationLevel::Full)) &&
140"Failed to maintain validity of domtree!");
158"Insert stack protectors",
false,
true)
174if (
auto *DTWP = getAnalysisIfAvailable<DominatorTreeWrapperPass>())
175 DTU.emplace(DTWP->getDomTree(), DomTreeUpdater::UpdateStrategy::Lazy);
176 TM = &getAnalysis<TargetPassConfig>().getTM<
TargetMachine>();
177 LayoutInfo.HasPrologue =
false;
178 LayoutInfo.HasIRCheck =
false;
181"stack-protector-buffer-size", SSPLayoutInfo::DefaultSSPBufferSize);
185// TODO(etienneb): Functions with funclets are not correctly supported now. 186// Do nothing if this is funclet-based personality. 196 LayoutInfo.HasPrologue, LayoutInfo.HasIRCheck);
197#ifdef EXPENSIVE_CHECKS 199 DTU->getDomTree().verify(DominatorTree::VerificationLevel::Full)) &&
200"Failed to maintain validity of domtree!");
206/// \param [out] IsLarge is set to true if a protectable array is found and 207/// it is "large" ( >= ssp-buffer-size). In the case of a structure with 208/// multiple arrays, this gets set if any of them is large. 210bool &IsLarge,
bool Strong,
214if (
ArrayType *AT = dyn_cast<ArrayType>(Ty)) {
215if (!AT->getElementType()->isIntegerTy(8)) {
216// If we're on a non-Darwin platform or we're inside of a structure, don't 217// add stack protectors unless the array is a character array. 218// However, in strong mode any array, regardless of type and size, 219// triggers a protector. 224// If an array has more than SSPBufferSize bytes of allocated space, then we 225// emit stack protectors. 226if (SSPBufferSize <= M->getDataLayout().getTypeAllocSize(AT)) {
232// Require a protector for all arrays in strong mode 236constStructType *ST = dyn_cast<StructType>(Ty);
240bool NeedsProtector =
false;
241for (
Type *ET : ST->elements())
243// If the element is a protectable array and is large (>= SSPBufferSize) 244// then we are done. If the protectable array is not large, then 245// keep looking in case a subsequent element is a large array. 248 NeedsProtector =
true;
251return NeedsProtector;
254/// Check whether a stack allocation has its address taken. 260constauto *
I = cast<Instruction>(U);
261// If this instruction accesses memory make sure it doesn't access beyond 262// the bounds of the allocated object. 264if (MemLoc && MemLoc->Size.hasValue() &&
267switch (
I->getOpcode()) {
268case Instruction::Store:
269if (AI == cast<StoreInst>(
I)->getValueOperand())
272case Instruction::AtomicCmpXchg:
273// cmpxchg conceptually includes both a load and store from the same 274// location. So, like store, the value being stored is what matters. 275if (AI == cast<AtomicCmpXchgInst>(
I)->getNewValOperand())
278case Instruction::PtrToInt:
279if (AI == cast<PtrToIntInst>(
I)->getOperand(0))
282case Instruction::Call: {
283// Ignore intrinsics that do not become real instructions. 284// TODO: Narrow this to intrinsics that have store-like effects. 285constauto *CI = cast<CallInst>(
I);
286if (!CI->isDebugOrPseudoInst() && !CI->isLifetimeStartOrEnd())
290case Instruction::Invoke:
292case Instruction::GetElementPtr: {
293// If the GEP offset is out-of-bounds, or is non-constant and so has to be 294// assumed to be potentially out-of-bounds, then any memory access that 295// would use it could also be out-of-bounds meaning stack protection is 298unsigned IndexSize =
DL.getIndexTypeSizeInBits(
I->getType());
305// Adjust AllocSize to be the space remaining after this offset. 306// We can't subtract a fixed size from a scalable one, so in that case 307// assume the scalable value is of minimum size. 314case Instruction::BitCast:
315case Instruction::Select:
316case Instruction::AddrSpaceCast:
320case Instruction::PHI: {
321// Keep track of what PHI nodes we have already visited to ensure 322// they are only visited once. 323constauto *PN = cast<PHINode>(
I);
324if (VisitedPHIs.
insert(PN).second)
329case Instruction::Load:
330case Instruction::AtomicRMW:
331case Instruction::Ret:
332// These instructions take an address operand, but have load-like or 333// other innocuous behavior that should not trigger a stack protector. 334// atomicrmw conceptually has both load and store semantics, but the 335// value being stored must be integer; so if a pointer is being stored, 336// we'll catch it in the PtrToInt case above. 339// Conservatively return true for any instruction that takes an address 340// operand, but is not handled above. 347/// Search for the first call to the llvm.stackprotector intrinsic and return it 352if (
constauto *
II = dyn_cast<IntrinsicInst>(&
I))
353if (
II->getIntrinsicID() == Intrinsic::stackprotector)
358/// Check whether or not this function needs a stack protector based 359/// upon the stack protector level. 361/// We use two heuristics: a standard (ssp) and strong (sspstrong). 362/// The standard heuristic which will add a guard variable to functions that 363/// call alloca with a either a variable size or a size >= SSPBufferSize, 364/// functions with character buffers larger than SSPBufferSize, and functions 365/// with aggregates containing character buffers larger than SSPBufferSize. The 366/// strong heuristic will add a guard variables to functions that call alloca 367/// regardless of size, functions with any buffer regardless of type and size, 368/// functions with aggregates that contain any buffer regardless of type and 369/// size, and functions that contain stack-based variables that have had their 375bool NeedsProtector =
false;
377// The set of PHI nodes visited when determining if a variable's reference has 378// been taken. This set is maintained to ensure we don't visit the same PHI 379// node multiple times. 382unsigned SSPBufferSize =
F->getFnAttributeAsParsedInteger(
383"stack-protector-buffer-size", SSPLayoutInfo::DefaultSSPBufferSize);
385if (
F->hasFnAttribute(Attribute::SafeStack))
388// We are constructing the OptimizationRemarkEmitter on the fly rather than 389// using the analysis pass to avoid building DominatorTree and LoopInfo which 390// are not available this late in the IR pipeline. 393if (
F->hasFnAttribute(Attribute::StackProtectReq)) {
398 <<
"Stack protection applied to function " 400 <<
" due to a function attribute or command-line switch";
402 NeedsProtector =
true;
403 Strong =
true;
// Use the same heuristic as strong to determine SSPLayout 404 }
elseif (
F->hasFnAttribute(Attribute::StackProtectStrong))
406elseif (!
F->hasFnAttribute(Attribute::StackProtect))
411if (
constAllocaInst *AI = dyn_cast<AllocaInst>(&
I)) {
412if (AI->isArrayAllocation()) {
413auto RemarkBuilder = [&]() {
416 <<
"Stack protection applied to function " 418 <<
" due to a call to alloca or use of a variable length " 421if (
constauto *CI = dyn_cast<ConstantInt>(AI->getArraySize())) {
422if (CI->getLimitedValue(SSPBufferSize) >= SSPBufferSize) {
423// A call to alloca with size >= SSPBufferSize requires 429 ORE.
emit(RemarkBuilder);
430 NeedsProtector =
true;
432// Require protectors for all alloca calls in strong mode. 437 ORE.
emit(RemarkBuilder);
438 NeedsProtector =
true;
441// A call to alloca with a variable size requires protectors. 446 ORE.
emit(RemarkBuilder);
447 NeedsProtector =
true;
454 IsLarge, Strong,
false)) {
457 Layout->
insert(std::make_pair(
462 <<
"Stack protection applied to function " 464 <<
" due to a stack allocated buffer or struct containing a " 467 NeedsProtector =
true;
473 AI, M->getDataLayout().getTypeAllocSize(AI->getAllocatedType()),
482 <<
"Stack protection applied to function " 484 <<
" due to the address of a local variable being taken";
486 NeedsProtector =
true;
488// Clear any PHIs that we visited, to make sure we examine all uses of 489// any subsequent allocas that we look at. 495return NeedsProtector;
498/// Create a stack guard loading and populate whether SelectionDAG SSP is 502bool *SupportsSelectionDAGSP =
nullptr) {
504StringRef GuardMode = M->getStackProtectorGuard();
505if ((GuardMode ==
"tls" || GuardMode.
empty()) && Guard)
506returnB.CreateLoad(
B.getPtrTy(), Guard,
true,
"StackGuard");
508// Use SelectionDAG SSP handling, since there isn't an IR guard. 510// This is more or less weird, since we optionally output whether we 511// should perform a SelectionDAG SP here. The reason is that it's strictly 512// defined as !TLI->getIRStackGuard(B), where getIRStackGuard is also 513// mutating. There is no way to get this bit without mutating the IR, so 514// getting this bit has to happen in this right time. 516// We could have define a new function TLI::supportsSelectionDAGSP(), but that 517// will put more burden on the backends' overriding work, especially when it 518// actually conveys the same information getIRStackGuard() already gives. 519if (SupportsSelectionDAGSP)
520 *SupportsSelectionDAGSP =
true;
522returnB.CreateIntrinsic(Intrinsic::stackguard, {}, {});
525/// Insert code into the entry block that stores the stack guard 526/// variable onto the stack: 529/// StackGuardSlot = alloca i8* 530/// StackGuard = <stack guard> 531/// call void @llvm.stackprotector(StackGuard, StackGuardSlot) 533/// Returns true if the platform/triple supports the stackprotectorcreate pseudo 537bool SupportsSelectionDAGSP =
false;
540 AI =
B.CreateAlloca(PtrTy,
nullptr,
"StackGuardSlot");
543B.CreateIntrinsic(Intrinsic::stackprotector, {}, {GuardSlot, AI});
544return SupportsSelectionDAGSP;
550auto *M =
F->getParent();
551auto *TLI = TM->getSubtargetImpl(*F)->getTargetLowering();
553// If the target wants to XOR the frame pointer into the guard value, it's 554// impossible to emit the check in IR, so the target *must* support stack 555// protection in SDAG. 556bool SupportsSelectionDAGSP =
557 TLI->useStackGuardXorFP() ||
559AllocaInst *AI =
nullptr;
// Place on stack that stores the stack guard. 563// This is stack protector auto generated check BB, skip it. 566Instruction *CheckLoc = dyn_cast<ReturnInst>(BB.getTerminator());
569if (
auto *CB = dyn_cast<CallBase>(&Inst))
570// Do stack check before noreturn calls that aren't nounwind (e.g: 572if (CB->doesNotReturn() && !CB->doesNotThrow()) {
580// Generate prologue instrumentation if not already generated. 586// SelectionDAG based code generation. Nothing else needs to be done here. 587// The epilogue instrumentation is postponed to SelectionDAG. 588if (SupportsSelectionDAGSP)
591// Find the stack guard slot if the prologue was not created by this pass 592// itself via a previous call to CreatePrologue(). 595assert(SPCall &&
"Call to llvm.stackprotector is missing");
599// Set HasIRCheck to true, so that SelectionDAG will not generate its own 600// version. SelectionDAG called 'shouldEmitSDCheck' to check whether 601// instrumentation has already been generated. 604// If we're instrumenting a block with a tail call, the check has to be 605// inserted before the call rather than between it and the return. The 606// verifier guarantees that a tail call is either directly before the 607// return or with a single correct bitcast of the return value in between so 608// we don't need to worry about many situations here. 610if (Prev && isa<CallInst>(Prev) && cast<CallInst>(Prev)->isTailCall())
614if (Prev && isa<CallInst>(Prev) && cast<CallInst>(Prev)->isTailCall())
618// Generate epilogue instrumentation. The epilogue intrumentation can be 619// function-based or inlined depending on which mechanism the target is 621if (
Function *GuardCheck = TLI->getSSPStackGuardCheck(*M)) {
622// Generate the function-based epilogue instrumentation. 623// The target provides a guard check function, generate a call to it. 625LoadInst *Guard =
B.CreateLoad(
B.getPtrTy(), AI,
true,
"Guard");
626CallInst *Call =
B.CreateCall(GuardCheck, {Guard});
627 Call->setAttributes(GuardCheck->getAttributes());
628 Call->setCallingConv(GuardCheck->getCallingConv());
630// Generate the epilogue with inline instrumentation. 631// If we do not support SelectionDAG based calls, generate IR level 634// For each block with a return instruction, convert this: 645// %2 = load StackGuardSlot 646// %3 = icmp ne i1 %1, %2 647// br i1 %3, label %CallStackCheckFailBlk, label %SP_return 652// CallStackCheckFailBlk: 653// call void @__stack_chk_fail() 656// Create the FailBB. We duplicate the BB every time since the MI tail 657// merge pass will merge together all of the various BB into one including 658// fail BB generated by the stack protector pseudo instruction. 664LoadInst *LI2 =
B.CreateLoad(
B.getPtrTy(), AI,
true);
665auto *Cmp = cast<ICmpInst>(
B.CreateICmpNE(Guard, LI2));
672 SuccessProb.getNumerator());
675/*Unreachable=*/false, Weights, DTU,
676/*LI=*/nullptr,
/*ThenBlock=*/FailBB);
678auto *BI = cast<BranchInst>(Cmp->getParent()->getTerminator());
683 Cmp->setPredicate(Cmp->getInversePredicate());
684 BI->swapSuccessors();
688// Return if we didn't modify any basic blocks. i.e., there are no return 689// statements in the function. 694auto *M =
F->getParent();
698if (
F->getSubprogram())
699B.SetCurrentDebugLocation(
704 StackChkFail = M->getOrInsertFunction(
"__stack_smash_handler",
707 Args.push_back(
B.CreateGlobalString(
F->getName(),
"SSH"));
712 cast<Function>(StackChkFail.
getCallee())->addFnAttr(Attribute::NoReturn);
713B.CreateCall(StackChkFail, Args);
714B.CreateUnreachable();
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
This file contains the simple types necessary to represent the attributes associated with functions a...
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
Analysis containing CSE Info
This file contains the declarations for the subclasses of Constant, which represent the different fla...
Module.h This file contains the declarations for the Module class.
This file provides utility analysis objects describing memory locations.
uint64_t IntrinsicInst * II
FunctionAnalysisManager FAM
#define INITIALIZE_PASS_DEPENDENCY(depName)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallPtrSet class.
This file defines the SmallVector class.
static bool HasAddressTaken(const Instruction *AI, TypeSize AllocSize, Module *M, SmallPtrSet< const PHINode *, 16 > &VisitedPHIs)
Check whether a stack allocation has its address taken.
static Value * getStackGuard(const TargetLoweringBase *TLI, Module *M, IRBuilder<> &B, bool *SupportsSelectionDAGSP=nullptr)
Create a stack guard loading and populate whether SelectionDAG SSP is supported.
static bool InsertStackProtectors(const TargetMachine *TM, Function *F, DomTreeUpdater *DTU, bool &HasPrologue, bool &HasIRCheck)
InsertStackProtectors - Insert code into the prologue and epilogue of the function.
static BasicBlock * CreateFailBB(Function *F, const Triple &Trip)
CreateFailBB - Create a basic block to jump to when the stack protector check fails.
static cl::opt< bool > DisableCheckNoReturn("disable-check-noreturn-call", cl::init(false), cl::Hidden)
static bool CreatePrologue(Function *F, Module *M, Instruction *CheckLoc, const TargetLoweringBase *TLI, AllocaInst *&AI)
Insert code into the entry block that stores the stack guard variable onto the stack:
static bool ContainsProtectableArray(Type *Ty, Module *M, unsigned SSPBufferSize, bool &IsLarge, bool Strong, bool InStruct)
static cl::opt< bool > EnableSelectionDAGSP("enable-selectiondag-sp", cl::init(true), cl::Hidden)
static const CallInst * findStackProtectorIntrinsic(Function &F)
Search for the first call to the llvm.stackprotector intrinsic and return it if present.
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
This file describes how to lower LLVM code to machine code.
Target-Independent Code Generator Pass Configuration Options pass.
Class for arbitrary precision integers.
an instruction to allocate memory on the stack
A container for analyses that lazily runs them and caches their results.
PassT::Result * getCachedResult(IRUnitT &IR) const
Get the cached result of an analysis pass for a given IR unit.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Represent the analysis usage information of a pass.
AnalysisUsage & addRequired()
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
LLVM Basic Block Representation.
static BasicBlock * Create(LLVMContext &Context, const Twine &Name="", Function *Parent=nullptr, BasicBlock *InsertBefore=nullptr)
Creates a new BasicBlock.
void moveAfter(BasicBlock *MovePos)
Unlink this basic block from its current function and insert it right after MovePos in the function M...
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
static BranchProbability getBranchProbStackProtector(bool IsLikely)
Value * getArgOperand(unsigned i) const
This class represents a function call, abstracting a target machine's calling convention.
A parsed version of the target data layout string in and methods for querying it.
iterator find(const_arg_type_t< KeyT > Val)
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
Analysis pass which computes a DominatorTree.
bool verify(VerificationLevel VL=VerificationLevel::Full) const
verify - checks if the tree is correct.
Legacy analysis pass which computes a DominatorTree.
A handy container for a FunctionType+Callee-pointer pair, which can be passed around as a single enti...
FunctionPass class - This class is used to implement most global optimizations.
uint64_t getFnAttributeAsParsedInteger(StringRef Kind, uint64_t Default=0) const
For a string attribute Kind, parse attribute as an integer.
bool hasPersonalityFn() const
Check whether this function has a personality function.
Constant * getPersonalityFn() const
Get the personality function associated with this function.
an instruction for type-safe pointer arithmetic to access elements of arrays and structs
Module * getParent()
Get the module that this global value is contained inside of...
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
const Instruction * getPrevNonDebugInstruction(bool SkipPseudoOp=false) const
Return a pointer to the previous non-debug instruction in the same basic block as 'this',...
This is an important class for using LLVM in a threaded context.
An instruction for reading from memory.
MDNode * createBranchWeights(uint32_t TrueWeight, uint32_t FalseWeight, bool IsExpected=false)
Return metadata containing two branch weights.
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
const AllocaInst * getObjectAllocation(int ObjectIdx) const
Return the underlying Alloca of the specified stack object if it exists.
@ SSPLK_SmallArray
Array or nested array < SSP-buffer-size.
@ SSPLK_LargeArray
Array or nested array >= SSP-buffer-size.
@ SSPLK_AddrOf
The address of this allocation is exposed and triggered protection.
void setObjectSSPLayout(int ObjectIdx, SSPLayoutKind Kind)
int getObjectIndexEnd() const
Return one past the maximum frame object index.
bool isDeadObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a dead object.
static std::optional< MemoryLocation > getOrNone(const Instruction *Inst)
A Module instance is used to store all the information related to an LLVM module.
The optimization diagnostic interface.
void emit(DiagnosticInfoOptimizationBase &OptDiag)
Output the remark via the diagnostic handler and to the optimization record file.
Diagnostic information for applied optimization remarks.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
static PointerType * getUnqual(Type *ElementType)
This constructs a pointer to an object of the specified type in the default address space (address sp...
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
void preserve()
Mark an analysis as preserved.
static bool requiresStackProtector(Function *F, SSPLayoutMap *Layout=nullptr)
Check whether or not F needs a stack protector based upon the stack protector level.
Result run(Function &F, FunctionAnalysisManager &FAM)
void copyToMachineFrameInfo(MachineFrameInfo &MFI) const
bool shouldEmitSDCheck(const BasicBlock &BB) const
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.
PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM)
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
static bool requiresStackProtector(Function *F, SSPLayoutMap *Layout=nullptr)
Check whether or not F needs a stack protector based upon the stack protector level.
bool runOnFunction(Function &Fn) override
runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass.
StringRef - Represent a constant reference to a string, i.e.
constexpr bool empty() const
empty - Check if the string is empty.
Class to represent struct types.
This base class for TargetLowering contains the SelectionDAG-independent parts that can be used from ...
virtual Value * getIRStackGuard(IRBuilderBase &IRB) const
If the target has a standard location for the stack protector guard, returns the address of that loca...
virtual void insertSSPDeclarations(Module &M) const
Inserts necessary declarations for SSP (stack protection) purpose.
Primary interface to the complete machine description for the target machine.
Target-Independent Code Generator Pass Configuration Options.
Triple - Helper class for working with autoconf configuration names.
bool isOSDarwin() const
Is this a "Darwin" OS (macOS, iOS, tvOS, watchOS, XROS, or DriverKit).
static constexpr TypeSize getFixed(ScalarTy ExactSize)
The instances of the Type class are immutable: once they are created, they are never changed.
static Type * getVoidTy(LLVMContext &C)
LLVM Value Representation.
void setName(const Twine &Name)
Change the name of the value.
iterator_range< user_iterator > users()
LLVMContext & getContext() const
All values hold a context through their type.
constexpr ScalarTy getKnownMinValue() const
Returns the minimum value this quantity can represent.
static constexpr bool isKnownGT(const FixedOrScalableQuantity &LHS, const FixedOrScalableQuantity &RHS)
static constexpr bool isKnownGE(const FixedOrScalableQuantity &LHS, const FixedOrScalableQuantity &RHS)
initializer< Ty > init(const Ty &Val)
DiagnosticInfoOptimizationBase::Argument NV
This is an optimization pass for GlobalISel generic memory operations.
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...
FunctionPass * createStackProtectorPass()
createStackProtectorPass - This pass adds stack protectors to functions.
void initializeStackProtectorPass(PassRegistry &)
EHPersonality classifyEHPersonality(const Value *Pers)
See if the given exception handling personality function is one that we understand.
bool isFuncletEHPersonality(EHPersonality Pers)
Returns true if this is a personality function that invokes handler funclets (which must return to it...
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 ...
A special type used by analysis passes to provide an address that identifies that particular analysis...