LLVM 20.0.0git
Classes | Namespaces | Macros | Functions | Variables
FunctionAttrs.cpp File Reference

This file implements interprocedural passes which walk the call-graph deducing and/or propagating function attributes. More...

#include "llvm/Transforms/IPO/FunctionAttrs.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/SCCIterator.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/BasicAliasAnalysis.h"
#include "llvm/Analysis/CFG.h"
#include "llvm/Analysis/CGSCCPassManager.h"
#include "llvm/Analysis/CallGraph.h"
#include "llvm/Analysis/CallGraphSCCPass.h"
#include "llvm/Analysis/CaptureTracking.h"
#include "llvm/Analysis/LazyCallGraph.h"
#include "llvm/Analysis/MemoryLocation.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/Argument.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/ConstantRangeList.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/InstIterator.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/ModuleSummaryIndex.h"
#include "llvm/IR/PassManager.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Use.h"
#include "llvm/IR/User.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/IPO.h"
#include "llvm/Transforms/Utils/Local.h"
#include <cassert>
#include <iterator>
#include <map>
#include <optional>
#include <vector>

Go to the source code of this file.

Classes

struct  llvm::GraphTraits< ArgumentGraphNode * >
 
struct  llvm::GraphTraits< ArgumentGraph * >
 

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.
 

Macros

#define DEBUG_TYPE   "function-attrs"
 

Functions

 STATISTIC (NumMemoryAttr, "Number of functions with improved memory attribute")
 
 STATISTIC (NumNoCapture, "Number of arguments marked nocapture")
 
 STATISTIC (NumReturned, "Number of arguments marked returned")
 
 STATISTIC (NumReadNoneArg, "Number of arguments marked readnone")
 
 STATISTIC (NumReadOnlyArg, "Number of arguments marked readonly")
 
 STATISTIC (NumWriteOnlyArg, "Number of arguments marked writeonly")
 
 STATISTIC (NumNoAlias, "Number of function returns marked noalias")
 
 STATISTIC (NumNonNullReturn, "Number of function returns marked nonnull")
 
 STATISTIC (NumNoUndefReturn, "Number of function returns marked noundef")
 
 STATISTIC (NumNoRecurse, "Number of functions marked as norecurse")
 
 STATISTIC (NumNoUnwind, "Number of functions marked as nounwind")
 
 STATISTIC (NumNoFree, "Number of functions marked as nofree")
 
 STATISTIC (NumWillReturn, "Number of functions marked as willreturn")
 
 STATISTIC (NumNoSync, "Number of functions marked as nosync")
 
 STATISTIC (NumCold, "Number of functions marked as cold")
 
 STATISTIC (NumThinLinkNoRecurse, "Number of functions marked as norecurse during thinlink")
 
 STATISTIC (NumThinLinkNoUnwind, "Number of functions marked as nounwind during thinlink")
 
static void addLocAccess (MemoryEffects &ME, const MemoryLocation &Loc, ModRefInfo MR, AAResults &AAR)
 
static void addArgLocs (MemoryEffects &ME, const CallBase *Call, ModRefInfo ArgMR, AAResults &AAR)
 
static std::pair< MemoryEffects, MemoryEffectscheckFunctionMemoryAccess (Function &F, bool ThisBody, AAResults &AAR, const SCCNodeSet &SCCNodes)
 Returns the memory access attribute for function F using AAR for AA results, where SCCNodes is the current SCC.
 
template<typename AARGetterT >
static void addMemoryAttrs (const SCCNodeSet &SCCNodes, AARGetterT &&AARGetter, SmallSet< Function *, 8 > &Changed)
 Deduce readonly/readnone/writeonly attributes for the SCC.
 
static FunctionSummarycalculatePrevailingSummary (ValueInfo VI, DenseMap< ValueInfo, FunctionSummary * > &CachedPrevailingSummary, function_ref< bool(GlobalValue::GUID, const GlobalValueSummary *)> IsPrevailing)
 
