LLVM  10.0.0svn
Classes | Macros | Typedefs | Functions | Variables
Attributor.cpp File Reference
#include "llvm/Transforms/IPO/Attributor.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/CaptureTracking.h"
#include "llvm/Analysis/EHPersonalities.h"
#include "llvm/Analysis/GlobalsModRef.h"
#include "llvm/Analysis/Loads.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/Argument.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/CFG.h"
#include "llvm/IR/InstIterator.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/Local.h"
#include <cassert>
Include dependency graph for Attributor.cpp:

Go to the source code of this file.

Classes

struct  AAReturnedFromReturnedValues< AAType, Base, StateType >
 Helper class for generic deduction: return value -> returned position. More...
 
struct  AAArgumentFromCallSiteArguments< AAType, Base, StateType >
 Helper class for generic deduction: call site argument -> argument position. More...
 
struct  AACallSiteReturnedFromReturned< AAType, Base >
 Helper class for generic replication: function returned -> cs returned. More...
 
struct  AANoUnwindImpl
 --------------------—NoUnwind Function Attribute-----------------------— More...
 
struct  AANoUnwindFunction
 
class  AAReturnedValuesImpl
 ---------------—— Function Return Values -------------------------—— More...
 
struct  AAReturnedValuesFunction
 
struct  AANoSyncImpl
 ---------------------— NoSync Function Attribute ----------------------— More...
 
struct  AANoSyncFunction
 
struct  AANoFreeImpl
 ---------------------— No-Free Attributes -------------------------— More...
 
struct  AANoFreeFunction
 
struct  AANonNullImpl
 ---------------------— NonNull Argument Attribute ---------------------— More...
 
struct  AANonNullFloating
 NonNull attribute for a floating value. More...
 
struct  AANonNullReturned
 NonNull attribute for function return value. More...
 
struct  AANonNullArgument
 NonNull attribute for function argument. More...
 
struct  AANonNullCallSiteArgument
 
struct  AANonNullCallSiteReturned
 NonNull attribute for a call site return position. More...
 
struct  AANoRecurseImpl
 ---------------------— No-Recurse Attributes -------------------------— More...
 
struct  AANoRecurseFunction
 
struct  AAWillReturnImpl
 
struct  AAWillReturnFunction
 
struct  AANoAliasImpl
 ---------------------— NoAlias Argument Attribute ---------------------— More...
 
struct  AANoAliasFloating
 NoAlias attribute for a floating value. More...
 
struct  AANoAliasArgument
 NoAlias attribute for an argument. More...
 
struct  AANoAliasCallSiteArgument
 
struct  AANoAliasReturned
 NoAlias attribute for function return value. More...
 
struct  AAIsDeadImpl
 ----------------—AAIsDead Function Attribute--------------------— More...
 
struct  AAIsDeadFunction
 
struct  AADereferenceableImpl
 
struct  AADereferenceableFloating
 Dereferenceable attribute for a floating value. More...
 
struct  AADereferenceableReturned
 Dereferenceable attribute for a return value. More...
 
struct  AADereferenceableArgument
 Dereferenceable attribute for an argument. More...
 
struct  AADereferenceableCallSiteArgument
 Dereferenceable attribute for a call site argument. More...
 
struct  AAAlignImpl
 
struct  AAAlignFloating
 Align attribute for a floating value. More...
 
struct  AAAlignReturned
 Align attribute for function return value. More...
 
struct  AAAlignArgument
 Align attribute for function argument. More...
 
struct  AAAlignCallSiteArgument
 
struct  AANoReturnImpl
 ---------------— Function No-Return Attribute -------------------------— More...
 
struct  AANoReturnFunction
 

Macros

#define DEBUG_TYPE   "attributor"
 
#define BUILD_STAT_MSG_IR_ATTR(TYPE, NAME)   ("Number of " #TYPE " marked '" #NAME "'")
 
#define BUILD_STAT_NAME(NAME, TYPE)   NumIR##TYPE##_##NAME
 
#define STATS_DECL(NAME, TYPE, MSG)   STATISTIC(BUILD_STAT_NAME(NAME, TYPE), MSG);
 
