[llvm] a6353fd - [DSE,MSSA] Hoist getMemoryAccess call (NFC).

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 8 07:11:47 PDT 2020


Author: Florian Hahn
Date: 2020-04-08T15:10:05+01:00
New Revision: a6353fdf3b1a4b2c3df54ee201f70a1357db7612

URL: https://github.com/llvm/llvm-project/commit/a6353fdf3b1a4b2c3df54ee201f70a1357db7612
DIFF: https://github.com/llvm/llvm-project/commit/a6353fdf3b1a4b2c3df54ee201f70a1357db7612.diff

LOG: [DSE,MSSA] Hoist getMemoryAccess call (NFC).

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
index 14f07b309b44..bccfefabfad1 100644
--- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -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);


        


More information about the llvm-commits mailing list