static Attribute::AttrKind determinePointerAccessAttrs (Argument *A, const SmallPtrSet< Argument *, 8 > &SCCNodes)
 Returns Attribute::None, Attribute::ReadOnly or Attribute::ReadNone.
 
static void addArgumentReturnedAttrs (const SCCNodeSet &SCCNodes, SmallSet< Function *, 8 > &Changed)
 Deduce returned attributes for the SCC.
 
static bool addArgumentAttrsFromCallsites (Function &F)
 If a callsite has arguments that are also arguments to the parent function, try to propagate attributes from the callsite's arguments to the parent's arguments.
 
static bool addAccessAttr (Argument *A, Attribute::AttrKind R)
 
static bool inferInitializes (Argument &A, Function &F)
 
static void addArgumentAttrs (const SCCNodeSet &SCCNodes, SmallSet< Function *, 8 > &Changed, bool SkipInitializes)
 Deduce nocapture attributes for the SCC.
 
static bool isFunctionMallocLike (Function *F, const SCCNodeSet &SCCNodes)
 Tests whether a function is "malloc-like".
 
static void addNoAliasAttrs (const SCCNodeSet &SCCNodes, SmallSet< Function *, 8 > &Changed)
 Deduce noalias attributes for the SCC.
 
static bool isReturnNonNull (Function *F, const SCCNodeSet &SCCNodes, bool &Speculative)
 Tests whether this function is known to not return null.
 
static void addNonNullAttrs (const SCCNodeSet &SCCNodes, SmallSet< Function *, 8 > &Changed)
 Deduce nonnull attributes for the SCC.
 
static void addNoUndefAttrs (const SCCNodeSet &SCCNodes, SmallSet< Function *, 8 > &Changed)
 Deduce noundef attributes for the SCC.
 
static bool InstrBreaksNonConvergent (Instruction &I, const SCCNodeSet &SCCNodes)
 Helper for non-Convergent inference predicate InstrBreaksAttribute.
 
static bool InstrBreaksNonThrowing (Instruction &I, const SCCNodeSet &SCCNodes)
 Helper for NoUnwind inference predicate InstrBreaksAttribute.
 
static bool InstrBreaksNoFree (Instruction &I, const SCCNodeSet &SCCNodes)
 Helper for NoFree inference predicate InstrBreaksAttribute.
 
static bool isOrderedAtomic (Instruction *I)
 
static bool InstrBreaksNoSync (Instruction &I, const SCCNodeSet &SCCNodes)
 
static void inferConvergent (const SCCNodeSet &SCCNodes, SmallSet< Function *, 8 > &Changed)
 Attempt to remove convergent function attribute when possible.
 
static void inferAttrsFromFunctionBodies (const SCCNodeSet &SCCNodes, SmallSet< Function *, 8 > &Changed)
 Infer attributes from all functions in the SCC by scanning every instruction for compliance to the attribute assumptions.
 
static void addNoRecurseAttrs (const SCCNodeSet &SCCNodes, SmallSet< Function *, 8 > &Changed)
 
static bool instructionDoesNotReturn (Instruction &I)
 
static bool basicBlockCanReturn (BasicBlock &BB)
 
static bool canReturn (Function &F)
 
static void addNoReturnAttrs (const SCCNodeSet &SCCNodes, SmallSet< Function *, 8 > &Changed)
 
static bool allPathsGoThroughCold (Function &F)
 
static void addColdAttrs (const SCCNodeSet &SCCNodes, SmallSet< Function *, 8 > &Changed)
 
static bool functionWillReturn (const Function &F)
 
static void addWillReturn (const SCCNodeSet &SCCNodes, SmallSet< Function *, 8 > &Changed)
 
static SCCNodesResult createSCCNodeSet (ArrayRef< Function * > Functions)
 
template<typename AARGetterT >
static SmallSet< Function *, 8 > deriveAttrsInPostOrder (ArrayRef< Function * > Functions, AARGetterT &&AARGetter, bool ArgAttrsOnly)
 
template<typename AARGetterT >
static bool runImpl (CallGraphSCC &SCC, AARGetterT AARGetter)
 
