[Bug tree-optimization/92734] Missing match.pd simplification done by fold_binary_loc on generic
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Dec 2 07:34:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92734
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
We have a set of special-case patterns for simple associations in match.pd, one
for this case seems missing, like the group
/* Match patterns that allow contracting a plus-minus pair
irrespective of overflow issues. */
/* (A +- B) - A -> +- B */
/* (A +- B) -+ B -> A */
/* A - (A +- B) -> -+ B */
/* A +- (B -+ A) -> +- B */
closest match is
/* CST1 - (CST2 - A) -> CST3 + A */
(simplify
(minus CONSTANT_CLASS_P@1 (minus CONSTANT_CLASS_P@2 @0))
(with { tree cst = const_binop (MINUS_EXPR, type, @1, @2); }
(if (cst && !TREE_OVERFLOW (cst))
(plus { cst; } @0))))
which "just" seems to lack a (convert? ...) around the inner minus.
And yes, reassoc would be the pass to handle this, maybe in the very late
if/when
we decide to switch the IL to -fwapv semantics there.
More information about the Gcc-bugs
mailing list