LLVM 22.0.0git
Loads.cpp File Reference

Go to the source code of this file.

Functions

static bool isAligned (const Value *Base, Align Alignment, const DataLayout &DL)
static bool isDereferenceableAndAlignedPointerViaAssumption (const Value *Ptr, Align Alignment, function_ref< bool(const RetainedKnowledge &RK)> CheckSize, const DataLayout &DL, const Instruction *CtxI, AssumptionCache *AC, const DominatorTree *DT)
static bool isDereferenceableAndAlignedPointer (const Value *V, Align Alignment, const APInt &Size, const DataLayout &DL, const Instruction *CtxI, AssumptionCache *AC, const DominatorTree *DT, const TargetLibraryInfo *TLI, SmallPtrSetImpl< const Value * > &Visited, unsigned MaxDepth)
 Test if V is always a pointer to allocated and suitably aligned memory for a simple load or store.
static bool AreEquivalentAddressValues (const Value *A, const Value *B)
 Test if A and B will obviously have the same value.
static bool suppressSpeculativeLoadForSanitizers (const Instruction &CtxI)
static bool areNonOverlapSameBaseLoadAndStore (const Value *LoadPtr, Type *LoadTy, const Value *StorePtr, Type *StoreTy, const DataLayout &DL)
static ValuegetAvailableLoadStore (Instruction *Inst, const Value *Ptr, Type *AccessTy, bool AtLeastAtomic, const DataLayout &DL, bool *IsLoadCSE)
static bool isPointerUseReplacable (const Use &U)
static bool isPointerAlwaysReplaceable (const Value *From, const Value *To, const DataLayout &DL)

Function Documentation

◆ AreEquivalentAddressValues()

bool AreEquivalentAddressValues ( const Value * A,
const Value * B )
static

Test if A and B will obviously have the same value.

This includes recognizing that t0 and t1 will have the same value in code like this:

%t0 = getelementptr \@a, 0, 3
store i32 0, i32* %t0
%t1 = getelementptr \@a, 0, 3
%t2 = load i32* %t1
AMDGPU Mark last scratch load

Definition at line 270 of file Loads.cpp.

References A(), B(), llvm::cast(), llvm::dyn_cast(), and llvm::isa().

Referenced by getAvailableLoadStore(), and llvm::isSafeToLoadUnconditionally().

◆ areNonOverlapSameBaseLoadAndStore()

bool areNonOverlapSameBaseLoadAndStore ( const Value * LoadPtr,
Type * LoadTy,
const Value * StorePtr,
Type * StoreTy,
const DataLayout & DL )
static

◆ getAvailableLoadStore()

◆ isAligned()

bool isAligned ( const Value * Base,
Align Alignment,
const DataLayout & DL )
static

Definition at line 30 of file Loads.cpp.

References llvm::sampleprof::Base, and DL.

◆ isDereferenceableAndAlignedPointer()

bool isDereferenceableAndAlignedPointer ( const Value * V,
Align Alignment,
const APInt & Size,
const DataLayout & DL,
const Instruction * CtxI,
AssumptionCache * AC,
const DominatorTree * DT,
const TargetLibraryInfo * TLI,
SmallPtrSetImpl< const Value * > & Visited,
unsigned MaxDepth )
static

◆ isDereferenceableAndAlignedPointerViaAssumption()

bool isDereferenceableAndAlignedPointerViaAssumption ( const Value * Ptr,
Align Alignment,
function_ref< bool(const RetainedKnowledge &RK)> CheckSize,
const DataLayout & DL,
const Instruction * CtxI,
AssumptionCache * AC,
const DominatorTree * DT )
static

Look through assumes to see if both dereferencability and alignment can be proven by an assume if needed.

Definition at line 35 of file Loads.cpp.

References llvm::RetainedKnowledge::ArgValue, llvm::RetainedKnowledge::AttrKind, DL, llvm::getKnowledgeForValue(), llvm::isValidAssumeForContext(), Ptr, and llvm::Align::value().

Referenced by llvm::isDereferenceableAndAlignedInLoop(), and isDereferenceableAndAlignedPointer().

◆ isPointerAlwaysReplaceable()

◆ isPointerUseReplacable()

bool isPointerUseReplacable ( const Use & U)
static

◆ suppressSpeculativeLoadForSanitizers()

bool suppressSpeculativeLoadForSanitizers ( const Instruction & CtxI)
static