forked from OSchip/llvm-project
Use uint64_t instead of unsigned for offsets and sizes.
llvm-svn: 94835
This commit is contained in:
parent
23a71a1cdf
commit
34e10c2218
|
@ -44,7 +44,7 @@ using namespace llvm;
|
||||||
/// This is closely related to Value::getUnderlyingObject but is located
|
/// This is closely related to Value::getUnderlyingObject but is located
|
||||||
/// here to avoid making VMCore depend on TargetData.
|
/// here to avoid making VMCore depend on TargetData.
|
||||||
static Value *getUnderlyingObjectWithOffset(Value *V, const TargetData *TD,
|
static Value *getUnderlyingObjectWithOffset(Value *V, const TargetData *TD,
|
||||||
unsigned &ByteOffset,
|
uint64_t &ByteOffset,
|
||||||
unsigned MaxLookup = 6) {
|
unsigned MaxLookup = 6) {
|
||||||
if (!isa<PointerType>(V->getType()))
|
if (!isa<PointerType>(V->getType()))
|
||||||
return V;
|
return V;
|
||||||
|
@ -76,7 +76,7 @@ static Value *getUnderlyingObjectWithOffset(Value *V, const TargetData *TD,
|
||||||
/// ScanFrom, to determine if the address is already accessed.
|
/// ScanFrom, to determine if the address is already accessed.
|
||||||
bool llvm::isSafeToLoadUnconditionally(Value *V, Instruction *ScanFrom,
|
bool llvm::isSafeToLoadUnconditionally(Value *V, Instruction *ScanFrom,
|
||||||
const TargetData *TD) {
|
const TargetData *TD) {
|
||||||
unsigned ByteOffset = 0;
|
uint64_t ByteOffset = 0;
|
||||||
Value *Base = V;
|
Value *Base = V;
|
||||||
if (TD)
|
if (TD)
|
||||||
Base = getUnderlyingObjectWithOffset(V, TD, ByteOffset);
|
Base = getUnderlyingObjectWithOffset(V, TD, ByteOffset);
|
||||||
|
@ -98,7 +98,7 @@ bool llvm::isSafeToLoadUnconditionally(Value *V, Instruction *ScanFrom,
|
||||||
if (BaseType->isSized()) {
|
if (BaseType->isSized()) {
|
||||||
// Check if the load is within the bounds of the underlying object.
|
// Check if the load is within the bounds of the underlying object.
|
||||||
const PointerType *AddrTy = cast<PointerType>(V->getType());
|
const PointerType *AddrTy = cast<PointerType>(V->getType());
|
||||||
unsigned LoadSize = TD->getTypeStoreSize(AddrTy->getElementType());
|
uint64_t LoadSize = TD->getTypeStoreSize(AddrTy->getElementType());
|
||||||
if (ByteOffset + LoadSize <= TD->getTypeAllocSize(BaseType))
|
if (ByteOffset + LoadSize <= TD->getTypeAllocSize(BaseType))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue