[DSE,MSSA] Hoist getMemoryAccess call (NFC).
authorFlorian Hahn <flo@fhahn.com>
Wed, 8 Apr 2020 13:17:48 +0000 (14:17 +0100)
committerFlorian Hahn <flo@fhahn.com>
Wed, 8 Apr 2020 14:10:05 +0000 (15:10 +0100)
llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp

index 14f07b3..bccfefa 100644 (file)
@@ -1509,10 +1509,11 @@ struct DSEState {
     for (BasicBlock *BB : post_order(&F)) {
       State.PostOrderNumbers[BB] = PO++;
       for (Instruction &I : *BB) {
-        if (I.mayThrow() && !MSSA.getMemoryAccess(&I))
+        MemoryAccess *MA = MSSA.getMemoryAccess(&I);
+        if (I.mayThrow() && !MA)
           State.ThrowingBlocks.insert(I.getParent());
 
-        auto *MD = dyn_cast_or_null<MemoryDef>(MSSA.getMemoryAccess(&I));
+        auto *MD = dyn_cast_or_null<MemoryDef>(MA);
         if (MD && State.MemDefs.size() < MemorySSADefsPerBlockLimit &&
             hasAnalyzableMemoryWrite(&I, TLI) && isRemovable(&I))
           State.MemDefs.push_back(MD);