Disable new 1/X optimization with -fnon-call-exceptions
authorEric Botcazou <ebotcazou@adacore.com>
Fri, 4 Feb 2022 11:03:49 +0000 (12:03 +0100)
committerEric Botcazou <ebotcazou@adacore.com>
Fri, 4 Feb 2022 11:10:05 +0000 (12:10 +0100)
commitbd14cdceb9c6f4800e25a9fbca635a1d4c06fd32
treef095dd4c180fc306e7fba96b4025132bd4d12adf
parent876e70d4681332a600492173af0c7259e5a438c6
Disable new 1/X optimization with -fnon-call-exceptions

The trapping behavior of the operation needs to be preserved when the
-fnon-call-exceptions switch is in effect.  This also adds the same
guards to similar optimizations.

gcc/
PR tree-optimization/104356
* match.pd (X / bool_range_Y is X): Add guard.
(X / X is one): Likewise.
(X / abs (X) is X < 0 ? -1 : 1): Likewise.
(X / -X is -1): Likewise.
(1 / X -> X == 1): Likewise.
gcc/match.pd