OSDN Git Service

* cprop.c (local_cprop_pass): Don't set changed for debug insns.
[pf3gnuchains/gcc-fork.git] / gcc / tree-ssa.c
index 9bdcdfc..f0bbf3b 100644 (file)
@@ -507,6 +507,37 @@ insert_debug_temps_for_defs (gimple_stmt_iterator *gsi)
     }
 }
 
+/* Reset all debug stmts that use SSA_NAME(s) defined in STMT.  */
+
+void
+reset_debug_uses (gimple stmt)
+{
+  ssa_op_iter op_iter;
+  def_operand_p def_p;
+  imm_use_iterator imm_iter;
+  gimple use_stmt;
+
+  if (!MAY_HAVE_DEBUG_STMTS)
+    return;
+
+  FOR_EACH_PHI_OR_STMT_DEF (def_p, stmt, op_iter, SSA_OP_DEF)
+    {
+      tree var = DEF_FROM_PTR (def_p);
+
+      if (TREE_CODE (var) != SSA_NAME)
+       continue;
+
+      FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, var)
+       {
+         if (!gimple_debug_bind_p (use_stmt))
+           continue;
+
+         gimple_debug_bind_reset_value (use_stmt);
+         update_stmt (use_stmt);
+       }
+    }
+}
+
 /* Delete SSA DEFs for SSA versions in the TOREMOVE bitmap, removing
    dominated stmts before their dominators, so that release_ssa_defs
    stands a chance of propagating DEFs into debug bind stmts.  */
@@ -1275,6 +1306,13 @@ useless_type_conversion_p (tree outer_type, tree inner_type)
          || TYPE_PRECISION (inner_type) != TYPE_PRECISION (outer_type))
        return false;
 
+      /* Preserve conversions to BOOLEAN_TYPE if it is not of precision
+         one.  */
+      if (TREE_CODE (inner_type) != BOOLEAN_TYPE
+         && TREE_CODE (outer_type) == BOOLEAN_TYPE
+         && TYPE_PRECISION (outer_type) != 1)
+       return false;
+
       /* We don't need to preserve changes in the types minimum or
         maximum value in general as these do not generate code
         unless the types precisions are different.  */
@@ -1855,7 +1893,7 @@ maybe_rewrite_mem_ref_base (tree *tp)
                        TYPE_SIZE (TREE_TYPE (*tp)),
                        int_const_binop (MULT_EXPR,
                                         bitsize_int (BITS_PER_UNIT),
-                                        TREE_OPERAND (*tp, 1), 0));
+                                        TREE_OPERAND (*tp, 1)));
        }
       else if (TREE_CODE (TREE_TYPE (sym)) == COMPLEX_TYPE
               && useless_type_conversion_p (TREE_TYPE (*tp),
@@ -2199,6 +2237,17 @@ execute_update_addresses_taken (void)
                  }
              }
 
+           else if (gimple_debug_bind_p (stmt)
+                    && gimple_debug_bind_has_value_p (stmt))
+             {
+               tree *valuep = gimple_debug_bind_get_value_ptr (stmt);
+               tree decl;
+               maybe_rewrite_mem_ref_base (valuep);
+               decl = non_rewritable_mem_ref_base (*valuep);
+               if (decl && symbol_marked_for_renaming (decl))
+                 gimple_debug_bind_reset_value (stmt);
+             }
+
            if (gimple_references_memory_p (stmt)
                || is_gimple_debug (stmt))
              update_stmt (stmt);