#define STATS_TRACK(NAME, TYPE)   ++(BUILD_STAT_NAME(NAME, TYPE));
 
#define STATS_DECLTRACK(NAME, TYPE, MSG)
 
#define STATS_DECLTRACK_ARG_ATTR(NAME)   STATS_DECLTRACK(NAME, Arguments, BUILD_STAT_MSG_IR_ATTR(arguments, NAME))
 
#define STATS_DECLTRACK_CSARG_ATTR(NAME)
 
#define STATS_DECLTRACK_FN_ATTR(NAME)   STATS_DECLTRACK(NAME, Function, BUILD_STAT_MSG_IR_ATTR(functions, NAME))
 
#define STATS_DECLTRACK_CS_ATTR(NAME)   STATS_DECLTRACK(NAME, CS, BUILD_STAT_MSG_IR_ATTR(call site, NAME))
 
#define STATS_DECLTRACK_FNRET_ATTR(NAME)
 
#define STATS_DECLTRACK_CSRET_ATTR(NAME)
 
#define STATS_DECLTRACK_FLOATING_ATTR(NAME)
 
#define SWITCH_PK_INV(CLASS, PK, POS_NAME)
 
#define SWITCH_PK_CREATE(CLASS, IRP, PK, SUFFIX)
 
#define CREATE_FUNCTION_ABSTRACT_ATTRIBUTE_FOR_POSITION(CLASS)
 
#define CREATE_VALUE_ABSTRACT_ATTRIBUTE_FOR_POSITION(CLASS)
 

Typedefs

using AANoUnwindCallSite = AANoUnwindFunction
 NoUnwind attribute deduction for a call sites. More...
 
using AAReturnedValuesCallSite = AAReturnedValuesFunction
 Returned values information for a call sites. More...
 
using AANoSyncCallSite = AANoSyncFunction
 NoSync attribute deduction for a call sites. More...
 
using AANoFreeCallSite = AANoFreeFunction
 NoFree attribute deduction for a call sites. More...
 
using AANoRecurseCallSite = AANoRecurseFunction
 
using AAWillReturnCallSite = AAWillReturnFunction
 WillReturn attribute deduction for a call sites. More...
 
using AANoAliasCallSiteReturned = AANoAliasReturned
 NoAlias attribute deduction for a call site return value. More...
 
using AAIsDeadCallSite = AAIsDeadFunction
 Liveness information for a call sites. More...
 
using AADereferenceableCallSiteReturned = AADereferenceableReturned
 Dereferenceable attribute deduction for a call site return value. More...
 
using AAAlignCallSiteReturned = AAAlignReturned
 Align attribute deduction for a call site return value. More...
 
using AANoReturnCallSite = AANoReturnFunction
 NoReturn attribute deduction for a call sites. More...
 

Functions

 STATISTIC (NumFnWithExactDefinition, "Number of function with exact definitions")
 
 STATISTIC (NumFnWithoutExactDefinition, "Number of function without exact definitions")
 
 STATISTIC (NumAttributesTimedOut, "Number of abstract attributes timed out before fixpoint")
 
 STATISTIC (NumAttributesValidFixpoint, "Number of abstract attributes in a valid fixpoint state")
 
 STATISTIC (NumAttributesManifested, "Number of abstract attributes manifested in IR")
 
template<typename AAType , typename StateTy >
bool genericValueTraversal (Attributor &A, IRPosition IRP, const AAType &QueryingAA, StateTy &State, const function_ref< bool(Value &, StateTy &, bool)> &VisitValueCB, int MaxValues=8)
 } More...
 
static bool isEqualOrWorse (const Attribute &New, const Attribute &Old)
 Return true if New is equal or worse than Old. More...
 
static bool addIfNotExistent (LLVMContext &Ctx, const Attribute &Attr, AttributeList &Attrs, int AttrIdx)
 Return true if the information provided by Attr was added to the attribute list Attrs. More...
 
template<typename StateType >
ChangeStatus clampStateAndIndicateChange (StateType &S, const StateType &R)
 Helper functions to clamp a state S of type StateType with the information in R and indicate/return if S did change (as-in update is required to be run again). More...
 
template<>
ChangeStatus clampStateAndIndicateChange< IntegerState > (IntegerState &S, const IntegerState &R)
 
template<>
ChangeStatus clampStateAndIndicateChange< BooleanState > (BooleanState &S, const BooleanState &R)
 
template<typename AAType , typename StateType = typename AAType::StateType>
static void clampReturnedValueStates (Attributor &A, const AAType &QueryingAA, StateType &S)
 } More...
 
template<typename AAType , typename StateType = typename AAType::StateType>
static void clampCallSiteArgumentStates (Attributor &A, const AAType &QueryingAA, StateType &S)
 Clamp the information known at all call sites for a given argument (identified by QueryingAA) into S. More...
 
static bool containsCycle (Function &F)
 ---------------------— Will-Return Attributes -------------------------— More...
 
static bool containsPossiblyEndlessLoop (Function *F)
 
template<>
ChangeStatus clampStateAndIndicateChange< DerefState > (DerefState &S, const DerefState &R)
 -----------------— Dereferenceable Argument Attribute -----------------— More...
 
template<typename AAType >
static const AAType * checkAndRegisterAA (const IRPosition &IRP, Attributor &A, DenseSet< const char *> *Whitelist)
 Helper function that checks if an abstract attribute of type AAType should be created for IR position IRP and if so creates and registers it with the Attributor A. More...
 
static bool runAttributorOnModule (Module &M)
 } More...
 
 INITIALIZE_PASS_BEGIN (AttributorLegacyPass, "attributor", "Deduce and propagate attributes", false, false) INITIALIZE_PASS_END(AttributorLegacyPass
 

Variables

static cl::opt< unsignedMaxFixpointIterations ("attributor-max-iterations", cl::Hidden, cl::desc("Maximal number of fixpoint iterations."), cl::init(32))
 
static cl::opt< boolDisableAttributor ("attributor-disable", cl::Hidden, cl::desc("Disable the attributor inter-procedural deduction pass."), cl::init(true))
 
static cl::opt< boolVerifyAttributor ("attributor-verify", cl::Hidden, cl::desc("Verify the Attributor deduction and " "manifestation of attributes -- may issue false-positive errors"), cl::init(false))
 
 attributor
 
Deduce and propagate attributes
 
Deduce and propagate false
 

Macro Definition Documentation

◆ BUILD_STAT_MSG_IR_ATTR

#define BUILD_STAT_MSG_IR_ATTR (   TYPE,
  NAME 
)    ("Number of " #TYPE " marked '" #NAME "'")

Definition at line 70 of file Attributor.cpp.

◆ BUILD_STAT_NAME

#define BUILD_STAT_NAME (   NAME,
  TYPE 
)    NumIR##TYPE##_##NAME

Definition at line 72 of file Attributor.cpp.

Referenced by AAIsDeadFunction::trackStatistics().

◆ CREATE_FUNCTION_ABSTRACT_ATTRIBUTE_FOR_POSITION

#define CREATE_FUNCTION_ABSTRACT_ATTRIBUTE_FOR_POSITION (   CLASS)
Value:
CLASS &CLASS::createForPosition(const IRPosition &IRP, Attributor &A) { \
CLASS *AA = nullptr; \
switch (IRP.getPositionKind()) { \
SWITCH_PK_INV(CLASS, IRP_INVALID, "invalid") \
SWITCH_PK_INV(CLASS, IRP_FLOAT, "floating") \
SWITCH_PK_INV(CLASS, IRP_ARGUMENT, "argument") \
SWITCH_PK_INV(CLASS, IRP_RETURNED, "returned") \
SWITCH_PK_INV(CLASS, IRP_CALL_SITE_RETURNED, "call site returned") \
SWITCH_PK_INV(CLASS, IRP_CALL_SITE_ARGUMENT, "call site argument") \
SWITCH_PK_CREATE(CLASS, IRP, IRP_FUNCTION, Function) \
SWITCH_PK_CREATE(CLASS, IRP, IRP_CALL_SITE, CallSite) \
} \
AA->initialize(A); \
return *AA; \
}
The fixpoint analysis framework that orchestrates the attribute deduction.
Definition: Attributor.h:569
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
Kind getPositionKind() const
Return the associated position kind.
Definition: Attributor.h:351

