------- Additional Comments From pinskia at gcc dot gnu dot org  2005-04-15 
21:11 -------
I am testing the following patch:
Index: tree-ssa-loop-im.c
===============================================================
====
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-loop-im.c,v
retrieving revision 2.36
diff -u -p -r2.36 tree-ssa-loop-im.c
--- tree-ssa-loop-im.c  11 Apr 2005 20:17:38 -0000      2.36
+++ tree-ssa-loop-im.c  15 Apr 2005 21:10:37 -0000
@@ -38,6 +38,7 @@ Software Foundation, 59 Temple Place - S
 #include "tree-pass.h"
 #include "flags.h"
 #include "real.h"
+#include "tree-ssa-propagate.h"
 
 /* TODO:  Support for predicated code motion.  I.e.
 
@@ -600,7 +601,7 @@ determine_invariantness_stmt (struct dom
          && outermost_invariant_loop_expr (rhs,
                                            loop_containing_stmt (stmt)) == 
NULL)
        {
-         tree lhs, stmt1, stmt2, var, name;
+         tree lhs, stmt1, var, name, tmp;
 
          lhs = TREE_OPERAND (stmt, 0);
 
@@ -614,17 +615,16 @@ determine_invariantness_stmt (struct dom
                                  TREE_OPERAND (rhs, 1)));
          name = make_ssa_name (var, stmt1);
          TREE_OPERAND (stmt1, 0) = name;
-         stmt2 = build2 (MODIFY_EXPR, void_type_node, lhs,
-                         build2 (MULT_EXPR, TREE_TYPE (rhs),
-                                 name, TREE_OPERAND (rhs, 0)));
+         tmp = build2 (MULT_EXPR, TREE_TYPE (rhs),
+                       name, TREE_OPERAND (rhs, 0));
 
          /* Replace division stmt with reciprocal and multiply stmts.
             The multiply stmt is not invariant, so update iterator
             and avoid rescanning.  */
-         bsi_replace (&bsi, stmt1, true);
-         get_stmt_operands (stmt1);  /* Should not be necessary.  */
-         bsi_insert_after (&bsi, stmt2, BSI_NEW_STMT);
-         SSA_NAME_DEF_STMT (lhs) = stmt2;
+         bsi_insert_before (&bsi, stmt1, BSI_SAME_STMT);
+         if (!set_rhs (bsi_stmt_ptr (bsi), tmp))
+           abort ();
+         update_stmt (stmt);
 
          /* Continue processing with invariant reciprocal statment.  */
          stmt = stmt1;


-- 


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

Reply via email to