OSDN Git Service

[LICM] (re-)simplify code using MemoryLocation API [NFC]
authorPhilip Reames <listmail@philipreames.com>
Tue, 11 Sep 2018 03:28:28 +0000 (03:28 +0000)
committerPhilip Reames <listmail@philipreames.com>
Tue, 11 Sep 2018 03:28:28 +0000 (03:28 +0000)
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.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341892 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LICM.cpp

index dc0b6f5..4ebe1e3 100644 (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()))