]> git.ipfire.org Git - thirdparty/gcc.git/commit
recip: Reset range info when replacing sqrt with rsqrt [PR120638]
authorJakub Jelinek <jakub@redhat.com>
Thu, 12 Jun 2025 18:22:39 +0000 (20:22 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 12 Jun 2025 18:22:39 +0000 (20:22 +0200)
commit8804e5b5b127b27d099d0c361fa2161d0b13edef
tree64fc2ae8ea60a347645a7232e25e658bf9e0ef71
parent00aa59e5b120e4f5f70dcabafa57f7d4b5b9ad5d
recip: Reset range info when replacing sqrt with rsqrt [PR120638]

This pass reuses a SSA_NAME on the lhs of sqrt etc. call as lhs
of .RSQRT etc. call.  The following testcase is miscompiled since my recent
ranger cast changes, because we compute (correct) range for sqrtf argument
as well as result but then recip pass keeps using that range for the .RQSRT
call which returns 1. / sqrt, so the function then returns 0.5f
unconditionally.
Note, on foo this is a regression from GCC 15, but on bar it regressed
already with the r14-536 change.

2025-06-12  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/120638
* tree-ssa-math-opts.cc (pass_cse_reciprocals::execute): Call
reset_flow_sensitive_info on arg1.

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