This patch extends the code that walks memory defs upwards to find
clobbering accesses to also try to optimize the clobbering defining
We should be able to find set the optimized access of our starting def
(KillingDef), if the following holds:
- It is the first call of getDomMemoryDef for KillingDef (so Current == KillingDef->getDefiningAccess().
- No potentially aliasing defs are skipped.
Then if a (partly) aliasing def is encountered, it can be used as
optimized access for KillingDef. No further optimizations can be
applied to KillingDef.
I'd appreciate a careful look, as the existing documentation is not too
clear on what is expected for optimized accesses.
The motivation for this patch is to use the optimized accesses to cover
more cases of redundant stores as follow-up to D111727.