================
@@ -1206,11 +1217,24 @@ struct DSEState {
     return OW_None;
   }
 
-  bool isInvisibleToCallerAfterRet(const Value *V) {
+  bool isInvisibleToCallerAfterRet(const Value *V, const Value *Ptr,
+                                   const LocationSize StoreSize) {
     if (isa<AllocaInst>(V))
       return true;
 
     auto I = InvisibleToCallerAfterRet.insert({V, false});
+    if (I.second && InvisibleToCallerAfterRetBounded.contains(V)) {
+      int64_t ValueOffset;
+      const Value *BaseValue =
+          GetPointerBaseWithConstantOffset(Ptr, ValueOffset, DL);
+      assert(BaseValue == V);
+      // This store is only invisible after return if we are in bounds of the
+      // range marked dead.
+      if (ValueOffset + StoreSize.getValue() <=
+              InvisibleToCallerAfterRetBounded[BaseValue] &&
+          ValueOffset >= 0)
+        return true;
+    }
     if (I.second && isInvisibleToCallerOnUnwind(V) && isNoAliasCall(V))
----------------
aeubanks wrote:

why can we skip these checks when using dead_on_return is sized? feels like the 
added code should also set `I.first->second`

https://github.com/llvm/llvm-project/pull/173694
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to