[DSE][MemLoc] Handle intrinsics more generically
authorNikita Popov <npopov@redhat.com>
Thu, 23 Dec 2021 08:19:26 +0000 (09:19 +0100)
committerNikita Popov <npopov@redhat.com>
Fri, 24 Dec 2021 08:29:57 +0000 (09:29 +0100)
commitae64c5a0fde55ca53d0c9949562a506e784da66c
tree56b5f32b85b7e7467b78602f151496146f90bb0c
parentcb31a57104215c57e01e8e9bfe9e545ae0b6b18b
[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
llvm/lib/Analysis/MemoryLocation.cpp
llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
llvm/test/Transforms/DeadStoreElimination/invariant.start.ll
llvm/test/Transforms/DeadStoreElimination/simple.ll