static bool addNoRecurseAttrsTopDown (Function &F)
 
static bool deduceFunctionAttributeInRPO (Module &M, LazyCallGraph &CG)
 

Variables

static cl::opt< boolEnableNonnullArgPropagation ("enable-nonnull-arg-prop", cl::init(true), cl::Hidden, cl::desc("Try to propagate nonnull argument attributes from callsites to " "caller functions."))
 
static cl::opt< boolDisableNoUnwindInference ("disable-nounwind-inference", cl::Hidden, cl::desc("Stop inferring nounwind attribute during function-attrs pass"))
 
static cl::opt< boolDisableNoFreeInference ("disable-nofree-inference", cl::Hidden, cl::desc("Stop inferring nofree attribute during function-attrs pass"))
 
static cl::opt< boolDisableThinLTOPropagation ("disable-thinlto-funcattrs", cl::init(true), cl::Hidden, cl::desc("Don't propagate function-attrs in thinLTO"))
 

Detailed Description

This file implements interprocedural passes which walk the call-graph deducing and/or propagating function attributes.

Definition in file FunctionAttrs.cpp.

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "function-attrs"

Definition at line 71 of file FunctionAttrs.cpp.

Function Documentation

◆ addAccessAttr()

static bool addAccessAttr ( Argument A,
Attribute::AttrKind  R 
)
static

Definition at line 1038 of file FunctionAttrs.cpp.

References A, and assert().

Referenced by addArgumentAttrs().

◆ addArgLocs()

static void addArgLocs ( MemoryEffects ME,
const CallBase Call,
ModRefInfo  ArgMR,
AAResults AAR 
)
static

◆ addArgumentAttrs()

static void addArgumentAttrs ( const SCCNodeSet &  SCCNodes,
SmallSet< Function *, 8 > &  Changed,
bool  SkipInitializes 
)
static

◆ addArgumentAttrsFromCallsites()

static bool addArgumentAttrsFromCallsites ( Function F)
static

If a callsite has arguments that are also arguments to the parent function, try to propagate attributes from the callsite's arguments to the parent's arguments.

This may be important because inlining can cause information loss when attribute knowledge disappears with the inlined call.

Definition at line 999 of file FunctionAttrs.cpp.

References EnableNonnullArgPropagation, F, llvm::CallBase::getArgOperand(), llvm::CallBase::getCalledFunction(), I, and llvm::isGuaranteedToTransferExecutionToSuccessor().

Referenced by addArgumentAttrs().

◆ addArgumentReturnedAttrs()

static void addArgumentReturnedAttrs ( const SCCNodeSet &  SCCNodes,
SmallSet< Function *, 8 > &  Changed 
)
static

Deduce returned attributes for the SCC.

Definition at line 950 of file FunctionAttrs.cpp.

References llvm::Argument::addAttr(), F, and llvm::SmallSet< T, N, C >::insert().

Referenced by deriveAttrsInPostOrder().

◆ addColdAttrs()

static void addColdAttrs ( const SCCNodeSet &  SCCNodes,
SmallSet< Function *, 8 > &  Changed 
)
static

◆ addLocAccess()

static void addLocAccess ( MemoryEffects ME,
const MemoryLocation Loc,
ModRefInfo  MR,
AAResults AAR 
)
static

◆ addMemoryAttrs()

template<typename AARGetterT >
static void addMemoryAttrs ( const SCCNodeSet &  SCCNodes,
AARGetterT &&  AARGetter,
SmallSet< Function *, 8 > &  Changed 
)
static

◆ addNoAliasAttrs()

static void addNoAliasAttrs ( const SCCNodeSet &  SCCNodes,
SmallSet< Function *, 8 > &  Changed 
)
static

Deduce noalias attributes for the SCC.

Definition at line 1440 of file FunctionAttrs.cpp.

References F, llvm::SmallSet< T, N, C >::insert(), and isFunctionMallocLike().

Referenced by deriveAttrsInPostOrder().

◆ addNonNullAttrs()

static void addNonNullAttrs ( const SCCNodeSet &  SCCNodes,
SmallSet< Function *, 8 > &  Changed 
)
static

