From: Philip Reames Date: Tue, 11 Sep 2018 03:28:28 +0000 (+0000) Subject: [LICM] (re-)simplify code using MemoryLocation API [NFC] X-Git-Tag: llvmorg-8.0.0-rc1~9037 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1f52e38e8e06490c2efa38384efbd1302d21ffd9;p=platform%2Fupstream%2Fllvm.git [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 --- diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp index dc0b6f5..4ebe1e3 100644 --- a/llvm/lib/Transforms/Scalar/LICM.cpp +++ b/llvm/lib/Transforms/Scalar/LICM.cpp @@ -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()))