diff options
author | Alexandre Oliva <oliva@adacore.com> | 2022-05-11 04:27:42 -0300 |
---|---|---|
committer | Alexandre Oliva <oliva@gnu.org> | 2022-05-13 03:00:29 -0300 |
commit | 90a8eab4a1292430467f68b65e5127f7760acc94 (patch) | |
tree | 2c4f4a28c74683ba083cf0c6a2703ccc024b9112 /gcc/gimple-ssa-sprintf.cc | |
parent | 8ab4b484153031c407b7d8c760b6a2605da1199a (diff) | |
download | gcc-90a8eab4a1292430467f68b65e5127f7760acc94.zip gcc-90a8eab4a1292430467f68b65e5127f7760acc94.tar.gz gcc-90a8eab4a1292430467f68b65e5127f7760acc94.tar.bz2 |
[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.
Diffstat (limited to 'gcc/gimple-ssa-sprintf.cc')
0 files changed, 0 insertions, 0 deletions