Deduce nonnull attributes for the SCC.

Definition at line 1553 of file FunctionAttrs.cpp.

References llvm::dbgs(), F, llvm::SmallSet< T, N, C >::insert(), isReturnNonNull(), and LLVM_DEBUG.

Referenced by deriveAttrsInPostOrder().

◆ addNoRecurseAttrs()

static void addNoRecurseAttrs ( const SCCNodeSet &  SCCNodes,
SmallSet< Function *, 8 > &  Changed 
)
static

◆ addNoRecurseAttrsTopDown()

static bool addNoRecurseAttrsTopDown ( Function F)
static

◆ addNoReturnAttrs()

static void addNoReturnAttrs ( const SCCNodeSet &  SCCNodes,
SmallSet< Function *, 8 > &  Changed 
)
static

Definition at line 2071 of file FunctionAttrs.cpp.

References canReturn(), F, and llvm::SmallSet< T, N, C >::insert().

Referenced by deriveAttrsInPostOrder().

◆ addNoUndefAttrs()

static void addNoUndefAttrs ( const SCCNodeSet &  SCCNodes,
SmallSet< Function *, 8 > &  Changed 
)
static

Deduce noundef attributes for the SCC.

Definition at line 1610 of file FunctionAttrs.cpp.

References llvm::all_of(), DL, F, llvm::BasicBlock::getTerminator(), and llvm::SmallSet< T, N, C >::insert().

Referenced by deriveAttrsInPostOrder().

◆ addWillReturn()

static void addWillReturn ( const SCCNodeSet &  SCCNodes,
SmallSet< Function *, 8 > &  Changed 
)
static

Definition at line 2179 of file FunctionAttrs.cpp.

References F, functionWillReturn(), and llvm::SmallSet< T, N, C >::insert().

Referenced by deriveAttrsInPostOrder().

◆ allPathsGoThroughCold()

static bool allPathsGoThroughCold ( Function F)
static

◆ basicBlockCanReturn()

static bool basicBlockCanReturn ( BasicBlock BB)
static

◆ calculatePrevailingSummary()

static FunctionSummary * calculatePrevailingSummary ( ValueInfo  VI,
DenseMap< ValueInfo, FunctionSummary * > &  CachedPrevailingSummary,
function_ref< bool(GlobalValue::GUID, const GlobalValueSummary *)>  IsPrevailing 
)
static

At this point, prevailing symbols have been resolved. The following leads to returning a conservative result:

  • Multiple instances with local linkage. Normally local linkage would be unique per module as the GUID includes the module path. We could have a guid alias if there wasn't any distinguishing path when each file was compiled, but that should be rare so we'll punt on those.

These next 2 cases should not happen and will assert:

  • Multiple instances with external linkage. This should be caught in symbol resolution
  • Non-existent FunctionSummary for Aliasee. This presents a hole in our knowledge meaning we have to go conservative.

Otherwise, we calculate attributes for a function as:

  1. If we have a local linkage, take its attributes. If there's somehow multiple, bail and go conservative.
  2. If we have an external/WeakODR/LinkOnceODR linkage check that it is prevailing, take its attributes.
  3. If we have a Weak/LinkOnce linkage the copies can have semantic differences. However, if the prevailing copy is known it will be used so take its attributes. If the prevailing copy is in a native file all IR copies will be dead and propagation will go conservative.
  4. AvailableExternally summaries without a prevailing copy are known to occur in a couple of circumstances: a. An internal function gets imported due to its caller getting imported, it becomes AvailableExternally but no prevailing definition exists. Because it has to get imported along with its caller the attributes will be captured by propagating on its caller. b. C++11 [temp.explicit]p10 can generate AvailableExternally definitions of explicitly instanced template declarations for inlining which are ultimately dropped from the TU. Since this is localized to the TU the attributes will have already made it to the callers. These are edge cases and already captured by their callers so we ignore these for now. If they become relevant to optimize in the future this can be revisited.
  5. Otherwise, go conservative.

