[llvm] a822ec7 - [DSE,MSSA] Treat passed by value args as invisible to caller.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 23 00:59:23 PDT 2020
Author: Florian Hahn
Date: 2020-06-23T08:58:51+01:00
New Revision: a822ec75cc6044eae8dd99d1b78c1a7eb9ad40d7
URL: https://github.com/llvm/llvm-project/commit/a822ec75cc6044eae8dd99d1b78c1a7eb9ad40d7
DIFF: https://github.com/llvm/llvm-project/commit/a822ec75cc6044eae8dd99d1b78c1a7eb9ad40d7.diff
LOG: [DSE,MSSA] Treat passed by value args as invisible to caller.
This updates the MemorySSA backed implementation to treat arguments
passed by value similar to allocas: in they are assumed to be invisible
in the caller. This is similar to how they are treated in legacy DSE.
Reviewers: efriedma, asbirlea, george.burgess.iv
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D82222
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 c6f579b61746..469c8795e0ba 100644
--- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -1563,8 +1563,13 @@ struct DSEState {
// 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;
}
More information about the llvm-commits
mailing list