[LICM] (re-)simplify code using MemoryLocation API [NFC]

I'd made exactly this same change before, but it appears to have been accidentally reverted in another change.  (I'm assuming accidental since it was without comment or test case, and in an unrelated change.)

llvm-svn: 341892
This commit is contained in:
Philip Reames 2018-09-11 03:28:28 +00:00
parent 5066ab369d
commit 1f52e38e8e
1 changed files with 2 additions and 10 deletions

View File

@ -653,16 +653,8 @@ bool llvm::canSinkOrHoistInst(Instruction &I, AAResults *AA, DominatorTree *DT,
if (isLoadInvariantInLoop(LI, DT, CurLoop))
return true;
// Don't hoist loads which have may-aliased stores in loop.
uint64_t Size = 0;
if (LI->getType()->isSized())
Size = I.getModule()->getDataLayout().getTypeStoreSize(LI->getType());
AAMDNodes AAInfo;
LI->getAAMetadata(AAInfo);
bool Invalidated = pointerInvalidatedByLoop(
MemoryLocation(LI->getOperand(0), Size, AAInfo), CurAST, CurLoop, AA);
bool Invalidated = pointerInvalidatedByLoop(MemoryLocation::get(LI),
CurAST, CurLoop, AA);
// Check loop-invariant address because this may also be a sinkable load
// whose address is not necessarily loop-invariant.
if (ORE && Invalidated && CurLoop->isLoopInvariant(LI->getPointerOperand()))