public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/aoliva/heads/testme)] hardcfr: fix wrong assert in optional checks
@ 2022-10-25 2:51 Alexandre Oliva
0 siblings, 0 replies; only message in thread
From: Alexandre Oliva @ 2022-10-25 2:51 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:02902e20b69fd7636f04dcbfb6eedba2e20fa349
commit 02902e20b69fd7636f04dcbfb6eedba2e20fa349
Author: Alexandre Oliva <oliva@adacore.com>
Date: Fri Oct 21 00:10:39 2022 -0300
hardcfr: fix wrong assert in optional checks
An assert check in the previous hardcfr patch was too strict.
libgfortran/io/list_read.c:eat_separator failed the check intended to
detect overlaps between chk_edges src blocks and chkcall_blocks
because there were two edges with the same src block. Relax the
assert to tell the difference.
for gcc/ChangeLog
* gimple-harden-control-flow.cc
(pass_harden_control_flow_redundancy::execute): Relax overlap
check between chkcall_blocks and chk_edges src blocks to
tolerate multiple edges with the same src.
Diff:
---
gcc/gimple-harden-control-flow.cc | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/gcc/gimple-harden-control-flow.cc b/gcc/gimple-harden-control-flow.cc
index fe322f021ee..5c66762d448 100644
--- a/gcc/gimple-harden-control-flow.cc
+++ b/gcc/gimple-harden-control-flow.cc
@@ -680,9 +680,10 @@ public:
gsi_insert_seq_on_edge_immediate (e, seq);
}
- /* Add checking code to CHK_EDGES, and initialization code on
- the entry edge. Before this point, the CFG has been undisturbed,
- and all the needed data has been collected and safely stowed. */
+ /* Add checking code to CHK_EDGES and CHKCALL_BLOCKS, and
+ initialization code on the entry edge. Before this point, the
+ CFG has been undisturbed, and all the needed data has been
+ collected and safely stowed. */
void check (chk_edges_t &chk_edges,
int count_chkcall, auto_sbitmap const &chkcall_blocks)
{
@@ -807,8 +808,8 @@ public:
{
/* Inline checking requires a single exit edge. */
gimple *last = gimple_build_assign (visited,
- build_clobber
- (TREE_TYPE (visited)));
+ build_clobber
+ (TREE_TYPE (visited)));
gimple_seq_add_stmt (&ckseq, last);
if (!count_chkcall)
@@ -1382,7 +1383,9 @@ pass_harden_control_flow_redundancy::execute (function *fun)
edge *e;
FOR_EACH_VEC_ELT (chk_edges, i, e)
if (!bitmap_set_bit (combined_blocks, (*e)->src->index))
- gcc_unreachable ();
+ /* There may be multiple chk_edges with the same src block;
+ guard againt overlaps with chkcall_blocks only. */
+ gcc_assert (!bitmap_bit_p (chkcall_blocks, (*e)->src->index));
/* Visit blocks in index order, because building rtcfg depends on
that. Blocks must be compact, which the cleanup_cfg requirement
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-10-25 2:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-25 2:51 [gcc(refs/users/aoliva/heads/testme)] hardcfr: fix wrong assert in optional checks Alexandre Oliva
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).