diff options
author | Richard Biener <rguenther@suse.de> | 2022-08-31 14:04:46 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2022-08-31 15:20:41 +0200 |
commit | 88f29a8aa82f2788baf2f9865940d4c83012c580 (patch) | |
tree | b60c09aad26b08a142caa6a891af72566709b0a2 /gcc/gimple-predicate-analysis.cc | |
parent | 25dd2768afdb8fad7b11d511eb5f739958f9870d (diff) | |
download | gcc-88f29a8aa82f2788baf2f9865940d4c83012c580.zip gcc-88f29a8aa82f2788baf2f9865940d4c83012c580.tar.gz gcc-88f29a8aa82f2788baf2f9865940d4c83012c580.tar.bz2 |
tree-optimization/90994 - fix uninit diagnostics with EH
r12-3640-g94c12ffac234b2 sneaked in a hack to avoid the diagnostic
for the testcase in PR90994 which sees non-call EH control flow
confusing predicate analysis. The following patch instead adjusts
the existing code handling EH to handle non-calls and do what I
think was intented.
PR tree-optimization/90994
* gimple-predicate-analysis.cc (predicate::init_from_control_deps):
Ignore exceptional control flow and skip the edge for the purpose of
predicate generation also for non-calls.
* g++.dg/torture/pr90994.C: New testcase.
Diffstat (limited to 'gcc/gimple-predicate-analysis.cc')
-rw-r--r-- | gcc/gimple-predicate-analysis.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/gcc/gimple-predicate-analysis.cc b/gcc/gimple-predicate-analysis.cc index 49500b7..58eade4 100644 --- a/gcc/gimple-predicate-analysis.cc +++ b/gcc/gimple-predicate-analysis.cc @@ -41,6 +41,7 @@ #include "calls.h" #include "value-query.h" #include "cfganal.h" +#include "tree-eh.h" #include "gimple-predicate-analysis.h" @@ -1709,9 +1710,6 @@ predicate::init_from_control_deps (const vec<edge> *dep_chains, } /* Get the conditional controlling the bb exit edge. */ gimple *cond_stmt = gsi_stmt (gsi); - if (is_gimple_call (cond_stmt) && EDGE_COUNT (e->src->succs) >= 2) - /* Ignore EH edge. Can add assertion on the other edge's flag. */ - continue; /* Skip this edge if it is bypassing an abort - when the condition is not satisfied we are neither reaching the definition nor the use so it isn't meaningful. Note if @@ -1819,10 +1817,15 @@ predicate::init_from_control_deps (const vec<edge> *dep_chains, has_valid_pred = true; } } + else if (stmt_can_throw_internal (cfun, cond_stmt) + && !(e->flags & EDGE_EH)) + /* Ignore the exceptional control flow and proceed as if + E were a fallthru without a controlling predicate for + both the USE (valid) and DEF (questionable) case. */ + has_valid_pred = true; else { - /* Disabled. See PR 90994. - has_valid_pred = false; */ + has_valid_pred = false; break; } } |