[llvm] 90095a0 - [DSE] Remove unnecessary check in getLocForWrite() (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 24 01:50:33 PST 2021


Author: Nikita Popov
Date: 2021-12-24T10:45:35+01:00
New Revision: 90095a0b65bdbb56165937d5b7c44e1bd2c251d6

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

LOG: [DSE] Remove unnecessary check in getLocForWrite() (NFC)

MemoryLocation::getForDest() checks this itself, call it directly.

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 5e5abb9d33c5..c80a2ef58e92 100644
--- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -988,14 +988,8 @@ struct DSEState {
     if (!I->mayWriteToMemory())
       return None;
 
-    if (auto *CB = dyn_cast<CallBase>(I)) {
-      // If the functions may write to memory we do not know about, bail out.
-      if (!CB->onlyAccessesArgMemory() &&
-          !CB->onlyAccessesInaccessibleMemOrArgMem())
-        return None;
-
+    if (auto *CB = dyn_cast<CallBase>(I))
       return MemoryLocation::getForDest(CB, TLI);
-    }
 
     return MemoryLocation::getOrNone(I);
   }


        


More information about the llvm-commits mailing list