[PATCH] D115904: [DSE] Remove calls with known writes to dead memory
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 17 00:21:38 PST 2021
nikic added inline comments.
================
Comment at: llvm/include/llvm/Analysis/MemoryLocation.h:260
+ /// sunk, reordered, etc... solely based on the memory semantics implied by
+ /// the described write, and the def-use chain of the result value (if any).
static Optional<MemoryLocation> getForDest(const CallBase *CI,
----------------
This might want to highlight that the function can still read other memory.
================
Comment at: llvm/lib/Analysis/MemoryLocation.cpp:154
+ // that we can so summarize.
+ if (!CB->onlyAccessesArgMemory() || !CB->willReturn() || !CB->doesNotThrow())
+ return None;
----------------
I'm not sure the willreturn and nounwind checks really belong in here. We should try to separate the modelling of different effects, and MemoryLocation should only be modelling memory effects. The willreturn/nounwind checks can be done in the caller.
After all, the statement that only this one location is written remains true regardless of whether the call unwind or diverge, the latter only affect whether it can be removed.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115904/new/
https://reviews.llvm.org/D115904
More information about the llvm-commits
mailing list