* [Bug rtl-optimization/105455] ICE: verify_flow_info failed (error: verify_flow_info: REG_BR_PROB does not match cfg)
2022-05-02 16:29 [Bug rtl-optimization/105455] New: ICE: verify_flow_info failed (error: verify_flow_info: REG_BR_PROB does not match cfg) asolokha at gmx dot com
@ 2022-05-03 8:42 ` marxin at gcc dot gnu.org
2022-05-03 8:42 ` marxin at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-05-03 8:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105455
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |marxin at gcc dot gnu.org
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2022-05-03
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug rtl-optimization/105455] ICE: verify_flow_info failed (error: verify_flow_info: REG_BR_PROB does not match cfg)
2022-05-02 16:29 [Bug rtl-optimization/105455] New: ICE: verify_flow_info failed (error: verify_flow_info: REG_BR_PROB does not match cfg) asolokha at gmx dot com
2022-05-03 8:42 ` [Bug rtl-optimization/105455] " marxin at gcc dot gnu.org
@ 2022-05-03 8:42 ` marxin at gcc dot gnu.org
2022-05-11 7:34 ` aoliva at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-05-03 8:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105455
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with introduction of -fharden-conditional-branches in
r12-4759-g95bb87b2458bfab4.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug rtl-optimization/105455] ICE: verify_flow_info failed (error: verify_flow_info: REG_BR_PROB does not match cfg)
2022-05-02 16:29 [Bug rtl-optimization/105455] New: ICE: verify_flow_info failed (error: verify_flow_info: REG_BR_PROB does not match cfg) asolokha at gmx dot com
2022-05-03 8:42 ` [Bug rtl-optimization/105455] " marxin at gcc dot gnu.org
2022-05-03 8:42 ` marxin at gcc dot gnu.org
@ 2022-05-11 7:34 ` aoliva at gcc dot gnu.org
2022-05-13 6:01 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: aoliva at gcc dot gnu.org @ 2022-05-11 7:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105455
Alexandre Oliva <aoliva at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |aoliva at gcc dot gnu.org
--- Comment #2 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
Created attachment 52951
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52951&action=edit
Candidate patch
Mine. This patch appears to cure it. Regstrapping...
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug rtl-optimization/105455] ICE: verify_flow_info failed (error: verify_flow_info: REG_BR_PROB does not match cfg)
2022-05-02 16:29 [Bug rtl-optimization/105455] New: ICE: verify_flow_info failed (error: verify_flow_info: REG_BR_PROB does not match cfg) asolokha at gmx dot com
` (2 preceding siblings ...)
2022-05-11 7:34 ` aoliva at gcc dot gnu.org
@ 2022-05-13 6:01 ` cvs-commit at gcc dot gnu.org
2022-05-13 6:06 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-13 6:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105455
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Alexandre Oliva <aoliva@gcc.gnu.org>:
https://gcc.gnu.org/g:90a8eab4a1292430467f68b65e5127f7760acc94
commit r13-380-g90a8eab4a1292430467f68b65e5127f7760acc94
Author: Alexandre Oliva <oliva@adacore.com>
Date: Wed May 11 04:27:42 2022 -0300
[PR105455] Set edge probabilities when hardening conditionals
When turning unconditional edges into conditional, as in
gimple-harden-conditionals.cc:insert_check_and_trap, the newly-created
edge's probability comes out uninitialized, while the previously
unconditional edge's probability is presumably
profile_probability::always.
Mixing initialized and uninitialized probabilities before expand
breaks predict.cc:force_edge_cold: the initialized probability may end
up copied to a REG_BR_PROB note in a conditional branch insn, but if
force_edge_cold is called on that edge, it will find another edge with
uninitialized probability and assume the note is absent. Later on,
rtl_verify_edges complains that the note does not match the
probability modified by force_edge_cold in the edge.
This patch sets probabilities for edges affected by hardening of
conditionals, both the newly-created edges to trap blocks and the
previously-unconditional edges, so that the former are considered
never taken, while the latter are confirmed as always taken.
for gcc/ChangeLog
PR rtl-optimization/105455
* gimple-harden-conditionals.cc (insert_check_and_trap): Set
probabilities for newly-conditional edges.
for gcc/testsuite/ChangeLog
PR rtl-optimization/105455
* gcc.dg/pr105455.c: New.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug rtl-optimization/105455] ICE: verify_flow_info failed (error: verify_flow_info: REG_BR_PROB does not match cfg)
2022-05-02 16:29 [Bug rtl-optimization/105455] New: ICE: verify_flow_info failed (error: verify_flow_info: REG_BR_PROB does not match cfg) asolokha at gmx dot com
` (3 preceding siblings ...)
2022-05-13 6:01 ` cvs-commit at gcc dot gnu.org
@ 2022-05-13 6:06 ` cvs-commit at gcc dot gnu.org
2022-05-13 6:09 ` aoliva at gcc dot gnu.org
2022-11-07 4:51 ` pinskia at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-13 6:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105455
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Alexandre Oliva
<aoliva@gcc.gnu.org>:
https://gcc.gnu.org/g:e628690d6333f0cc4d338cd8b796408f35e07ced
commit r12-8372-ge628690d6333f0cc4d338cd8b796408f35e07ced
Author: Alexandre Oliva <oliva@adacore.com>
Date: Fri May 13 03:05:46 2022 -0300
[PR105455] Set edge probabilities when hardening conditionals
When turning unconditional edges into conditional, as in
gimple-harden-conditionals.cc:insert_check_and_trap, the newly-created
edge's probability comes out uninitialized, while the previously
unconditional edge's probability is presumably
profile_probability::always.
Mixing initialized and uninitialized probabilities before expand
breaks predict.cc:force_edge_cold: the initialized probability may end
up copied to a REG_BR_PROB note in a conditional branch insn, but if
force_edge_cold is called on that edge, it will find another edge with
uninitialized probability and assume the note is absent. Later on,
rtl_verify_edges complains that the note does not match the
probability modified by force_edge_cold in the edge.
This patch sets probabilities for edges affected by hardening of
conditionals, both the newly-created edges to trap blocks and the
previously-unconditional edges, so that the former are considered
never taken, while the latter are confirmed as always taken.
for gcc/ChangeLog
PR rtl-optimization/105455
* gimple-harden-conditionals.cc (insert_check_and_trap): Set
probabilities for newly-conditional edges.
for gcc/testsuite/ChangeLog
PR rtl-optimization/105455
* gcc.dg/pr105455.c: New.
(cherry picked from commit 90a8eab4a1292430467f68b65e5127f7760acc94)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug rtl-optimization/105455] ICE: verify_flow_info failed (error: verify_flow_info: REG_BR_PROB does not match cfg)
2022-05-02 16:29 [Bug rtl-optimization/105455] New: ICE: verify_flow_info failed (error: verify_flow_info: REG_BR_PROB does not match cfg) asolokha at gmx dot com
` (4 preceding siblings ...)
2022-05-13 6:06 ` cvs-commit at gcc dot gnu.org
@ 2022-05-13 6:09 ` aoliva at gcc dot gnu.org
2022-11-07 4:51 ` pinskia at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: aoliva at gcc dot gnu.org @ 2022-05-13 6:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105455
Alexandre Oliva <aoliva at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #5 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
Fixed, trunk and gcc-12.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug rtl-optimization/105455] ICE: verify_flow_info failed (error: verify_flow_info: REG_BR_PROB does not match cfg)
2022-05-02 16:29 [Bug rtl-optimization/105455] New: ICE: verify_flow_info failed (error: verify_flow_info: REG_BR_PROB does not match cfg) asolokha at gmx dot com
` (5 preceding siblings ...)
2022-05-13 6:09 ` aoliva at gcc dot gnu.org
@ 2022-11-07 4:51 ` pinskia at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-07 4:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105455
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |12.2
Known to fail| |12.1.0
Known to work| |12.2.0, 13.0
^ permalink raw reply [flat|nested] 8+ messages in thread