http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49602

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-07-01 
14:52:30 UTC ---
The problem is that for the debug uses before going into SSA we obviously don't
want the uses to affect code generation and thus we don't call
set_livein_block.
Unfortunately that means get_current_def is sometimes incorrect during rewrite_

--- tree-into-ssa.c.jj 22011-06-23 10:13:58.000000000 +0200
+++ tree-into-ssa.c 2011-07-01 16:23:04.000000000 +0200
@@ -1343,7 +1343,15 @@ rewrite_debug_stmt_uses (gimple stmt)
             }
         }
       else
-        def = get_current_def (var);
+        {
+          def = get_current_def (var);
+          if (def
+              && !SSA_NAME_IS_DEFAULT_DEF (def)
+              && gimple_bb (SSA_NAME_DEF_STMT (def)) != gimple_bb (stmt)
+              && !dominated_by_p (CDI_DOMINATORS, gimple_bb (stmt),
+                                  gimple_bb (SSA_NAME_DEF_STMT (def))))
+            def = NULL;
+        }
       if (def == NULL)
         {
           gimple_debug_bind_reset_value (stmt);

seems to fix the ICE, the question is if get_current_def can be trusted to be
the right SSA_NAME even after this check.
I guess if the definition bb is the same as stmt's bb, it can, similarly
if get_phi_state (var) == NEED_PHI_STATE_NO (plus the dominated_by_p check
above), or if bitmap_bit_p (get_def_blocks_for (var)->livein_blocks, gimple_bb
(stmt)->index).  Any other cases?

Reply via email to