diff options
author | Nikita Popov <npopov@redhat.com> | 2025-06-17 09:49:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-17 09:49:18 +0200 |
commit | bb70023cbfecf7880e4cc89966947ef475e070e9 (patch) | |
tree | 54f85d2fc7f34b771c6ff4bc106e003f4ed40e9a /llvm/lib/Analysis/MemoryLocation.cpp | |
parent | 80b79ce432bbe12701fd9fe495ff9feeb5e4b9ca (diff) | |
download | llvm-bb70023cbfecf7880e4cc89966947ef475e070e9.zip llvm-bb70023cbfecf7880e4cc89966947ef475e070e9.tar.gz llvm-bb70023cbfecf7880e4cc89966947ef475e070e9.tar.bz2 |
[MemoryLocation][DSE] Allow other read effects in MemoryLocation::getForDest() (#144343)
MemoryLocation::getForDest() returns a (potentially) written location,
while still allowing other reads. Currently, this is limited to
argmemonly functions. However, we can ignore other (non-argmem) read
effects here for the same reason we can ignore argument reads.
Fixes https://github.com/llvm/llvm-project/issues/144300.
Proof: https://alive2.llvm.org/ce/z/LKq_dc
Diffstat (limited to 'llvm/lib/Analysis/MemoryLocation.cpp')
-rw-r--r-- | llvm/lib/Analysis/MemoryLocation.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/MemoryLocation.cpp b/llvm/lib/Analysis/MemoryLocation.cpp index 3b42bb4..c8daab7a 100644 --- a/llvm/lib/Analysis/MemoryLocation.cpp +++ b/llvm/lib/Analysis/MemoryLocation.cpp @@ -111,7 +111,9 @@ MemoryLocation MemoryLocation::getForDest(const AnyMemIntrinsic *MI) { std::optional<MemoryLocation> MemoryLocation::getForDest(const CallBase *CB, const TargetLibraryInfo &TLI) { - if (!CB->onlyAccessesArgMemory()) + // Check that the only possible writes are to arguments. + MemoryEffects WriteME = CB->getMemoryEffects() & MemoryEffects::writeOnly(); + if (!WriteME.onlyAccessesArgPointees()) return std::nullopt; if (CB->hasOperandBundles()) |