--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Created attachment 43540
Can you check whether this patch works for you (on the unreduced testcase which
The underlying issue is of course bigger and not restricted to code-hoisting.
All the new code generated by PRE (inserted for partial redundancy removal or
code-hoisting) has no SSA info attached. That includes points-to info which
isn't flow-sensitive but of course also all the flow-sensitive information
like range info and alignment info that we can't generally preserve easily.
This means that we'd ideally have passes computing those _after_ PRE.
Which means experimenting with a larger pass pipeline re-organization like
exchanging FRE after inlining and PRE and moving CCP after inlining downstream.
The alternative would be to make the elimination phase do simple dom-style
computation and propagation of both ranges (easy with the EVRP engine)
and alignment (moderately easy with some refactoring of CCP). That would
leave points-to info which we'd ideally tack onto the PRE expressions then.