Change GetPointerBaseWithConstantOffset's DataLayout argument from a

reference to a pointer, so that it can handle the case where DataLayout
is not available and behave conservatively.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174024 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman
2013-01-31 02:00:45 +00:00
parent 8ed701da9a
commit a070d2a035
8 changed files with 60 additions and 61 deletions

View File

@@ -57,8 +57,7 @@ bool llvm::isSafeToLoadUnconditionally(Value *V, Instruction *ScanFrom,
unsigned Align, const DataLayout *TD) {
int64_t ByteOffset = 0;
Value *Base = V;
if (TD)
Base = GetPointerBaseWithConstantOffset(V, ByteOffset, *TD);
Base = GetPointerBaseWithConstantOffset(V, ByteOffset, TD);
if (ByteOffset < 0) // out of bounds
return false;