aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/MemoryLocation.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2021-12-23 09:19:26 +0100
committerNikita Popov <npopov@redhat.com>2021-12-24 09:29:57 +0100
commitae64c5a0fde55ca53d0c9949562a506e784da66c (patch)
tree56b5f32b85b7e7467b78602f151496146f90bb0c /llvm/lib/Analysis/MemoryLocation.cpp
parentcb31a57104215c57e01e8e9bfe9e545ae0b6b18b (diff)
downloadllvm-ae64c5a0fde55ca53d0c9949562a506e784da66c.zip
llvm-ae64c5a0fde55ca53d0c9949562a506e784da66c.tar.gz
llvm-ae64c5a0fde55ca53d0c9949562a506e784da66c.tar.bz2
[DSE][MemLoc] Handle intrinsics more generically
Remove the special casing for intrinsics in MemoryLocation::getForDest() and handle them through the general attribute based code. On the DSE side, this means that isRemovable() now needs to handle more than a hardcoded list of intrinsics. We consider everything apart from volatile memory intrinsics and lifetime markers to be removable. This allows us to perform DSE on intrinsics that DSE has not been specially taught about, using a matrix store as an example here. There is an interesting test change for invariant.start, but I believe that optimization is correct. It only looks a bit odd because the code is immediate UB anyway. Differential Revision: https://reviews.llvm.org/D116210
Diffstat (limited to 'llvm/lib/Analysis/MemoryLocation.cpp')
-rw-r--r--llvm/lib/Analysis/MemoryLocation.cpp14
1 files changed, 0 insertions, 14 deletions
diff --git a/llvm/lib/Analysis/MemoryLocation.cpp b/llvm/lib/Analysis/MemoryLocation.cpp
index 120f4cd..a877b19 100644
--- a/llvm/lib/Analysis/MemoryLocation.cpp
+++ b/llvm/lib/Analysis/MemoryLocation.cpp
@@ -120,20 +120,6 @@ MemoryLocation MemoryLocation::getForDest(const AnyMemIntrinsic *MI) {
Optional<MemoryLocation>
MemoryLocation::getForDest(const CallBase *CB, const TargetLibraryInfo &TLI) {
- if (const IntrinsicInst *II = dyn_cast<IntrinsicInst>(CB)) {
- if (auto *MemInst = dyn_cast<AnyMemIntrinsic>(CB))
- return getForDest(MemInst);
-
- switch (II->getIntrinsicID()) {
- default:
- return None;
- case Intrinsic::init_trampoline:
- return MemoryLocation::getForArgument(CB, 0, TLI);
- case Intrinsic::masked_store:
- return MemoryLocation::getForArgument(CB, 1, TLI);
- }
- }
-
if (!CB->onlyAccessesArgMemory())
return None;