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.
Improvements of dse.NumRedundantStores on MultiSource/CINT2006/CPF2006
on X86 with -O3:
test-suite...oxyApps-C++/miniFE/miniFE.test 1.00 5.00 400.0% test-suite...marks/7zip/7zip-benchmark.test 2.00 8.00 300.0% test-suite...lications/sqlite3/sqlite3.test 2.00 7.00 250.0% test-suite...lications/ClamAV/clamscan.test 1.00 2.00 100.0% test-suite.../CINT2006/403.gcc/403.gcc.test 7.00 11.00 57.1% test-suite...006/447.dealII/447.dealII.test 33.00 51.00 54.5% test-suite...0.perlbench/400.perlbench.test 2.00 3.00 50.0% test-suite.../Benchmarks/Bullet/bullet.test 12.00 16.00 33.3% test-suite.../Applications/lemon/lemon.test 5.00 6.00 20.0% test-suite...DOE-ProxyApps-C/CoMD/CoMD.test 6.00 7.00 16.7% test-suite...pplications/oggenc/oggenc.test 7.00 8.00 14.3% test-suite...3.xalancbmk/483.xalancbmk.test 62.00 67.00 8.1% test-suite...T2006/458.sjeng/458.sjeng.test NaN 1.00 nan% test-suite...CFP2006/444.namd/444.namd.test NaN 1.00 nan% test-suite...nsumer-jpeg/consumer-jpeg.test NaN 3.00 nan% test-suite...rks/tramp3d-v4/tramp3d-v4.test NaN 13.00 nan% test-suite...oxyApps-C/miniGMG/miniGMG.test NaN 25.00 nan%
Motivating C test case https://clang.godbolt.org/z/dfEnv7f5x:
#include <string.h> void foo(int** ptr, int *foo) { memset(ptr, 0, 128); ptr[1] = foo; ptr[2] = NULL; }
Shouldnt this condition also handle pr50339 testcase in stores-of-existing-values.ll?