forked from OSchip/llvm-project
Fix pr6198 by moving the isSized() check to an outer conditional.
The testcase from pr6198 does not crash for me -- I don't know what's up with that -- so I'm not adding it to the tests. llvm-svn: 94984
This commit is contained in:
parent
de047f2051
commit
f65ba356e1
|
@ -95,13 +95,15 @@ bool llvm::isSafeToLoadUnconditionally(Value *V, Instruction *ScanFrom,
|
|||
BaseAlign = GV->getAlignment();
|
||||
}
|
||||
}
|
||||
if (TD && BaseType && BaseAlign == 0)
|
||||
BaseAlign = TD->getPrefTypeAlignment(BaseType);
|
||||
|
||||
if (BaseType && Align <= BaseAlign) {
|
||||
if (!TD)
|
||||
return true; // Loading directly from an alloca or global is OK.
|
||||
if (BaseType->isSized()) {
|
||||
if (BaseType && BaseType->isSized()) {
|
||||
if (TD && BaseAlign == 0)
|
||||
BaseAlign = TD->getPrefTypeAlignment(BaseType);
|
||||
|
||||
if (Align <= BaseAlign) {
|
||||
if (!TD)
|
||||
return true; // Loading directly from an alloca or global is OK.
|
||||
|
||||
// Check if the load is within the bounds of the underlying object.
|
||||
const PointerType *AddrTy = cast<PointerType>(V->getType());
|
||||
uint64_t LoadSize = TD->getTypeStoreSize(AddrTy->getElementType());
|
||||
|
|
Loading…
Reference in New Issue