On 1/26/2022 8:56 AM, Richard Biener via Gcc-patches wrote:
This adds the capability to value-numbering of treating complex
address expressions where the offset becomes invariant as equal
to a POINTER_PLUS_EXPR.  This restores CSE that is now prevented
by early lowering of &MEM[ptr + CST] to a POINTER_PLUS_EXPR.

Unfortunately this regresses gcc.dg/asan/pr99673.c again.

Bootstrapped and tested on x86_64-unknown-linux-gnu - any
opinions?

Richard.

2022-01-26  Richard Biener  <rguent...@suse.de>

        PR tree-optimization/104162
        * tree-ssa-sccvn.cc (vn_reference_lookup): Handle
        &MEM[_1 + 5].a[i] like a POINTER_PLUS_EXPR if the offset
        becomes invariant.
        (vn_reference_insert): Likewise.

        * gcc.dg/tree-ssa/ssa-fre-99.c: New testcase.
IIRC there's a handful of old regressions this might help.  More than once I've been tempted to do something similar in DOM -- with this addition it's just one more reason we should be looking to drop DOM and replace it with FRE going forward.

jeff

Reply via email to