diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2021-09-28 09:38:50 +0200 |
---|---|---|
committer | Aldy Hernandez <aldyh@redhat.com> | 2021-09-28 11:11:20 +0200 |
commit | fb8b72ebb5b0bf40f7dfef9154c42320ce46f2a7 (patch) | |
tree | 081a7f87af777eb72e4a6dbca7006979193e69b1 /gcc/gimple-range-path.cc | |
parent | dc614a838ecc33578e0903fec599fee6844680a7 (diff) | |
download | gcc-fb8b72ebb5b0bf40f7dfef9154c42320ce46f2a7.zip gcc-fb8b72ebb5b0bf40f7dfef9154c42320ce46f2a7.tar.gz gcc-fb8b72ebb5b0bf40f7dfef9154c42320ce46f2a7.tar.bz2 |
Return VARYING in range_on_path_entry if nothing found.
The problem here is that the solver's code solving unknown SSAs on entry
to a path was returning UNDEFINED if there were no incoming edges to the
start of the path that were not the function entry block. This caused a
cascade of pain down stream.
Tested on x86-64 Linux.
PR tree-optimization/102511
gcc/ChangeLog:
* gimple-range-path.cc (path_range_query::range_on_path_entry):
Return VARYING when nothing found.
gcc/testsuite/ChangeLog:
* gcc.dg/pr102511.c: New test.
* gcc.dg/tree-ssa/ssa-dom-thread-14.c: Adjust.
Diffstat (limited to 'gcc/gimple-range-path.cc')
-rw-r--r-- | gcc/gimple-range-path.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/gimple-range-path.cc b/gcc/gimple-range-path.cc index 71e04e4..9da67d2 100644 --- a/gcc/gimple-range-path.cc +++ b/gcc/gimple-range-path.cc @@ -136,14 +136,23 @@ path_range_query::range_on_path_entry (irange &r, tree name) { int_range_max tmp; basic_block entry = entry_bb (); + bool changed = false; + r.set_undefined (); for (unsigned i = 0; i < EDGE_COUNT (entry->preds); ++i) { edge e = EDGE_PRED (entry, i); if (e->src != ENTRY_BLOCK_PTR_FOR_FN (cfun) && m_ranger.range_on_edge (tmp, e, name)) - r.union_ (tmp); + { + r.union_ (tmp); + changed = true; + } } + + // Make sure we don't return UNDEFINED by mistake. + if (!changed) + r.set_varying (TREE_TYPE (name)); } // Return the range of NAME at the end of the path being analyzed. |