diff options
author | Richard Biener <rguenther@suse.de> | 2021-11-24 15:57:03 +0100 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2021-11-25 14:23:44 +0100 |
commit | 0fdd1804ee8ce04821110bb19c246f9d05248e22 (patch) | |
tree | d04382b1b1a08e058b32936d922d2a6ded762847 /gcc | |
parent | 555b8cc39062d1e02ed9117883229c75e17a8871 (diff) | |
download | gcc-0fdd1804ee8ce04821110bb19c246f9d05248e22.zip gcc-0fdd1804ee8ce04821110bb19c246f9d05248e22.tar.gz gcc-0fdd1804ee8ce04821110bb19c246f9d05248e22.tar.bz2 |
Remove never looping loop in label_rtx_for_bb
This refactors the IL "walk" in a way to avoid the loop which will
never iterate.
2021-11-25 Richard Biener <rguenther@suse.de>
* cfgexpand.c (label_rtx_for_bb): Remove dead loop construct.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cfgexpand.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index eb6466f..fb84d46 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -2461,9 +2461,6 @@ static hash_map<basic_block, rtx_code_label *> *lab_rtx_for_bb; static rtx_code_label * label_rtx_for_bb (basic_block bb ATTRIBUTE_UNUSED) { - gimple_stmt_iterator gsi; - tree lab; - if (bb->flags & BB_RTL) return block_label (bb); @@ -2472,21 +2469,12 @@ label_rtx_for_bb (basic_block bb ATTRIBUTE_UNUSED) return *elt; /* Find the tree label if it is present. */ - - for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) - { - glabel *lab_stmt; - - lab_stmt = dyn_cast <glabel *> (gsi_stmt (gsi)); - if (!lab_stmt) - break; - - lab = gimple_label_label (lab_stmt); - if (DECL_NONLOCAL (lab)) - break; - - return jump_target_rtx (lab); - } + gimple_stmt_iterator gsi = gsi_start_bb (bb); + glabel *lab_stmt; + if (!gsi_end_p (gsi) + && (lab_stmt = dyn_cast <glabel *> (gsi_stmt (gsi))) + && !DECL_NONLOCAL (gimple_label_label (lab_stmt))) + return jump_target_rtx (gimple_label_label (lab_stmt)); rtx_code_label *l = gen_label_rtx (); lab_rtx_for_bb->put (bb, l); |