* [Bug tree-optimization/108139] [13 Regression] wrong code with "-O1 -ftree-vrp" on x86_64-linux-gnu
2022-12-16 7:55 [Bug tree-optimization/108139] New: wrong code with "-O1 -ftree-vrp" on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
@ 2022-12-16 8:26 ` rguenth at gcc dot gnu.org
2022-12-16 12:17 ` [Bug tree-optimization/108139] [13 Regression] wrong code with "-O1 -ftree-vrp" on x86_64-linux-gnu since r13-1938-g87dd4c8c83768aaf marxin at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-12-16 8:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108139
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |needs-bisection, wrong-code
Summary|wrong code with "-O1 |[13 Regression] wrong code
|-ftree-vrp" on |with "-O1 -ftree-vrp" on
|x86_64-linux-gnu |x86_64-linux-gnu
Version|unknown |13.0
Target Milestone|--- |13.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/108139] [13 Regression] wrong code with "-O1 -ftree-vrp" on x86_64-linux-gnu since r13-1938-g87dd4c8c83768aaf
2022-12-16 7:55 [Bug tree-optimization/108139] New: wrong code with "-O1 -ftree-vrp" on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
2022-12-16 8:26 ` [Bug tree-optimization/108139] [13 Regression] " rguenth at gcc dot gnu.org
@ 2022-12-16 12:17 ` marxin at gcc dot gnu.org
2022-12-16 19:21 ` pinskia at gcc dot gnu.org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-12-16 12:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108139
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[13 Regression] wrong code |[13 Regression] wrong code
|with "-O1 -ftree-vrp" on |with "-O1 -ftree-vrp" on
|x86_64-linux-gnu |x86_64-linux-gnu since
| |r13-1938-g87dd4c8c83768aaf
Keywords|needs-bisection |
Status|UNCONFIRMED |NEW
Last reconfirmed| |2022-12-16
Ever confirmed|0 |1
CC| |amacleod at redhat dot com,
| |marxin at gcc dot gnu.org
Priority|P3 |P1
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r13-1938-g87dd4c8c83768aaf.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/108139] [13 Regression] wrong code with "-O1 -ftree-vrp" on x86_64-linux-gnu since r13-1938-g87dd4c8c83768aaf
2022-12-16 7:55 [Bug tree-optimization/108139] New: wrong code with "-O1 -ftree-vrp" on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
2022-12-16 8:26 ` [Bug tree-optimization/108139] [13 Regression] " rguenth at gcc dot gnu.org
2022-12-16 12:17 ` [Bug tree-optimization/108139] [13 Regression] wrong code with "-O1 -ftree-vrp" on x86_64-linux-gnu since r13-1938-g87dd4c8c83768aaf marxin at gcc dot gnu.org
@ 2022-12-16 19:21 ` pinskia at gcc dot gnu.org
2022-12-16 20:06 ` amacleod at redhat dot com
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-16 19:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108139
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Folding statement: if (a.3_5 != 0)
Folding predicate a.3_5 != 0 to 1
Folded into: if (1 != 0)
I don't see how that could be possible. There is some issue coming from the
(not used on this path) uninitialized variable c too.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/108139] [13 Regression] wrong code with "-O1 -ftree-vrp" on x86_64-linux-gnu since r13-1938-g87dd4c8c83768aaf
2022-12-16 7:55 [Bug tree-optimization/108139] New: wrong code with "-O1 -ftree-vrp" on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
` (2 preceding siblings ...)
2022-12-16 19:21 ` pinskia at gcc dot gnu.org
@ 2022-12-16 20:06 ` amacleod at redhat dot com
2022-12-16 20:07 ` amacleod at redhat dot com
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: amacleod at redhat dot com @ 2022-12-16 20:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108139
--- Comment #3 from Andrew Macleod <amacleod at redhat dot com> ---
(In reply to Andrew Pinski from comment #2)
> Folding statement: if (a.3_5 != 0)
> Folding predicate a.3_5 != 0 to 1
> Folded into: if (1 != 0)
>
> I don't see how that could be possible. There is some issue coming from the
> (not used on this path) uninitialized variable c too.
<bb 5> [local count: 59055799]:
a.3_5 = a;
b.2_4 = b;
<bb 6> [local count: 114863530]:
# c_2 = PHI <c_9(D)(5), a.3_5(9)>
<bb 7> [local count: 1073741824]:
if (a.3_5 != 0)
goto <bb 4>; [94.50%]
else
goto <bb 8>; [5.50%]
The problem is that c_9 is an undefined value in the PHI.. with only 2
arguments, we try to be clever (and this is important in other places), and
say, ok, we'll assume it has the same value as the other argument and we create
an equivalence between c_2 and the other argument, a.3_5
The only way to get to the 6->9 edge is to have processed the if statement
already, and therefore we'd know that a.3_5 is ~[0, 0], sowe determine that c_2
is also ~[0,0].
When we visit the if statement, we know a.3_5 is varying, but we also look at
what equivalences a.3_5 has, and voila c_2 is equivlant o a.3_5, so we refine
the value to match c_2 and then decide we can fold away the if as always true.
we don't seem to run into this at hihger optimization levels because bb6 and
bb7 are merged, and with the PHI in the same block,we don't trigger the
outgoing edge equivalence evaluations :-P so we pick up the original VARYING
result for a.3_5 and don't adjust it with its "equivalence c_2".
hum.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/108139] [13 Regression] wrong code with "-O1 -ftree-vrp" on x86_64-linux-gnu since r13-1938-g87dd4c8c83768aaf
2022-12-16 7:55 [Bug tree-optimization/108139] New: wrong code with "-O1 -ftree-vrp" on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
` (3 preceding siblings ...)
2022-12-16 20:06 ` amacleod at redhat dot com
@ 2022-12-16 20:07 ` amacleod at redhat dot com
2022-12-20 14:27 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: amacleod at redhat dot com @ 2022-12-16 20:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108139
--- Comment #4 from Andrew Macleod <amacleod at redhat dot com> ---
9->6 edge, not 6->9...
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/108139] [13 Regression] wrong code with "-O1 -ftree-vrp" on x86_64-linux-gnu since r13-1938-g87dd4c8c83768aaf
2022-12-16 7:55 [Bug tree-optimization/108139] New: wrong code with "-O1 -ftree-vrp" on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
` (4 preceding siblings ...)
2022-12-16 20:07 ` amacleod at redhat dot com
@ 2022-12-20 14:27 ` cvs-commit at gcc dot gnu.org
2022-12-20 14:28 ` amacleod at redhat dot com
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-12-20 14:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108139
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Andrew Macleod <amacleod@gcc.gnu.org>:
https://gcc.gnu.org/g:0bdd2261c254f08b0f4437c156b79711d68c6e7f
commit r13-4806-g0bdd2261c254f08b0f4437c156b79711d68c6e7f
Author: Andrew MacLeod <amacleod@redhat.com>
Date: Fri Dec 16 16:53:31 2022 -0500
Don't use PHI equivalences in range-on-entry.
If there is only one argument to a PHI which is defined, an equivalency is
created between the def and the argument. It is safe to consider the def
equal to the argument, but it is dangerous to assume the argument is also
equivalent to the def as there may be branches which change the range on
the
path to the PHI on that argument
This patch avoid using that relation in range-on-entry calculations.
PR tree-optimization/108139
gcc/
* gimple-range-cache.cc (ranger_cache::fill_block_cache): Do not
use equivalences originating from PHIS.
gcc/testsuite/
* gcc.dg/pr108139.c: New.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/108139] [13 Regression] wrong code with "-O1 -ftree-vrp" on x86_64-linux-gnu since r13-1938-g87dd4c8c83768aaf
2022-12-16 7:55 [Bug tree-optimization/108139] New: wrong code with "-O1 -ftree-vrp" on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
` (5 preceding siblings ...)
2022-12-20 14:27 ` cvs-commit at gcc dot gnu.org
@ 2022-12-20 14:28 ` amacleod at redhat dot com
2023-04-12 13:10 ` cvs-commit at gcc dot gnu.org
2023-04-13 18:12 ` cvs-commit at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: amacleod at redhat dot com @ 2022-12-20 14:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108139
Andrew Macleod <amacleod at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #6 from Andrew Macleod <amacleod at redhat dot com> ---
fixed.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/108139] [13 Regression] wrong code with "-O1 -ftree-vrp" on x86_64-linux-gnu since r13-1938-g87dd4c8c83768aaf
2022-12-16 7:55 [Bug tree-optimization/108139] New: wrong code with "-O1 -ftree-vrp" on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
` (6 preceding siblings ...)
2022-12-20 14:28 ` amacleod at redhat dot com
@ 2023-04-12 13:10 ` cvs-commit at gcc dot gnu.org
2023-04-13 18:12 ` cvs-commit at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-12 13:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108139
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Andrew Macleod <amacleod@gcc.gnu.org>:
https://gcc.gnu.org/g:24af552876eff707f75d30d3f0f0e7a5d62dd857
commit r13-7150-g24af552876eff707f75d30d3f0f0e7a5d62dd857
Author: Andrew MacLeod <amacleod@redhat.com>
Date: Tue Apr 11 17:29:03 2023 -0400
Don't use ANY PHI equivalences in range-on-entry.
PR 108139 dissallows PHI equivalencies in the on-entry calculator, but
it was only checking if the equivlaence was a PHI. In this case, NAME
itself is a PHI with an equivlaence caused by an undefined value, so we
also need to check that case. Unfortunately this un-fixes 101912.
PR tree-optimization/109462
gcc/
* gimple-range-cache.cc (ranger_cache::fill_block_cache): Don't
check for equivalences if NAME is a phi node.
gcc/testsuite/
* gcc.dg/uninit-pr101912.c: XFAIL the warning.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/108139] [13 Regression] wrong code with "-O1 -ftree-vrp" on x86_64-linux-gnu since r13-1938-g87dd4c8c83768aaf
2022-12-16 7:55 [Bug tree-optimization/108139] New: wrong code with "-O1 -ftree-vrp" on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
` (7 preceding siblings ...)
2023-04-12 13:10 ` cvs-commit at gcc dot gnu.org
@ 2023-04-13 18:12 ` cvs-commit at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-13 18:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108139
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Andrew Macleod <amacleod@gcc.gnu.org>:
https://gcc.gnu.org/g:9c2a5db997446a9438a3e01f5229dec3f78b09e7
commit r13-7170-g9c2a5db997446a9438a3e01f5229dec3f78b09e7
Author: Andrew MacLeod <amacleod@redhat.com>
Date: Wed Apr 12 13:10:55 2023 -0400
Ensure PHI equivalencies do not dominate the argument edge.
When we create an equivalency between a PHI definition and an argument,
ensure the definition does not dominate the incoming argument edge.
PR tree-optimization/108139
PR tree-optimization/109462
* gimple-range-cache.cc (ranger_cache::fill_block_cache): Remove
equivalency check for PHI nodes.
* gimple-range-fold.cc (fold_using_range::range_of_phi): Ensure def
does not dominate single-arg equivalency edges.
^ permalink raw reply [flat|nested] 10+ messages in thread