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]

Re: [PATCH] Fix PR18589


On Thu, 2012-04-12 at 09:50 -0700, H.J. Lu wrote:
> On Thu, Apr 5, 2012 at 6:49 AM, William J. Schmidt
> <wschmidt@linux.vnet.ibm.com> wrote:
> > On Thu, 2012-04-05 at 11:23 +0200, Richard Guenther wrote:
> >> On Wed, Apr 4, 2012 at 9:15 PM, William J. Schmidt
> >> <wschmidt@linux.vnet.ibm.com> wrote:
> >> >
> >> > Unfortunately this seems to be necessary if I name the two passes
> >> > "reassoc1" and "reassoc2".  If I try to name both of them "reassoc" I
> >> > get failures in other tests like gfortran.dg/reassoc_4, where
> >> > -fdump-tree-reassoc1 doesn't work.  Unless I'm missing something
> >> > obvious, I think I need to keep that change.
> >>
> >> Hm, naming them "reassoc1" and "reassoc2" is a hack.  Naming both
> >> "reassoc" will not trigger re-naming them to reassoc1 and reassoc2
> >> I think.  How ugly.  Especially that -fdump-tree-reassoc will no longer
> >> work.  Maybe instead of using two pass structs resort to using
> >> the existing hack with using first_pass_instance and TODO_mark_first_instance.
> >
> > OK, that seems to be the best among evils.  Using the
> > first_pass_instance hack, the patch is transformed as below.
> > Regstrapped on powerpc64-linux, no additional failures.  OK for trunk?
> >
> > Thanks,
> > Bill
> >
> >
> > gcc:
> >
> > 2012-04-05  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
> >
> >        PR tree-optimization/18589
> >        * tree-ssa-reassoc.c (reassociate_stats): Add two fields.
> >        (operand_entry): Add count field.
> >        (add_repeat_to_ops_vec): New function.
> >        (completely_remove_stmt): Likewise.
> >        (remove_def_if_absorbed_call): Likewise.
> >        (remove_visited_stmt_chain): Remove feeding builtin pow/powi calls.
> >        (acceptable_pow_call): New function.
> >        (linearize_expr_tree): Look for builtin pow/powi calls and add operand
> >        entries with repeat counts when found.
> >        (repeat_factor_d): New struct and associated typedefs.
> >        (repeat_factor_vec): New static vector variable.
> >        (compare_repeat_factors): New function.
> >        (get_reassoc_pow_ssa_name): Likewise.
> >        (attempt_builtin_powi): Likewise.
> >        (reassociate_bb): Call attempt_builtin_powi.
> >        (fini_reassoc): Two new calls to statistics_counter_event.
> >
> 
> It breaks bootstrap on Linux/ia32:
> 
> ../../src-trunk/gcc/tree-ssa-reassoc.c: In function 'void
> attempt_builtin_powi(gimple, VEC_operand_entry_t_heap**,
> tree_node**)':
> ../../src-trunk/gcc/tree-ssa-reassoc.c:3189:41: error: format '%ld'
> expects argument of type 'long int', but argument 3 has type 'long
> long int' [-Werror=format]
>      fprintf (dump_file, ")^%ld\n", power);
>                                          ^
> ../../src-trunk/gcc/tree-ssa-reassoc.c:3222:44: error: format '%ld'
> expects argument of type 'long int', but argument 3 has type 'long
> long int' [-Werror=format]
>         fprintf (dump_file, ")^%ld\n", power);
>                                             ^
> cc1plus: all warnings being treated as errors
> 
> 
> H.J.
> 

Thanks, H.J.  Sorry for the problem!

Fixing as follows.  I'll plan to commit as obvious shortly.


2012-04-12  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	* tree-ssa-reassoc.c (attempt_builtin_powi_stats): Change %ld to
	HOST_WIDE_INT_PRINT_DEC in format strings.


Index: gcc/tree-ssa-reassoc.c
===================================================================
--- gcc/tree-ssa-reassoc.c	(revision 186384)
+++ gcc/tree-ssa-reassoc.c	(working copy)
@@ -3186,7 +3186,8 @@ attempt_builtin_powi (gimple stmt, VEC(operand_ent
 		      if (elt < vec_len - 1)
 			fputs (" * ", dump_file);
 		    }
-		  fprintf (dump_file, ")^%ld\n", power);
+		  fprintf (dump_file, ")^"HOST_WIDE_INT_PRINT_DEC"\n",
+			   power);
 		}
 	    }
 	}
@@ -3219,7 +3220,7 @@ attempt_builtin_powi (gimple stmt, VEC(operand_ent
 		  if (elt < vec_len - 1)
 		    fputs (" * ", dump_file);
 		}
-	      fprintf (dump_file, ")^%ld\n", power);
+	      fprintf (dump_file, ")^"HOST_WIDE_INT_PRINT_DEC"\n", power);
 	    }
 
 	  reassociate_stats.pows_created++;



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