[PATCH] D112312: [DSE] Add OR_None (not for commit)

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 22 06:13:21 PDT 2021


fhahn created this revision.
Herald added a subscriber: hiraditya.
fhahn requested review of this revision.
Herald added a project: LLVM.

Slight variant of D105098 <https://reviews.llvm.org/D105098> which also returns OW_None on NoAlias.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D112312

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


Index: llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -329,7 +329,8 @@
   OW_End,
   OW_PartialEarlierWithFullLater,
   OW_MaybePartial,
-  OW_Unknown
+  OW_Unknown,
+  OW_None
 };
 
 } // end anonymous namespace
@@ -1006,8 +1007,11 @@
 
     // If we can't resolve the same pointers to the same object, then we can't
     // analyze them at all.
-    if (DeadUndObj != KillingUndObj)
+    if (DeadUndObj != KillingUndObj) {
+      if (AAR == AliasResult::NoAlias)
+        return OW_None;
       return OW_Unknown;
+    }
 
     // If the KillingI store is to a recognizable object, get its size.
     uint64_t KillingUndObjSize = getPointerSize(KillingUndObj, DL, TLI, &F);
@@ -1063,7 +1067,7 @@
 
     // Can reach here only if accesses are known not to overlap. There is no
     // dedicated code to indicate no overlap so signal "unknown".
-    return OW_Unknown;
+    return OW_None;
   }
 
   bool isInvisibleToCallerAfterRet(const Value *V) {
@@ -1462,7 +1466,7 @@
                               KillingOffset, DeadOffset);
         // If Current does not write to the same object as KillingDef, check
         // the next candidate.
-        if (OR == OW_Unknown)
+        if (OR == OW_Unknown || OR == OW_None)
           continue;
         else if (OR == OW_MaybePartial) {
           // If KillingDef only partially overwrites Current, check the next


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112312.381522.patch
Type: text/x-patch
Size: 1551 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211022/ea07c1c4/attachment.bin>


More information about the llvm-commits mailing list