Definition at line 303 of file FunctionAttrs.cpp.

References assert(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::count(), llvm::dbgs(), llvm::GlobalValue::isAvailableExternallyLinkage(), llvm::GlobalValue::isExternalLinkage(), llvm::GlobalValue::isLinkOnceAnyLinkage(), llvm::GlobalValue::isLinkOnceODRLinkage(), llvm::GlobalValue::isLocalLinkage(), llvm::GlobalValue::isWeakAnyLinkage(), llvm::GlobalValue::isWeakODRLinkage(), LLVM_DEBUG, and Local.

Referenced by llvm::thinLTOPropagateFunctionAttrs().

◆ canReturn()

static bool canReturn ( Function F)
static

◆ checkFunctionMemoryAccess()

static std::pair< MemoryEffects, MemoryEffects > checkFunctionMemoryAccess ( Function F,
bool  ThisBody,
AAResults AAR,
const SCCNodeSet &  SCCNodes 
)
static

Returns the memory access attribute for function F using AAR for AA results, where SCCNodes is the current SCC.

If ThisBody is true, this function may examine the function body and will return a result pertaining to this copy of the function. If it is false, the result will be based only on AA results for the function declaration; it will be assumed that some other (perhaps less optimized) version of the function may be selected at link time.

The return value is split into two parts: Memory effects that always apply, and additional memory effects that apply if any of the functions in the SCC can access argmem.

Definition at line 163 of file FunctionAttrs.cpp.

References addArgLocs(), addLocAccess(), llvm::MemoryEffectsBase< LocationEnum >::argMemOnly(), llvm::MemoryEffectsBase< LocationEnum >::doesNotAccessMemory(), F, llvm::AAResults::getMemoryEffects(), llvm::MemoryEffectsBase< LocationEnum >::getModRef(), llvm::MemoryLocation::getOrNone(), llvm::MemoryEffectsBase< LocationEnum >::getWithoutLoc(), I, llvm::MemoryEffectsBase< LocationEnum >::inaccessibleMemOnly(), instructions, and llvm::MemoryEffectsBase< LocationEnum >::none().

Referenced by addMemoryAttrs(), and llvm::computeFunctionBodyMemoryAccess().

◆ createSCCNodeSet()

static SCCNodesResult createSCCNodeSet ( ArrayRef< Function * >  Functions)
static

Definition at line 2191 of file FunctionAttrs.cpp.

References F, llvm::CallBase::getCalledFunction(), I, and instructions.

Referenced by deriveAttrsInPostOrder().

◆ deduceFunctionAttributeInRPO()

static bool deduceFunctionAttributeInRPO ( Module M,
LazyCallGraph CG 
)
static

◆ deriveAttrsInPostOrder()

template<typename AARGetterT >
static SmallSet< Function *, 8 > deriveAttrsInPostOrder ( ArrayRef< Function * >  Functions,
AARGetterT &&  AARGetter,
bool  ArgAttrsOnly 
)
static

◆ determinePointerAccessAttrs()

static Attribute::AttrKind determinePointerAccessAttrs ( Argument A,
const SmallPtrSet< Argument *, 8 > &  SCCNodes 
)
static

◆ functionWillReturn()

static bool functionWillReturn ( const Function F)
static

◆ inferAttrsFromFunctionBodies()

static void inferAttrsFromFunctionBodies ( const SCCNodeSet &  SCCNodes,
SmallSet< Function *, 8 > &  Changed 
)
static

Infer attributes from all functions in the SCC by scanning every instruction for compliance to the attribute assumptions.

Returns true if any changes to function attributes were made.

Definition at line 1931 of file FunctionAttrs.cpp.

References llvm::dbgs(), DisableNoFreeInference, DisableNoUnwindInference, F, I, InstrBreaksNoFree(), InstrBreaksNonThrowing(), InstrBreaksNoSync(), and LLVM_DEBUG.

Referenced by deriveAttrsInPostOrder().

◆ inferConvergent()

static void inferConvergent ( const SCCNodeSet &  SCCNodes,
SmallSet< Function *, 8 > &  Changed 
)
static

Attempt to remove convergent function attribute when possible.

Returns true if any changes to function attributes were made.

Definition at line 1900 of file FunctionAttrs.cpp.

References llvm::dbgs(), F, I, InstrBreaksNonConvergent(), and LLVM_DEBUG.

Referenced by deriveAttrsInPostOrder().

◆ inferInitializes()

static bool inferInitializes ( Argument A,
Function F 
)
static

◆ InstrBreaksNoFree()

static bool InstrBreaksNoFree ( Instruction I,
const SCCNodeSet &  SCCNodes 
)
static

Helper for NoFree inference predicate InstrBreaksAttribute.

Definition at line 1826 of file FunctionAttrs.cpp.

References llvm::CallBase::getCalledFunction(), llvm::CallBase::hasFnAttr(), and I.

Referenced by inferAttrsFromFunctionBodies().

◆ InstrBreaksNonConvergent()

static bool InstrBreaksNonConvergent ( Instruction I,
const SCCNodeSet &  SCCNodes 
)
static

Helper for non-Convergent inference predicate InstrBreaksAttribute.

Definition at line 1800 of file FunctionAttrs.cpp.

References llvm::CallBase::getCalledFunction(), I, and llvm::CallBase::isConvergent().

Referenced by inferConvergent().

◆ InstrBreaksNonThrowing()

static bool InstrBreaksNonThrowing ( Instruction I,
const SCCNodeSet &  SCCNodes 
)
static

Helper for NoUnwind inference predicate InstrBreaksAttribute.

Definition at line 1810 of file FunctionAttrs.cpp.

References I.

Referenced by inferAttrsFromFunctionBodies().

◆ InstrBreaksNoSync()

static bool InstrBreaksNoSync ( Instruction I,
const SCCNodeSet &  SCCNodes 
)
static

◆ instructionDoesNotReturn()

static bool instructionDoesNotReturn ( Instruction I)
static

Definition at line 2035 of file FunctionAttrs.cpp.

References llvm::CallBase::hasFnAttr(), and I.

Referenced by basicBlockCanReturn().

◆ isFunctionMallocLike()

static bool isFunctionMallocLike ( Function F,
const SCCNodeSet &  SCCNodes 
)
static

Tests whether a function is "malloc-like".

A function is "malloc-like" if it returns either null or a pointer that doesn't alias any other pointer visible to the caller.

Definition at line 1376 of file FunctionAttrs.cpp.

References llvm::CallingConv::C, F, llvm::CallBase::getCalledFunction(), llvm::CallBase::hasRetAttr(), llvm::PHINode::incoming_values(), llvm::SetVector< T, Vector, Set, N >::insert(), llvm::PointerMayBeCaptured(), and llvm::SetVector< T, Vector, Set, N >::size().

Referenced by addNoAliasAttrs().

◆ isOrderedAtomic()

static bool isOrderedAtomic ( Instruction I)
static

Definition at line 1847 of file FunctionAttrs.cpp.

References I, llvm_unreachable, and llvm::SyncScope::SingleThread.

Referenced by InstrBreaksNoSync().

◆ isReturnNonNull()

static bool isReturnNonNull ( Function F,
const SCCNodeSet &  SCCNodes,
bool Speculative 
)
static

Tests whether this function is known to not return null.

Requires that the function returns a pointer.

Returns true if it believes the function will not return a null, and sets Speculative based on whether the returned conclusion is a speculative conclusion due to SCC calls.

Definition at line 1482 of file FunctionAttrs.cpp.

References assert(), DL, F, llvm::CallBase::getCalledFunction(), llvm::PHINode::getIncomingValue(), llvm::PHINode::getNumIncomingValues(), llvm::Instruction::getOpcode(), llvm::User::getOperand(), llvm::SetVector< T, Vector, Set, N >::insert(), llvm::isKnownNonZero(), llvm_unreachable, and llvm::SetVector< T, Vector, Set, N >::size().

Referenced by addNonNullAttrs().

◆ runImpl()

template<typename AARGetterT >
static bool runImpl ( CallGraphSCC SCC,
AARGetterT  AARGetter 
)
static

◆ STATISTIC() [1/17]

STATISTIC ( NumCold  ,
"Number of functions marked as cold"   
)

◆ STATISTIC() [2/17]

STATISTIC ( NumMemoryAttr  ,
"Number of functions with improved memory attribute"   
)

◆ STATISTIC() [3/17]

STATISTIC ( NumNoAlias  ,
"Number of function returns marked noalias"   
)

◆ STATISTIC() [4/17]

STATISTIC ( NumNoCapture  ,
"Number of arguments marked nocapture"   
)

◆ STATISTIC() [5/17]

STATISTIC ( NumNoFree  ,
"Number of functions marked as nofree"   
)

◆ STATISTIC() [6/17]

STATISTIC ( NumNonNullReturn  ,
"Number of function returns marked nonnull"   
)

◆ STATISTIC() [7/17]

STATISTIC ( NumNoRecurse  ,
"Number of functions marked as norecurse"   
)

◆ STATISTIC() [8/17]

STATISTIC ( NumNoSync  ,
"Number of functions marked as nosync"   
)

◆ STATISTIC() [9/17]

STATISTIC ( NumNoUndefReturn  ,
"Number of function returns marked noundef"   
)

◆ STATISTIC() [10/17]

STATISTIC ( NumNoUnwind  ,
"Number of functions marked as nounwind"   
)

◆ STATISTIC() [11/17]

STATISTIC ( NumReadNoneArg  ,
"Number of arguments marked readnone"   
)

◆ STATISTIC() [12/17]

STATISTIC ( NumReadOnlyArg  ,
"Number of arguments marked readonly"   
)

◆ STATISTIC() [13/17]

STATISTIC ( NumReturned  ,
"Number of arguments marked returned"   
)

◆ STATISTIC() [14/17]

STATISTIC ( NumThinLinkNoRecurse  ,
"Number of functions marked as norecurse during thinlink"   
)

◆ STATISTIC() [15/17]

STATISTIC ( NumThinLinkNoUnwind  ,
"Number of functions marked as nounwind during thinlink"   
)

◆ STATISTIC() [16/17]

STATISTIC ( NumWillReturn  ,
"Number of functions marked as willreturn"   
)

◆ STATISTIC() [17/17]

STATISTIC ( NumWriteOnlyArg  ,
"Number of arguments marked writeonly"   
)

Variable Documentation

◆ DisableNoFreeInference

cl::opt< bool > DisableNoFreeInference("disable-nofree-inference", cl::Hidden, cl::desc("Stop inferring nofree attribute during function-attrs pass")) ( "disable-nofree-inference"  ,
cl::Hidden  ,
cl::desc("Stop inferring nofree attribute during function-attrs pass")   
)
static

◆ DisableNoUnwindInference

cl::opt< bool > DisableNoUnwindInference("disable-nounwind-inference", cl::Hidden, cl::desc("Stop inferring nounwind attribute during function-attrs pass")) ( "disable-nounwind-inference"  ,
cl::Hidden  ,
cl::desc("Stop inferring nounwind attribute during function-attrs pass")   
)
static

◆ DisableThinLTOPropagation

cl::opt< bool > DisableThinLTOPropagation("disable-thinlto-funcattrs", cl::init(true), cl::Hidden, cl::desc("Don't propagate function-attrs in thinLTO")) ( "disable-thinlto-funcattrs"  ,
cl::init(true ,
cl::Hidden  ,
cl::desc("Don't propagate function-attrs in thinLTO")   
)
static

◆ EnableNonnullArgPropagation

cl::opt< bool > EnableNonnullArgPropagation("enable-nonnull-arg-prop", cl::init(true), cl::Hidden, cl::desc("Try to propagate nonnull argument attributes from callsites to " "caller functions.")) ( "enable-nonnull-arg-prop"  ,
cl::init(true ,
cl::Hidden  ,
cl::desc("Try to propagate nonnull argument attributes from callsites to " "caller functions.")   
)
static