diff options
author | Jakub Jelinek <jakub@redhat.com> | 2011-07-04 19:19:52 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2011-07-04 19:19:52 +0200 |
commit | 15923c25df505b21061fda148dcb2b036af4735a (patch) | |
tree | 923ee6bb7c94810daeb4d2239aece6bc1e8b8edd /gcc/tree-into-ssa.c | |
parent | 0d5e0c1bf0e68323091e3f3152ad4676cd59e53d (diff) | |
download | gcc-15923c25df505b21061fda148dcb2b036af4735a.zip gcc-15923c25df505b21061fda148dcb2b036af4735a.tar.gz gcc-15923c25df505b21061fda148dcb2b036af4735a.tar.bz2 |
re PR debug/49602 (verify_ssa failed (definition does not dominate use) with "-O2 -g")
PR debug/49602
* tree-into-ssa.c (rewrite_debug_stmt_uses): Disregard
get_current_def return value if it can't be trusted to be
the current value of the variable in the current bb.
* gcc.dg/pr49602.c: New test.
From-SVN: r175818
Diffstat (limited to 'gcc/tree-into-ssa.c')
-rw-r--r-- | gcc/tree-into-ssa.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c index 0db9085..5fd3445 100644 --- a/gcc/tree-into-ssa.c +++ b/gcc/tree-into-ssa.c @@ -1343,7 +1343,41 @@ rewrite_debug_stmt_uses (gimple stmt) } } else - def = get_current_def (var); + { + def = get_current_def (var); + /* Check if get_current_def can be trusted. */ + if (def) + { + basic_block bb = gimple_bb (stmt); + basic_block def_bb + = SSA_NAME_IS_DEFAULT_DEF (def) + ? NULL : gimple_bb (SSA_NAME_DEF_STMT (def)); + + /* If definition is in current bb, it is fine. */ + if (bb == def_bb) + ; + /* If definition bb doesn't dominate the current bb, + it can't be used. */ + else if (def_bb && !dominated_by_p (CDI_DOMINATORS, bb, def_bb)) + def = NULL; + /* If there is just one definition and dominates the current + bb, it is fine. */ + else if (get_phi_state (var) == NEED_PHI_STATE_NO) + ; + else + { + struct def_blocks_d *db_p = get_def_blocks_for (var); + + /* If there are some non-debug uses in the current bb, + it is fine. */ + if (bitmap_bit_p (db_p->livein_blocks, bb->index)) + ; + /* Otherwise give up for now. */ + else + def = NULL; + } + } + } if (def == NULL) { gimple_debug_bind_reset_value (stmt); |