LLVM
8.0.1
|
Functions | |
bool | canCoerceMustAliasedValueToLoad (Value *StoredVal, Type *LoadTy, const DataLayout &DL) |
Return true if CoerceAvailableValueToLoadType would succeed if it was called. More... | |
Value * | coerceAvailableValueToLoadType (Value *StoredVal, Type *LoadedTy, IRBuilder<> &IRB, const DataLayout &DL) |
If we saw a store of a value to memory, and then a load from a must-aliased pointer of a different type, try to coerce the stored value to the loaded type. More... | |
int | analyzeLoadFromClobberingStore (Type *LoadTy, Value *LoadPtr, StoreInst *DepSI, const DataLayout &DL) |
This function determines whether a value for the pointer LoadPtr can be extracted from the store at DepSI. More... | |
int | analyzeLoadFromClobberingLoad (Type *LoadTy, Value *LoadPtr, LoadInst *DepLI, const DataLayout &DL) |
This function determines whether a value for the pointer LoadPtr can be extracted from the load at DepLI. More... | |
int | analyzeLoadFromClobberingMemInst (Type *LoadTy, Value *LoadPtr, MemIntrinsic *DepMI, const DataLayout &DL) |
This function determines whether a value for the pointer LoadPtr can be extracted from the memory intrinsic at DepMI. More... | |
Value * | getStoreValueForLoad (Value *SrcVal, unsigned Offset, Type *LoadTy, Instruction *InsertPt, const DataLayout &DL) |
If analyzeLoadFromClobberingStore returned an offset, this function can be used to actually perform the extraction of the bits from the store. More... | |
Constant * | getConstantStoreValueForLoad (Constant *SrcVal, unsigned Offset, Type *LoadTy, const DataLayout &DL) |
Value * | getLoadValueForLoad (LoadInst *SrcVal, unsigned Offset, Type *LoadTy, Instruction *InsertPt, const DataLayout &DL) |
If analyzeLoadFromClobberingLoad returned an offset, this function can be used to actually perform the extraction of the bits from the load, including any necessary load widening. More... | |
Constant * | getConstantLoadValueForLoad (Constant *SrcVal, unsigned Offset, Type *LoadTy, const DataLayout &DL) |
Value * | getMemInstValueForLoad (MemIntrinsic *SrcInst, unsigned Offset, Type *LoadTy, Instruction *InsertPt, const DataLayout &DL) |
If analyzeLoadFromClobberingMemInst returned an offset, this function can be used to actually perform the extraction of the bits from the memory intrinsic. More... | |
Constant * | getConstantMemInstValueForLoad (MemIntrinsic *SrcInst, unsigned Offset, Type *LoadTy, const DataLayout &DL) |
template<class T , class HelperClass > | |
static T * | coerceAvailableValueToLoadTypeHelper (T *StoredVal, Type *LoadedTy, HelperClass &Helper, const DataLayout &DL) |
static int | analyzeLoadFromClobberingWrite (Type *LoadTy, Value *LoadPtr, Value *WritePtr, uint64_t WriteSizeInBits, const DataLayout &DL) |
This function is called when we have a memdep query of a load that ends up being a clobbering memory write (store, memset, memcpy, memmove). More... | |
template<class T , class HelperClass > | |
static T * | getStoreValueForLoadHelper (T *SrcVal, unsigned Offset, Type *LoadTy, HelperClass &Helper, const DataLayout &DL) |
template<class T , class HelperClass > | |
T * | getMemInstValueForLoadHelper (MemIntrinsic *SrcInst, unsigned Offset, Type *LoadTy, HelperClass &Helper, const DataLayout &DL) |
int llvm::VNCoercion::analyzeLoadFromClobberingLoad | ( | Type * | LoadTy, |
Value * | LoadPtr, | ||
LoadInst * | DepLI, | ||
const DataLayout & | DL | ||
) |
This function determines whether a value for the pointer LoadPtr can be extracted from the load at DepLI.
This function is called when we have a memdep query of a load that ends up being clobbered by another load.
On success, it returns the offset into DepLI that extraction would start. On failure, it returns -1.
See if the other load can feed into the second load.
Definition at line 225 of file VNCoercion.cpp.
References analyzeLoadFromClobberingWrite(), assert(), llvm::MemoryDependenceResults::getLoadLoadClobberFullWidthSize(), llvm::GetPointerBaseWithConstantOffset(), llvm::LoadInst::getPointerOperand(), llvm::Value::getType(), llvm::DataLayout::getTypeSizeInBits(), llvm::DataLayout::getTypeStoreSize(), llvm::Type::isArrayTy(), llvm::Type::isIntegerTy(), llvm::LoadInst::isSimple(), llvm::Type::isStructTy(), and Size.
Referenced by alwaysAvailable(), and reportMayClobberedLoad().
int llvm::VNCoercion::analyzeLoadFromClobberingMemInst | ( | Type * | LoadTy, |
Value * | LoadPtr, | ||
MemIntrinsic * | DepMI, | ||
const DataLayout & | DL | ||
) |
This function determines whether a value for the pointer LoadPtr can be extracted from the memory intrinsic at DepMI.
On success, it returns the offset into DepMI that extraction would start. On failure, it returns -1.
Definition at line 257 of file VNCoercion.cpp.
References analyzeLoadFromClobberingWrite(), llvm::ConstantFoldLoadFromConstPtr(), llvm::dyn_cast(), llvm::ConstantInt::get(), llvm::PointerType::get(), llvm::ConstantExpr::getBitCast(), llvm::MemIntrinsicBase< Derived >::getDest(), llvm::ConstantExpr::getGetElementPtr(), llvm::Type::getInt64Ty(), llvm::Type::getInt8PtrTy(), llvm::Type::getInt8Ty(), llvm::IntrinsicInst::getIntrinsicID(), llvm::MemIntrinsicBase< Derived >::getLength(), llvm::MemTransferBase< BaseCL >::getSource(), llvm::GetUnderlyingObject(), llvm::ConstantInt::getZExtValue(), llvm::GlobalVariable::isConstant(), llvm::Intrinsic::memset, and MI.
Referenced by alwaysAvailable(), and reportMayClobberedLoad().
int llvm::VNCoercion::analyzeLoadFromClobberingStore | ( | Type * | LoadTy, |
Value * | LoadPtr, | ||
StoreInst * | DepSI, | ||
const DataLayout & | DL | ||
) |
This function determines whether a value for the pointer LoadPtr can be extracted from the store at DepSI.
This function is called when we have a memdep query of a load that ends up being a clobbering store.
On success, it returns the offset into DepSI that extraction would start. On failure, it returns -1.
Definition at line 208 of file VNCoercion.cpp.
References analyzeLoadFromClobberingWrite(), llvm::StoreInst::getPointerOperand(), llvm::Value::getType(), llvm::DataLayout::getTypeSizeInBits(), llvm::StoreInst::getValueOperand(), llvm::Type::isArrayTy(), and llvm::Type::isStructTy().
Referenced by alwaysAvailable(), and reportMayClobberedLoad().
|
static |
This function is called when we have a memdep query of a load that ends up being a clobbering memory write (store, memset, memcpy, memmove).
This means that the write may provide bits used by the load but we can't be sure because the pointers don't must-alias.
Check this case to see if there is anything more we can do before we give up. This returns -1 if we have to give up, or a byte number in the stored value of the piece that feeds the load.
Definition at line 153 of file VNCoercion.cpp.
References llvm::GetPointerBaseWithConstantOffset(), llvm::DataLayout::getTypeSizeInBits(), llvm::Type::isArrayTy(), and llvm::Type::isStructTy().
Referenced by analyzeLoadFromClobberingLoad(), analyzeLoadFromClobberingMemInst(), and analyzeLoadFromClobberingStore().
bool llvm::VNCoercion::canCoerceMustAliasedValueToLoad | ( | Value * | StoredVal, |
Type * | LoadTy, | ||
const DataLayout & | DL | ||
) |
Return true if CoerceAvailableValueToLoadType would succeed if it was called.
Return true if coerceAvailableValueToLoadType will succeed.
Definition at line 15 of file VNCoercion.cpp.
References llvm::alignTo(), llvm::Value::getType(), llvm::DataLayout::getTypeSizeInBits(), llvm::Type::isArrayTy(), llvm::DataLayout::isNonIntegralPointerType(), and llvm::Type::isStructTy().
Referenced by coerceAvailableValueToLoadTypeHelper(), and reportMayClobberedLoad().
Value * llvm::VNCoercion::coerceAvailableValueToLoadType | ( | Value * | StoredVal, |
Type * | LoadedTy, | ||
IRBuilder<> & | IRB, | ||
const DataLayout & | DL | ||
) |
If we saw a store of a value to memory, and then a load from a must-aliased pointer of a different type, try to coerce the stored value to the loaded type.
If we saw a store of a value to memory, and then a load from a must-aliased pointer of a different type, try to coerce the stored value.
LoadedTy is the type of the load we want to replace. IRB is IRBuilder used to insert new instructions.
If we can't do it, return null.
Definition at line 140 of file VNCoercion.cpp.
References coerceAvailableValueToLoadTypeHelper().
|
static |
Definition at line 42 of file VNCoercion.cpp.
References assert(), C, canCoerceMustAliasedValueToLoad(), llvm::ConstantFoldConstant(), llvm::IntegerType::get(), llvm::ConstantInt::get(), llvm::Type::getContext(), llvm::DataLayout::getIntPtrType(), llvm::DataLayout::getTypeSizeInBits(), llvm::DataLayout::getTypeStoreSizeInBits(), llvm::DataLayout::isBigEndian(), llvm::Type::isIntegerTy(), and llvm::Type::isPtrOrPtrVectorTy().
Referenced by coerceAvailableValueToLoadType(), getConstantStoreValueForLoad(), getMemInstValueForLoadHelper(), and getStoreValueForLoad().
Constant * llvm::VNCoercion::getConstantLoadValueForLoad | ( | Constant * | SrcVal, |
unsigned | Offset, | ||
Type * | LoadTy, | ||
const DataLayout & | DL | ||
) |
Definition at line 415 of file VNCoercion.cpp.
References getConstantStoreValueForLoad(), llvm::Value::getType(), and llvm::DataLayout::getTypeStoreSize().
Referenced by alwaysAvailable().
Constant * llvm::VNCoercion::getConstantMemInstValueForLoad | ( | MemIntrinsic * | SrcInst, |
unsigned | Offset, | ||
Type * | LoadTy, | ||
const DataLayout & | DL | ||
) |
Constant * llvm::VNCoercion::getConstantStoreValueForLoad | ( | Constant * | SrcVal, |
unsigned | Offset, | ||
Type * | LoadTy, | ||
const DataLayout & | DL | ||
) |
Definition at line 357 of file VNCoercion.cpp.
References coerceAvailableValueToLoadTypeHelper(), F(), and getStoreValueForLoadHelper().
Referenced by alwaysAvailable(), and getConstantLoadValueForLoad().
Value * llvm::VNCoercion::getLoadValueForLoad | ( | LoadInst * | SrcVal, |
unsigned | Offset, | ||
Type * | LoadTy, | ||
Instruction * | InsertPt, | ||
const DataLayout & | DL | ||
) |
If analyzeLoadFromClobberingLoad returned an offset, this function can be used to actually perform the extraction of the bits from the load, including any necessary load widening.
This function is called when we have a memdep query of a load that ends up being a clobbering load.
It inserts instructions to do so at InsertPt, and returns the extracted value.
This means that the load may provide bits used by the load but we can't be sure because the pointers don't must-alias. Check this case to see if there is anything more we can do before we give up.
Definition at line 369 of file VNCoercion.cpp.
References assert(), llvm::dbgs(), llvm::IntegerType::get(), llvm::PointerType::get(), llvm::LoadInst::getAlignment(), llvm::Type::getContext(), llvm::Instruction::getDebugLoc(), llvm::Instruction::getParent(), llvm::Type::getPointerAddressSpace(), llvm::LoadInst::getPointerOperand(), getStoreValueForLoad(), llvm::Value::getType(), llvm::DataLayout::getTypeStoreSize(), llvm::DataLayout::isBigEndian(), llvm::Type::isIntegerTy(), llvm::isPowerOf2_32(), llvm::LoadInst::isSimple(), LLVM_DEBUG, llvm::NextPowerOf2(), llvm::Value::replaceAllUsesWith(), llvm::LoadInst::setAlignment(), and llvm::Value::takeName().
Referenced by llvm::gvn::AvailableValue::MaterializeAdjustedValue().
Value * llvm::VNCoercion::getMemInstValueForLoad | ( | MemIntrinsic * | SrcInst, |
unsigned | Offset, | ||
Type * | LoadTy, | ||
Instruction * | InsertPt, | ||
const DataLayout & | DL | ||
) |
If analyzeLoadFromClobberingMemInst returned an offset, this function can be used to actually perform the extraction of the bits from the memory intrinsic.
This function is called when we have a memdep query of a load that ends up being a clobbering mem intrinsic.
It inserts instructions to do so at InsertPt, and returns the extracted value.
Definition at line 481 of file VNCoercion.cpp.
Referenced by llvm::gvn::AvailableValue::MaterializeAdjustedValue().
T* llvm::VNCoercion::getMemInstValueForLoadHelper | ( | MemIntrinsic * | SrcInst, |
unsigned | Offset, | ||
Type * | LoadTy, | ||
HelperClass & | Helper, | ||
const DataLayout & | DL | ||
) |
Definition at line 425 of file VNCoercion.cpp.
References coerceAvailableValueToLoadTypeHelper(), llvm::ConstantFoldLoadFromConstPtr(), llvm::IntegerType::get(), llvm::ConstantInt::get(), llvm::PointerType::get(), llvm::ConstantExpr::getBitCast(), llvm::Type::getContext(), llvm::ConstantExpr::getGetElementPtr(), llvm::Type::getInt64Ty(), llvm::Type::getInt8PtrTy(), llvm::Type::getInt8Ty(), llvm::Type::getPointerAddressSpace(), llvm::MemTransferBase< BaseCL >::getSource(), llvm::Value::getType(), and llvm::DataLayout::getTypeSizeInBits().
Value * llvm::VNCoercion::getStoreValueForLoad | ( | Value * | SrcVal, |
unsigned | Offset, | ||
Type * | LoadTy, | ||
Instruction * | InsertPt, | ||
const DataLayout & | DL | ||
) |
If analyzeLoadFromClobberingStore returned an offset, this function can be used to actually perform the extraction of the bits from the store.
This function is called when we have a memdep query of a load that ends up being a clobbering store.
It inserts instructions to do so at InsertPt, and returns the extracted value.
This means that the store provides bits used by the load but the pointers don't must-alias. Check this case to see if there is anything more we can do before we give up.
Definition at line 349 of file VNCoercion.cpp.
References coerceAvailableValueToLoadTypeHelper(), and getStoreValueForLoadHelper().
Referenced by getLoadValueForLoad(), and llvm::gvn::AvailableValue::MaterializeAdjustedValue().
|
static |
Definition at line 306 of file VNCoercion.cpp.
References llvm::IntegerType::get(), llvm::ConstantInt::get(), llvm::DataLayout::getIntPtrType(), llvm::DataLayout::getTypeSizeInBits(), llvm::DataLayout::isLittleEndian(), and llvm::Type::isPointerTy().
Referenced by getConstantStoreValueForLoad(), and getStoreValueForLoad().