[llvm] 7aab12e - [DSE] Only query object size for identified objects

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 27 01:10:14 PDT 2023


Author: Nikita Popov
Date: 2023-09-27T10:10:06+02:00
New Revision: 7aab12e1c52a5891bed9a594d3f161a8bebf976d

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

LOG: [DSE] Only query object size for identified objects

This is supposed to be a fast heuristic primarily interested in
allocas. We should not call it for non-root objects where object
size needs to be determined recursively.

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 c81c1a0c3f57799..0586ff191d94ed1 100644
--- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -949,7 +949,8 @@ struct DSEState {
 
     // Check whether the killing store overwrites the whole object, in which
     // case the size/offset of the dead store does not matter.
-    if (DeadUndObj == KillingUndObj && KillingLocSize.isPrecise()) {
+    if (DeadUndObj == KillingUndObj && KillingLocSize.isPrecise() &&
+        isIdentifiedObject(KillingUndObj)) {
       uint64_t KillingUndObjSize = getPointerSize(KillingUndObj, DL, TLI, &F);
       if (KillingUndObjSize != MemoryLocation::UnknownSize &&
           KillingUndObjSize == KillingLocSize.getValue())


        


More information about the llvm-commits mailing list