[DSE] Support redundant stores eliminated by memset.
authorFlorian Hahn <flo@fhahn.com>
Fri, 29 Oct 2021 20:58:42 +0000 (21:58 +0100)
committerFlorian Hahn <flo@fhahn.com>
Fri, 29 Oct 2021 21:19:53 +0000 (22:19 +0100)
commit274a9b0f0b4e9f6a8520e92d9eff629815436e28
treeb209c332c6bc72aaeaf534090d84cd13470db331
parente6b323379e3195ba98bacc9216fe38025bda6104
[DSE] Support redundant stores eliminated by memset.

This patch adds support to remove stores that write the same value
as earlier memesets.

It uses isOverwrite to check that a memset completely overwrites a later
store. The candidate store must store the same bytewise value as the
byte stored by the memset.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D112321
llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
llvm/test/Transforms/DeadStoreElimination/stores-of-existing-values.ll