]> git.ipfire.org Git - thirdparty/gcc.git/commit
widening_mul: Reset flow sensitive info in maybe_optimize_guarding_check [PR122104]
authorJakub Jelinek <jakub@redhat.com>
Sat, 4 Oct 2025 15:06:16 +0000 (17:06 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sat, 4 Oct 2025 15:06:16 +0000 (17:06 +0200)
commit867f777cee9f44027a3724fbad266c5cfb3a311f
tree9db1353cdc05e2f2b7a407f2393447e7fa9ed30f
parentab429ea91d50e5ddb8eb5bc2098c6a476860a01b
widening_mul: Reset flow sensitive info in maybe_optimize_guarding_check [PR122104]

In PR95852 I've added an optimization where next to just pattern
recognizing r = x * y; r / x != y or r = x * y; r / x == y
as .MUL_OVERFLOW or negation thereof it also recognizes
r = x * y; x && (r / x != y) or r = x * y; !x || (r / x == y)
by optimizing the guarding condition to always true/false.

The problem with that is that some value ranges recorded for
the SSA_NAMEs in the formerly conditional, now unconditional
basic block can be invalid.

This patch fixes it by calling reset_flow_sensitive_info_in_bb
if we optimize the guarding condition.

2025-10-04  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/122104
* tree-ssa-math-opts.cc (maybe_optimize_guarding_check): Call
reset_flow_sensitive_info_in_bb on bb when optimizing out the
guarding condition.

* gcc.target/i386/pr122104.c: New test.
gcc/testsuite/gcc.target/i386/pr122104.c [new file with mode: 0644]
gcc/tree-ssa-math-opts.cc