diff options
| author | Roger Sayle <roger@nextmovesoftware.com> | 2026-02-07 08:04:40 +0000 |
|---|---|---|
| committer | Roger Sayle <roger@nextmovesoftware.com> | 2026-02-07 08:04:40 +0000 |
| commit | 30886aeca75076bfd50b0fff8d76942603bee763 (patch) | |
| tree | e7d4bb4b08bb5180e25c75c45f29e8bb7ab6b670 /libjava/classpath/vm/reference/java/net | |
| parent | 654c733fa3f10531f3fd6b6d89e39f28c0075bd6 (diff) | |
| download | gcc-30886aeca75076bfd50b0fff8d76942603bee763.zip gcc-30886aeca75076bfd50b0fff8d76942603bee763.tar.gz gcc-30886aeca75076bfd50b0fff8d76942603bee763.tar.bz2 | |
PR tree-optimization/123958: FMA vs pow(x,2.0) [vs errno]
This is my proposed solution to PR123958 (and PR124002) which is a
regression exposed by my recent change to avoid expanding pow(x,2.0)
to x*x with -fmath-errno (the default) when we can't guarantee that
errno shouldn't be updated. The problem is that the logic to convert
pow(x,2.0) was also duplicated (but unused) in tree-ssa-math-opts
where it's intended to perform this conversion in order to expose
fused-multiply-add instructions when supported by the target. The
issue is that this "vestigial" code has bit-rotten over the years,
and incorrectly updates vdefs when changing vops, tiggering an ICE.
My pragmatic solution to this is to simply delete the problematic
code; the decision of whether pow(x,2.0) should be expanded is left
to the earlier pow_expand pass (which is what it's designed for), and
the later FMA pass can make use of any resulting FP multiplications.
Not only does this avoid the PHI related ICE, but also fixes the
original PR (on updating errno) on targets with FMA, e.g. aarch64
and recent x86_64 architectures (such as -march=znver3).
2026-02-07 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog
PR middle-end/123826
PR tree-optimization/123958
PR c++/124002
* tree-ssa-math-opts.cc (math_opts_dom_walker::after_dom_children):
Delete code that (mis)handled conversion of pow(x,2.0) to x*x.
gcc/testsuite/ChangeLog
PR middle-end/123826
PR tree-optimization/123958
PR c++/124002
* g++.target/i386/pr124002.C: New test case.
* gcc.target/i386/pr123958.c: Likewise.
* gcc.dg/errno-4.c: Likewise.
Diffstat (limited to 'libjava/classpath/vm/reference/java/net')
0 files changed, 0 insertions, 0 deletions
