X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FAnalysis%2FLoads.cpp;fp=lib%2FAnalysis%2FLoads.cpp;h=5aa6068b56a765c9fcd993671981043a68596b6e;hb=652627d301e4319aacbe0513f5256dd08ee3249b;hp=13be270a8528e0df76e9d6fde8225fbb2997e28f;hpb=dacb8a615d023cfc1086d69895b7ff5236ac4cff;p=oota-llvm.git diff --git a/lib/Analysis/Loads.cpp b/lib/Analysis/Loads.cpp index 13be270a852..5aa6068b56a 100644 --- a/lib/Analysis/Loads.cpp +++ b/lib/Analysis/Loads.cpp @@ -62,10 +62,10 @@ static bool AreEquivalentAddressValues(const Value *A, const Value *B) { /// This uses the pointee type to determine how many bytes need to be safe to /// load from the pointer. bool llvm::isSafeToLoadUnconditionally(Value *V, Instruction *ScanFrom, - unsigned Align, const DataLayout *TD) { + unsigned Align, const DataLayout *DL) { int64_t ByteOffset = 0; Value *Base = V; - Base = GetPointerBaseWithConstantOffset(V, ByteOffset, TD); + Base = GetPointerBaseWithConstantOffset(V, ByteOffset, DL); if (ByteOffset < 0) // out of bounds return false; @@ -86,17 +86,17 @@ bool llvm::isSafeToLoadUnconditionally(Value *V, Instruction *ScanFrom, } if (BaseType && BaseType->isSized()) { - if (TD && BaseAlign == 0) - BaseAlign = TD->getPrefTypeAlignment(BaseType); + if (DL && BaseAlign == 0) + BaseAlign = DL->getPrefTypeAlignment(BaseType); if (Align <= BaseAlign) { - if (!TD) + if (!DL) return true; // Loading directly from an alloca or global is OK. // Check if the load is within the bounds of the underlying object. PointerType *AddrTy = cast(V->getType()); - uint64_t LoadSize = TD->getTypeStoreSize(AddrTy->getElementType()); - if (ByteOffset + LoadSize <= TD->getTypeAllocSize(BaseType) && + uint64_t LoadSize = DL->getTypeStoreSize(AddrTy->getElementType()); + if (ByteOffset + LoadSize <= DL->getTypeAllocSize(BaseType) && (Align == 0 || (ByteOffset % Align) == 0)) return true; }