Definition at line 2811 of file Attributor.cpp.

◆ CREATE_VALUE_ABSTRACT_ATTRIBUTE_FOR_POSITION

#define CREATE_VALUE_ABSTRACT_ATTRIBUTE_FOR_POSITION (   CLASS)
Value:
CLASS &CLASS::createForPosition(const IRPosition &IRP, Attributor &A) { \
CLASS *AA = nullptr; \
switch (IRP.getPositionKind()) { \
SWITCH_PK_INV(CLASS, IRP_INVALID, "invalid") \
SWITCH_PK_INV(CLASS, IRP_FUNCTION, "function") \
SWITCH_PK_INV(CLASS, IRP_CALL_SITE, "call site") \
SWITCH_PK_CREATE(CLASS, IRP, IRP_FLOAT, Floating) \
SWITCH_PK_CREATE(CLASS, IRP, IRP_ARGUMENT, Argument) \
SWITCH_PK_CREATE(CLASS, IRP, IRP_RETURNED, Returned) \
SWITCH_PK_CREATE(CLASS, IRP, IRP_CALL_SITE_RETURNED, CallSiteReturned) \
SWITCH_PK_CREATE(CLASS, IRP, IRP_CALL_SITE_ARGUMENT, CallSiteArgument) \
} \
AA->initialize(A); \
return *AA; \
}
This class represents an incoming formal argument to a Function.
Definition: Argument.h:29
The fixpoint analysis framework that orchestrates the attribute deduction.
Definition: Attributor.h:569
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
Kind getPositionKind() const
Return the associated position kind.
Definition: Attributor.h:351

Definition at line 2828 of file Attributor.cpp.

◆ DEBUG_TYPE

#define DEBUG_TYPE   "attributor"

Definition at line 44 of file Attributor.cpp.

◆ STATS_DECL

#define STATS_DECL (   NAME,
  TYPE,
  MSG 
)    STATISTIC(BUILD_STAT_NAME(NAME, TYPE), MSG);

Definition at line 73 of file Attributor.cpp.

Referenced by AAIsDeadFunction::trackStatistics().

◆ STATS_DECLTRACK

#define STATS_DECLTRACK (   NAME,
  TYPE,
  MSG 
)
Value:
{ \
STATS_DECL(NAME, TYPE, MSG) \
STATS_TRACK(NAME, TYPE) \
}

Definition at line 75 of file Attributor.cpp.

Referenced by AAReturnedValuesImpl::manifest().

◆ STATS_DECLTRACK_ARG_ATTR

#define STATS_DECLTRACK_ARG_ATTR (   NAME)    STATS_DECLTRACK(NAME, Arguments, BUILD_STAT_MSG_IR_ATTR(arguments, NAME))

◆ STATS_DECLTRACK_CS_ATTR

#define STATS_DECLTRACK_CS_ATTR (   NAME)    STATS_DECLTRACK(NAME, CS, BUILD_STAT_MSG_IR_ATTR(call site, NAME))

Definition at line 87 of file Attributor.cpp.

◆ STATS_DECLTRACK_CSARG_ATTR

#define STATS_DECLTRACK_CSARG_ATTR (   NAME)
Value:
STATS_DECLTRACK(NAME, CSArguments, \
BUILD_STAT_MSG_IR_ATTR(call site arguments, NAME))
#define BUILD_STAT_MSG_IR_ATTR(TYPE, NAME)
Definition: Attributor.cpp:70
#define STATS_DECLTRACK(NAME, TYPE, MSG)
Definition: Attributor.cpp:75

Definition at line 82 of file Attributor.cpp.

Referenced by AANonNullCallSiteArgument::trackStatistics(), AADereferenceableCallSiteArgument::trackStatistics(), and AAAlignCallSiteArgument::trackStatistics().

◆ STATS_DECLTRACK_CSRET_ATTR

#define STATS_DECLTRACK_CSRET_ATTR (   NAME)
Value:
STATS_DECLTRACK(NAME, CSReturn, \
BUILD_STAT_MSG_IR_ATTR(call site returns, NAME))
#define BUILD_STAT_MSG_IR_ATTR(TYPE, NAME)
Definition: Attributor.cpp:70
#define STATS_DECLTRACK(NAME, TYPE, MSG)
Definition: Attributor.cpp:75

