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 PR23109


We cannot move 1/d from a/d to some place where it could trap
where a/d would not.  Not without -fno-trapping-math.

Looks like obvious, but ...

Ok for mainline?

Thanks,
Richard.

:ADDPATCH:

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

	PR tree-optimization/23109
	* tree-ssa-loop-im.c (determine_invariantness_stmt): Honour
	trapping math during hoisting 1/d.
	* tree-ssa-math-opts.c (gate_cse_reciprocals): Likewise.

Index: tree-ssa-loop-im.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-loop-im.c,v
retrieving revision 2.48
diff -c -3 -p -r2.48 tree-ssa-loop-im.c
*** tree-ssa-loop-im.c	30 Jun 2005 22:18:34 -0000	2.48
--- tree-ssa-loop-im.c	28 Jul 2005 14:59:56 -0000
*************** determine_invariantness_stmt (struct dom
*** 610,615 ****
--- 610,616 ----
  	  && (rhs = TREE_OPERAND (stmt, 1)) != NULL
  	  && TREE_CODE (rhs) == RDIV_EXPR
  	  && flag_unsafe_math_optimizations
+ 	  && !flag_trapping_math
  	  && outermost_invariant_loop_expr (TREE_OPERAND (rhs, 1),
  					    loop_containing_stmt (stmt)) != NULL
  	  && outermost_invariant_loop_expr (rhs,
Index: tree-ssa-math-opts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-math-opts.c,v
retrieving revision 2.2
diff -c -3 -p -r2.2 tree-ssa-math-opts.c
*** tree-ssa-math-opts.c	25 Jun 2005 02:01:43 -0000	2.2
--- tree-ssa-math-opts.c	28 Jul 2005 14:59:56 -0000
*************** Software Foundation, 51 Franklin Street,
*** 51,57 ****
  static bool
  gate_cse_reciprocals (void)
  {
!   return optimize && !optimize_size && flag_unsafe_math_optimizations;
  }
  
  /* Check if DEF's uses include more than one floating-point division,
--- 51,58 ----
  static bool
  gate_cse_reciprocals (void)
  {
!   return optimize && !optimize_size && flag_unsafe_math_optimizations
! 	 && !flag_trapping_math;
  }
  
  /* Check if DEF's uses include more than one floating-point division,


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