summaryrefslogtreecommitdiff
path: root/gcc/gimple-range-cache.cc
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2022-11-07 08:24:48 +0100
committerMartin Liska <mliska@suse.cz>2022-11-07 08:24:48 +0100
commit1b09b78ee61bd921ae78ebd0f7905b95b9e1c903 (patch)
tree9c04b59cdd2cd460f0727501d15402d31ffcf5a4 /gcc/gimple-range-cache.cc
parent1eb021edb27e26f95cda63df121f6bc951647599 (diff)
parentc4f8f8afd07680f9e718de1331cd09607bdd9ac8 (diff)
downloadgcc-1b09b78ee61bd921ae78ebd0f7905b95b9e1c903.tar.gz
Merge branch 'master' into devel/sphinx
Diffstat (limited to 'gcc/gimple-range-cache.cc')
-rw-r--r--gcc/gimple-range-cache.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc
index f279371948a..89e2403acce 100644
--- a/gcc/gimple-range-cache.cc
+++ b/gcc/gimple-range-cache.cc
@@ -1193,9 +1193,8 @@ ranger_cache::fill_block_cache (tree name, basic_block bb, basic_block def_bb)
Value_Range block_result (type);
Value_Range undefined (type);
- // At this point we shouldn't be looking at the def, entry or exit block.
- gcc_checking_assert (bb != def_bb && bb != ENTRY_BLOCK_PTR_FOR_FN (cfun) &&
- bb != EXIT_BLOCK_PTR_FOR_FN (cfun));
+ // At this point we shouldn't be looking at the def, entry block.
+ gcc_checking_assert (bb != def_bb && bb != ENTRY_BLOCK_PTR_FOR_FN (cfun));
gcc_checking_assert (m_workback.length () == 0);
// If the block cache is set, then we've already visited this block.
@@ -1434,10 +1433,15 @@ ranger_cache::range_from_dom (vrange &r, tree name, basic_block start_bb,
// Default value is global range.
get_global_range (r, name);
+ // The dominator of EXIT_BLOCK doesn't seem to be set, so at least handle
+ // the common single exit cases.
+ if (start_bb == EXIT_BLOCK_PTR_FOR_FN (cfun) && single_pred_p (start_bb))
+ bb = single_pred_edge (start_bb)->src;
+ else
+ bb = get_immediate_dominator (CDI_DOMINATORS, start_bb);
+
// Search until a value is found, pushing blocks which may need calculating.
- for (bb = get_immediate_dominator (CDI_DOMINATORS, start_bb);
- bb;
- prev_bb = bb, bb = get_immediate_dominator (CDI_DOMINATORS, bb))
+ for ( ; bb; prev_bb = bb, bb = get_immediate_dominator (CDI_DOMINATORS, bb))
{
// Accumulate any block exit inferred ranges.
m_exit.maybe_adjust_range (infer, name, bb);