This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR23133


This fixes a missing optimization in recip as it does not consider
function parameters as reciprocal to be hoisted.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

Ok for mainline if testing succeeds?

Thanks,
Richard.


2005-07-29  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/23133
	* tree-ssa-math-opts.c (execute_cse_reciprocals): Walk
	current functions parameter decls to find defs to cse
	reciprocals of.


*** tree-ssa-math-opts.c.orig	2005-07-29 16:44:49.000000000 +0200
--- tree-ssa-math-opts.c	2005-07-29 16:44:59.000000000 +0200
*************** static void
*** 122,131 ****
--- 122,141 ----
  execute_cse_reciprocals (void)
  {
    basic_block bb;
+   tree arg;
  
    if (flag_trapping_math)
      calculate_dominance_info (CDI_POST_DOMINATORS);
  
+   if (single_succ_p (ENTRY_BLOCK_PTR))
+     for (arg = DECL_ARGUMENTS (cfun->decl); arg; arg = TREE_CHAIN (arg))
+       if (default_def (arg))
+ 	{
+ 	  block_stmt_iterator bsi;
+ 	  bsi = bsi_start (single_succ (ENTRY_BLOCK_PTR));
+           execute_cse_reciprocals_1 (&bsi, default_def (arg), false);
+ 	}
+ 
    FOR_EACH_BB (bb)
      {
        block_stmt_iterator bsi;
*************** execute_cse_reciprocals (void)
*** 149,155 ****
  	  if (TREE_CODE (stmt) == MODIFY_EXPR
  	      && (def = SINGLE_SSA_TREE_OPERAND (stmt, SSA_OP_DEF)) != NULL
  	      && FLOAT_TYPE_P (TREE_TYPE (def))
! 	      && is_gimple_reg (def))
  	    execute_cse_reciprocals_1 (&bsi, def, false);
  	}
      }
--- 159,165 ----
  	  if (TREE_CODE (stmt) == MODIFY_EXPR
  	      && (def = SINGLE_SSA_TREE_OPERAND (stmt, SSA_OP_DEF)) != NULL
  	      && FLOAT_TYPE_P (TREE_TYPE (def))
! 	      && TREE_CODE (def) == SSA_NAME)
  	    execute_cse_reciprocals_1 (&bsi, def, false);
  	}
      }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]