Solves PR 31990.
The bad rewrite could replace a memcpy of one word with
store i4 -1
while it should actually be
store i8 -1
Hopefully opt and llc has improved enough so the original optimization
done by the code isn't needed anymore.
One already existing testcase is affected. It originally tested that
the memcpy was replaced with
load double
but since we now remove that rewrite it will be
load i64
instead.
Patch suggestion by Eli Friedman.
We already produce this result 64-bit targets (combineLoadToOperationType transforms double load/store to i64 load/store); the interesting piece is what happens on targets where i64 isn't legal.
In general, it shouldn't matter what we produce here; we should always eventually rewrite loads/stores to the appropriate register type for the target. And other optimization passes don't really care about the types of loads and stores anyway (SROA is a lot more flexible than it used to be). So if this does in fact expose a performance regression, we should fix it elsewhere.
That said, it would be nice if you could give testsuite performance numbers on some 32-bit target to make sure we aren't missing some important optimization.