[llvm] 6439fde - [DSE] Bail out from getLocForWriteEx if call is not argmemonly/inacc_mem.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 20 06:38:29 PDT 2020
Author: Florian Hahn
Date: 2020-10-20T14:37:53+01:00
New Revision: 6439fde6d403d3e01e265fb84b0beffe67f745c5
URL: https://github.com/llvm/llvm-project/commit/6439fde6d403d3e01e265fb84b0beffe67f745c5
DIFF: https://github.com/llvm/llvm-project/commit/6439fde6d403d3e01e265fb84b0beffe67f745c5.diff
LOG: [DSE] Bail out from getLocForWriteEx if call is not argmemonly/inacc_mem.
This change should currently not have any impact, but guard against
further inconsistencies between MemoryLocation and function attributes.
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 f0eb520f9332..58deceaba60f 100644
--- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -1701,6 +1701,11 @@ struct DSEState {
return {MemoryLocation::getForDest(MTI)};
if (auto *CB = dyn_cast<CallBase>(I)) {
+ // If the functions may write to memory we do not know about, bail out.
+ if (!CB->onlyAccessesArgMemory() &&
+ !CB->onlyAccessesInaccessibleMemOrArgMem())
+ return None;
+
LibFunc LF;
if (TLI.getLibFunc(*CB, LF) && TLI.has(LF)) {
switch (LF) {
More information about the llvm-commits
mailing list