LLVM  14.0.0git
Namespaces | Functions
llvm::AA Namespace Reference

Abstract Attribute helper functions. More...

Namespaces

 PointerInfo
 

Functions

bool isDynamicallyUnique (Attributor &A, const AbstractAttribute &QueryingAA, const Value &V)
 Return true if V is dynamically unique, that is, there are no two "instances" of V at runtime with different values. More...
 
bool isValidInScope (const Value &V, const Function *Scope)
 Return true if V is a valid value in Scope, that is a constant or an instruction/argument of Scope. More...
 
bool isValidAtPosition (const Value &V, const Instruction &CtxI, InformationCache &InfoCache)
 Return true if V is a valid value at position CtxI, that is a constant, an argument of the same function as CtxI, or an instruction in that function that dominates CtxI. More...
 
ValuegetWithType (Value &V, Type &Ty)
 Try to convert V to type Ty without introducing new instructions. More...
 
Optional< Value * > combineOptionalValuesInAAValueLatice (const Optional< Value * > &A, const Optional< Value * > &B, Type *Ty)
 Return the combination of A and B such that the result is a possible value of both. More...
 
ConstantgetInitialValueForObj (Value &Obj, Type &Ty)
 Return the initial value of Obj with type Ty if that is a constant. More...
 
bool getAssumedUnderlyingObjects (Attributor &A, const Value &Ptr, SmallVectorImpl< Value * > &Objects, const AbstractAttribute &QueryingAA, const Instruction *CtxI)
 Collect all potential underlying objects of Ptr at position CtxI in Objects. More...
 
bool getPotentialCopiesOfStoredValue (Attributor &A, StoreInst &SI, SmallSetVector< Value *, 4 > &PotentialCopies, const AbstractAttribute &QueryingAA, bool &UsedAssumedInformation)
 Collect all potential values of the one stored by SI into PotentialCopies. More...
 

Detailed Description

Abstract Attribute helper functions.

Function Documentation

◆ combineOptionalValuesInAAValueLatice()

Optional< Value * > llvm::AA::combineOptionalValuesInAAValueLatice ( const Optional< Value * > &  A,
const Optional< Value * > &  B,
Type Ty 
)

Return the combination of A and B such that the result is a possible value of both.

B is potentially casted to match the type Ty or the type of A if Ty is null.

Examples: X + none => X not_none + undef => not_none V1 + V2 => nullptr

Definition at line 265 of file Attributor.cpp.

References B, and getWithType().

Referenced by AAReturnedValuesImpl::getAssumedUniqueReturnValue(), AAValueSimplifyFloating::handleCmp(), AAValueSimplifyFloating::handleGenericInst(), llvm::AAPointerInfo::Access::operator&=(), llvm::ValueSimplifyStateType::unionAssumed(), AAValueSimplifyCallSiteReturned::updateImpl(), and AAValueSimplifyFloating::updateWithLoad().

◆ getAssumedUnderlyingObjects()

bool llvm::AA::getAssumedUnderlyingObjects ( Attributor A,
const Value Ptr,
SmallVectorImpl< Value * > &  Objects,
const AbstractAttribute QueryingAA,
const Instruction CtxI 
)

Collect all potential underlying objects of Ptr at position CtxI in Objects.

Assumed information is used and dependences onto QueryingAA are added appropriately.

Returns
True if Objects contains all assumed underlying objects, and false if something went wrong and the objects could not be determined.

Definition at line 393 of file AttributorAttributes.cpp.

References genericValueTraversal(), llvm::getUnderlyingObject(), llvm::SmallPtrSetImpl< PtrType >::insert(), and llvm::IRPosition::value().

Referenced by getPotentialCopiesOfStoredValue(), AAValueSimplifyImpl::handleLoad(), and AAHeapToStackFunction::updateImpl().

◆ getInitialValueForObj()

Constant * llvm::AA::getInitialValueForObj ( Value Obj,
Type Ty 
)

Return the initial value of Obj with type Ty if that is a constant.

Definition at line 205 of file Attributor.cpp.

References llvm::UndefValue::get(), and getWithType().

Referenced by AAValueSimplifyImpl::handleLoad().

◆ getPotentialCopiesOfStoredValue()

bool llvm::AA::getPotentialCopiesOfStoredValue ( Attributor A,
StoreInst SI,
SmallSetVector< Value *, 4 > &  PotentialCopies,
const AbstractAttribute QueryingAA,
bool &  UsedAssumedInformation 
)

Collect all potential values of the one stored by SI into PotentialCopies.

That is, the only copies that were made via the store are assumed to be known and all in PotentialCopies. Dependences onto QueryingAA are properly tracked, UsedAssumedInformation will inform the caller if assumed information was used.

Returns
True if the assumed potential copies are all in PotentialCopies, false if something went wrong and the copies could not be determined.

Definition at line 288 of file Attributor.cpp.

References llvm::dbgs(), getAssumedUnderlyingObjects(), llvm::Type::getPointerAddressSpace(), llvm::AAPointerInfo::Access::getRemoteInst(), llvm::Value::getType(), llvm::SetVector< T, Vector, Set >::insert(), llvm::AAPointerInfo::Access::isRead(), LLVM_DEBUG, llvm::NONE, llvm::NullPointerIsDefined(), llvm::OPTIONAL, SI, and llvm::IRPosition::value().

Referenced by AACaptureUseTracker::captured(), llvm::Attributor::checkForAllUses(), and AAIsDeadFloating::isDeadStore().

◆ getWithType()

Value * llvm::AA::getWithType ( Value V,
Type Ty 
)

◆ isDynamicallyUnique()

bool llvm::AA::isDynamicallyUnique ( Attributor A,
const AbstractAttribute QueryingAA,
const Value V 
)

Return true if V is dynamically unique, that is, there are no two "instances" of V at runtime with different values.

}

Definition at line 185 of file Attributor.cpp.

References llvm::IRPosition::function(), I, llvm::AANoRecurse::isAssumedNoRecurse(), and llvm::OPTIONAL.

Referenced by AAValueSimplifyImpl::handleLoad(), and AAValueSimplifyArgument::updateImpl().

◆ isValidAtPosition()

bool llvm::AA::isValidAtPosition ( const Value V,
const Instruction CtxI,
InformationCache InfoCache 
)

Return true if V is a valid value at position CtxI, that is a constant, an argument of the same function as CtxI, or an instruction in that function that dominates CtxI.

Definition at line 226 of file Attributor.cpp.

References llvm::DominatorTree::dominates(), llvm::InformationCache::getAnalysisResultForFunction(), llvm::Instruction::getFunction(), and I.

Referenced by AAValueSimplifyImpl::getReplacementValue(), and AAValueSimplifyImpl::handleLoad().

◆ isValidInScope()

bool llvm::AA::isValidInScope ( const Value V,
const Function Scope 
)

Return true if V is a valid value in Scope, that is a constant or an instruction/argument of Scope.

Definition at line 216 of file Attributor.cpp.

References I.

Referenced by AAValueSimplifyImpl::getReplacementValue(), and AAReturnedValuesImpl::updateImpl().