================
@@ -1206,11 +1214,21 @@ 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);
+      if (ValueOffset + StoreSize.toRaw() <
+          InvisibleToCallerAfterRetBounded[BaseValue])
----------------
boomanaiden154 wrote:

Done. Unsure why I decided to use `toRaw()` here originally. We do not need to 
use `isPrecise()` given the value stored should be a conservative estimate.

Also updated the boundary conditions and added a regression test that covers 
both the upper and lower boundary extremes.

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