[PATCH] D82222: [DSE, MSSA] Treat passed by value args as invisible to caller.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 23 01:01:10 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGa822ec75cc60: [DSE,MSSA] Treat passed by value args as invisible to caller. (authored by fhahn).

Changed prior to commit:
  https://reviews.llvm.org/D82222?vs=272302&id=272634#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82222/new/

https://reviews.llvm.org/D82222

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
@@ -1563,8 +1563,13 @@
     // Treat byval or inalloca arguments the same as Allocas, stores to them are
     // dead at the end of the function.
     for (Argument &AI : F.args())
-      if (AI.hasPassPointeeByValueAttr())
-        State.InvisibleToCallerBeforeRet.insert(&AI);
+      if (AI.hasPassPointeeByValueAttr()) {
+        // For byval, the caller doesn't know the address of the allocation.
+        if (AI.hasByValAttr())
+          State.InvisibleToCallerBeforeRet.insert(&AI);
+        State.InvisibleToCallerAfterRet.insert(&AI);
+      }
+
     return State;
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82222.272634.patch
Type: text/x-patch
Size: 821 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200623/63b7aaa2/attachment-0001.bin>


More information about the llvm-commits mailing list