This change teaches DSE that the atomic memory intrinsics can be overwriten
partially in the same way as the non-atomic forms. Specifically, that the
atomic memcpy & memset can be shortened at the end and that the atomic memset
can be shortened at the beginning, if they partially overwritten
by later stores.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
I don't see any problems with the code (other than the nit I've pointed out), but I do not know this logic well enough to make the final judgement. Adding some people who contributed to DSE recently. Can you guys take a look?
lib/Transforms/Scalar/DeadStoreElimination.cpp | ||
---|---|---|
917 ↗ | (On Diff #142230) | There are already existing functions for this, like isPowerOf2_32, can you please use one of them? |
lib/Transforms/Scalar/DeadStoreElimination.cpp | ||
---|---|---|
917 ↗ | (On Diff #142230) | Perhaps a misleading comment. The line below this is checking whether NewLength is an integer multiple of ElementSize (i.e. whether NewLength % ElementSize == 0), but I did it via a bit operation because we know that ElementSize must be a power of 2 (via the spec for the atomic memory intrinsics). I'll just use the modulo operator; less potential for confusion. |
ping - any takers to review this? I'm fairly certain it's correct, but a sanity check would be nice.