https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117601
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2024-11-15 Status|UNCONFIRMED |ASSIGNED Ever confirmed|0 |1 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- This hunk to match.pd fixes this: ``` (simplify (convert (plus@2 (convert ADDR_EXPR@0) INTEGER_CST@1)) (if (POINTER_TYPE_P (type) && tree_nop_conversion_p (TREE_TYPE(@2), TREE_TYPE (@0)) && tree_nop_conversion_p (TREE_TYPE(@0), type)) (pointer_plus @0 @1))) ``` And combined with the "hack" in PR 117572, we can almost optimize the original testcase there. The only issue is we don't recongize the above until it is too late for DSE to happen and we end up with still in .optimized: ``` h_391 = &o + 2; n = 3; o ={v} {CLOBBER(eos)}; q[1] = 1; c = &p; *h_391 = 0; o ={v} {CLOBBER(eos)}; ``` Though this is enough to workaround the issue reported in PR 117426.