Definition at line 92 of file Attributor.cpp.

Referenced by AANonNullCallSiteReturned::trackStatistics().

◆ STATS_DECLTRACK_FLOATING_ATTR

#define STATS_DECLTRACK_FLOATING_ATTR (   NAME)
Value:
STATS_DECLTRACK(NAME, Floating, \
("Number of floating values known to be '" #NAME "'"))
#define STATS_DECLTRACK(NAME, TYPE, MSG)
Definition: Attributor.cpp:75

Definition at line 95 of file Attributor.cpp.

Referenced by AANoAliasFloating::trackStatistics(), AADereferenceableFloating::trackStatistics(), and AAAlignFloating::trackStatistics().

◆ STATS_DECLTRACK_FN_ATTR

#define STATS_DECLTRACK_FN_ATTR (   NAME)    STATS_DECLTRACK(NAME, Function, BUILD_STAT_MSG_IR_ATTR(functions, NAME))

◆ STATS_DECLTRACK_FNRET_ATTR

#define STATS_DECLTRACK_FNRET_ATTR (   NAME)
Value:
STATS_DECLTRACK(NAME, FunctionReturn, \
BUILD_STAT_MSG_IR_ATTR(function returns, NAME))
#define BUILD_STAT_MSG_IR_ATTR(TYPE, NAME)
Definition: Attributor.cpp:70
#define STATS_DECLTRACK(NAME, TYPE, MSG)
Definition: Attributor.cpp:75

Definition at line 89 of file Attributor.cpp.

Referenced by AANonNullFloating::trackStatistics(), AANonNullReturned::trackStatistics(), AANoAliasReturned::trackStatistics(), AADereferenceableReturned::trackStatistics(), and AAAlignReturned::trackStatistics().

◆ STATS_TRACK

#define STATS_TRACK (   NAME,
  TYPE 
)    ++(BUILD_STAT_NAME(NAME, TYPE));

Definition at line 74 of file Attributor.cpp.

◆ SWITCH_PK_CREATE

#define SWITCH_PK_CREATE (   CLASS,
  IRP,
  PK,
  SUFFIX 
)
Value:
case IRPosition::PK: \
AA = new CLASS##SUFFIX(IRP); \
break;

Definition at line 2806 of file Attributor.cpp.

◆ SWITCH_PK_INV

#define SWITCH_PK_INV (   CLASS,
  PK,
  POS_NAME 
)
Value:
case IRPosition::PK: \
llvm_unreachable("Cannot create " #CLASS " for a " POS_NAME " position!");

Definition at line 2802 of file Attributor.cpp.

Typedef Documentation

◆ AAAlignCallSiteReturned

Align attribute deduction for a call site return value.

Definition at line 2146 of file Attributor.cpp.

◆ AADereferenceableCallSiteReturned

Dereferenceable attribute deduction for a call site return value.

Definition at line 2044 of file Attributor.cpp.

◆ AAIsDeadCallSite

Liveness information for a call sites.

Definition at line 1889 of file Attributor.cpp.

◆ AANoAliasCallSiteReturned

NoAlias attribute deduction for a call site return value.

Definition at line 1564 of file Attributor.cpp.

◆ AANoFreeCallSite

NoFree attribute deduction for a call sites.

Definition at line 1242 of file Attributor.cpp.

◆ AANoRecurseCallSite

Definition at line 1383 of file Attributor.cpp.

◆ AANoReturnCallSite

NoReturn attribute deduction for a call sites.

Definition at line 2181 of file Attributor.cpp.

◆ AANoSyncCallSite

NoSync attribute deduction for a call sites.

Definition at line 1198 of file Attributor.cpp.

◆ AANoUnwindCallSite

NoUnwind attribute deduction for a call sites.

Definition at line 671 of file Attributor.cpp.

◆ AAReturnedValuesCallSite

Returned values information for a call sites.

Definition at line 1025 of file Attributor.cpp.

◆ AAWillReturnCallSite

WillReturn attribute deduction for a call sites.

Definition at line 1459 of file Attributor.cpp.

Function Documentation

◆ addIfNotExistent()

static bool addIfNotExistent ( LLVMContext Ctx,
const Attribute Attr,
AttributeList Attrs,
int  AttrIdx 
)
static

Return true if the information provided by Attr was added to the attribute list Attrs.

This is only the case if it was not already present in Attrs at the position describe by PK and AttrIdx.

Definition at line 229 of file Attributor.cpp.

References llvm::AttributeList::addAttribute(), llvm::AttributeList::getAttribute(), llvm::Attribute::getKindAsEnum(), llvm::Attribute::getKindAsString(), llvm::AttributeList::hasAttribute(), llvm::Attribute::isEnumAttribute(), isEqualOrWorse(), llvm::Attribute::isIntAttribute(), llvm::Attribute::isStringAttribute(), llvm_unreachable, and llvm::AttributeList::removeAttribute().

Referenced by llvm::IRAttributeManifest::manifestAttrs().

◆ checkAndRegisterAA()

template<typename AAType >
static const AAType* checkAndRegisterAA ( const IRPosition IRP,
Attributor A,
DenseSet< const char *> *  Whitelist 
)
static

Helper function that checks if an abstract attribute of type AAType should be created for IR position IRP and if so creates and registers it with the Attributor A.

This method will look at the provided whitelist. If one is given and the kind AAType::ID is not contained, no abstract attribute is created.

Returns
The created abstract argument, or nullptr if none was created.

Definition at line 2524 of file Attributor.cpp.

References llvm::detail::DenseSetImpl< ValueT, DenseMap< ValueT, detail::DenseSetEmpty, ValueInfoT, detail::DenseSetPair< ValueT > >, ValueInfoT >::count(), and llvm::Attributor::registerAA().

◆ clampCallSiteArgumentStates()

template<typename AAType , typename StateType = typename AAType::StateType>
static void clampCallSiteArgumentStates ( Attributor A,
const AAType &  QueryingAA,
StateType &  S 
)
static

Clamp the information known at all call sites for a given argument (identified by QueryingAA) into S.

Definition at line 543 of file Attributor.cpp.

References assert(), llvm::IRPosition::callsite_argument(), llvm::Attributor::checkForAllCallSites(), llvm::dbgs(), llvm::Attributor::getAAFor(), llvm::IRPosition::IRP_ARGUMENT, LLVM_DEBUG, and T.

◆ clampReturnedValueStates()

template<typename AAType , typename StateType = typename AAType::StateType>
static void clampReturnedValueStates ( Attributor A,
const AAType &  QueryingAA,
StateType &  S 
)
static

◆ clampStateAndIndicateChange()

template<typename StateType >
ChangeStatus clampStateAndIndicateChange ( StateType &  S,
const StateType &  R 
)

Helper functions to clamp a state S of type StateType with the information in R and indicate/return if S did change (as-in update is required to be run again).

{

Referenced by llvm::IRPosition::getAttrs(), AACallSiteReturnedFromReturned< AANonNull, AANonNullImpl >::updateImpl(), AANonNullFloating::updateImpl(), AADereferenceableFloating::updateImpl(), and AAAlignFloating::updateImpl().

◆ clampStateAndIndicateChange< BooleanState >()

Definition at line 476 of file Attributor.cpp.

References clampStateAndIndicateChange< IntegerState >().

◆ clampStateAndIndicateChange< DerefState >()

-----------------— Dereferenceable Argument Attribute -----------------—

Definition at line 1894 of file Attributor.cpp.

References clampStateAndIndicateChange< IntegerState >().

◆ clampStateAndIndicateChange< IntegerState >()

◆ containsCycle()

static bool containsCycle ( Function F)
static

---------------------— Will-Return Attributes -------------------------—

Definition at line 1389 of file Attributor.cpp.

References llvm::SmallPtrSetImpl< PtrType >::count(), llvm::depth_first(), llvm::SmallPtrSetImpl< PtrType >::insert(), and llvm::successors().

Referenced by containsPossiblyEndlessLoop().

◆ containsPossiblyEndlessLoop()

static bool containsPossiblyEndlessLoop ( Function F)
static

◆ genericValueTraversal()

template<typename AAType , typename StateTy >
bool genericValueTraversal ( Attributor A,
IRPosition  IRP,
const AAType &  QueryingAA,
StateTy State,
const function_ref< bool(Value &, StateTy &, bool)> &  VisitValueCB,
int  MaxValues = 8 
)

}

Recursively visit all values that might become IRP at some point. This will be done by looking through cast instructions, selects, phis, and calls with the "returned" attribute. Once we cannot look through the value any further, the callback VisitValueCB is invoked and passed the current value, the State, and a flag to indicate if we stripped anything. To limit how much effort is invested, we will never visit more values than specified by MaxValues.

Definition at line 142 of file Attributor.cpp.

References Arg, llvm::Function::args(), assert(), llvm::SmallVectorBase::empty(), llvm::IRPosition::function(), llvm::Attributor::getAAFor(), llvm::IRPosition::getAnchorScope(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, CallBrTy, IterTy >::getArgOperand(), llvm::IRPosition::getAssociatedValue(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, CallBrTy, IterTy >::getCalledFunction(), llvm::BasicBlock::getTerminator(), llvm::Value::getType(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::AAIsDead::isAssumedDead(), llvm::Type::isPointerTy(), llvm::SmallVectorImpl< T >::pop_back_val(), llvm::SmallVectorTemplateBase< T >::push_back(), SI, and llvm::Value::stripPointerCasts().

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( AttributorLegacyPass  ,
"attributor"  ,
"Deduce and propagate attributes ,
false  ,
false   
)

◆ isEqualOrWorse()

static bool isEqualOrWorse ( const Attribute New,
const Attribute Old 
)
static

Return true if New is equal or worse than Old.

Definition at line 219 of file Attributor.cpp.

References llvm::Attribute::getValueAsInt(), and llvm::Attribute::isIntAttribute().

Referenced by addIfNotExistent().

◆ runAttributorOnModule()

static bool runAttributorOnModule ( Module M)
static

}


Pass (Manager) Boilerplate

Definition at line 2711 of file Attributor.cpp.

References llvm::CHANGED, llvm::dbgs(), DisableAttributor, F(), llvm::Module::getDataLayout(), LLVM_DEBUG, and llvm::Module::size().

Referenced by llvm::AttributorPass::run().

◆ STATISTIC() [1/5]

STATISTIC ( NumFnWithExactDefinition  ,
"Number of function with exact definitions"   
)

◆ STATISTIC() [2/5]

STATISTIC ( NumFnWithoutExactDefinition  ,
"Number of function without exact definitions"   
)

◆ STATISTIC() [3/5]

STATISTIC ( NumAttributesTimedOut  ,
"Number of abstract attributes timed out before fixpoint"   
)

◆ STATISTIC() [4/5]

STATISTIC ( NumAttributesValidFixpoint  ,
"Number of abstract attributes in a valid fixpoint state"   
)

◆ STATISTIC() [5/5]

STATISTIC ( NumAttributesManifested  ,
"Number of abstract attributes manifested in IR  
)

Variable Documentation

◆ attributes

Deduce and propagate attributes

Definition at line 2866 of file Attributor.cpp.

Referenced by FunctionNumber(), and llvm::LTOModule::getSymbolAttributes().

◆ attributor

attributor

Definition at line 2866 of file Attributor.cpp.

◆ DisableAttributor

cl::opt<bool> DisableAttributor("attributor-disable", cl::Hidden, cl::desc("Disable the attributor inter-procedural deduction pass."), cl::init(true))
static

Referenced by runAttributorOnModule().

◆ false

Deduce and propagate false

Definition at line 2866 of file Attributor.cpp.

◆ MaxFixpointIterations

cl::opt<unsigned> MaxFixpointIterations("attributor-max-iterations", cl::Hidden, cl::desc("Maximal number of fixpoint iterations."), cl::init(32))
static

Referenced by llvm::Attributor::run().

◆ VerifyAttributor

cl::opt<bool> VerifyAttributor("attributor-verify", cl::Hidden, cl::desc("Verify the Attributor deduction and " "manifestation of attributes -- may issue false-positive errors"), cl::init(false))
static

Referenced by llvm::Attributor::run().