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 type-mismatch in value profiling (PR22525)


This fixes two uses of integer_zero_node and integer_minus_one_node to
use the proper types.  It also removes one unnecessary temporary.

Bootstrapped and regtested on x86_64-unknown-linux-gnu.

Ok for mainline?

Thanks,
Richard.

2006-04-19  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/22525
	* value-prof.c (tree_mod_pow2): Remove unnecessary temporary
	variable, adjust types of generated expressions.

Index: value-prof.c
===================================================================
*** value-prof.c	(revision 113070)
--- value-prof.c	(working copy)
*************** tree_mod_pow2 (tree stmt, tree operation
*** 342,348 ****
  	       gcov_type count, gcov_type all)
  {
    tree stmt1, stmt2, stmt3, stmt4;
!   tree tmp1, tmp2, tmp3;
    tree label_decl1 = create_artificial_label ();
    tree label_decl2 = create_artificial_label ();
    tree label_decl3 = create_artificial_label ();
--- 342,348 ----
  	       gcov_type count, gcov_type all)
  {
    tree stmt1, stmt2, stmt3, stmt4;
!   tree tmp2, tmp3;
    tree label_decl1 = create_artificial_label ();
    tree label_decl2 = create_artificial_label ();
    tree label_decl3 = create_artificial_label ();
*************** tree_mod_pow2 (tree stmt, tree operation
*** 357,375 ****
    bb = bb_for_stmt (stmt);
    bsi = bsi_for_stmt (stmt);
  
-   tmp1 = create_tmp_var (optype, "PROF");
    tmp2 = create_tmp_var (optype, "PROF");
    tmp3 = create_tmp_var (optype, "PROF");
-   stmt1 = build2 (MODIFY_EXPR, optype, tmp1, fold_convert (optype, op2));
    stmt2 = build2 (MODIFY_EXPR, optype, tmp2, 
! 		    build2 (PLUS_EXPR, optype, op2, integer_minus_one_node));
    stmt3 = build2 (MODIFY_EXPR, optype, tmp3,
! 		    build2 (BIT_AND_EXPR, optype, tmp2, tmp1));
    stmt4 = build3 (COND_EXPR, void_type_node,
! 	    build2 (NE_EXPR, boolean_type_node, tmp3, integer_zero_node),
! 	    build1 (GOTO_EXPR, void_type_node, label_decl2),
! 	    build1 (GOTO_EXPR, void_type_node, label_decl1));
!   bsi_insert_before (&bsi, stmt1, BSI_SAME_STMT);
    bsi_insert_before (&bsi, stmt2, BSI_SAME_STMT);
    bsi_insert_before (&bsi, stmt3, BSI_SAME_STMT);
    bsi_insert_before (&bsi, stmt4, BSI_SAME_STMT);
--- 357,373 ----
    bb = bb_for_stmt (stmt);
    bsi = bsi_for_stmt (stmt);
  
    tmp2 = create_tmp_var (optype, "PROF");
    tmp3 = create_tmp_var (optype, "PROF");
    stmt2 = build2 (MODIFY_EXPR, optype, tmp2, 
! 		  build2 (PLUS_EXPR, optype, op2, build_int_cst (optype, -1)));
    stmt3 = build2 (MODIFY_EXPR, optype, tmp3,
! 		  build2 (BIT_AND_EXPR, optype, tmp2, op2));
    stmt4 = build3 (COND_EXPR, void_type_node,
! 		  build2 (NE_EXPR, boolean_type_node,
! 			  tmp3, build_int_cst (optype, 0)),
! 		  build1 (GOTO_EXPR, void_type_node, label_decl2),
! 	 	  build1 (GOTO_EXPR, void_type_node, label_decl1));
    bsi_insert_before (&bsi, stmt2, BSI_SAME_STMT);
    bsi_insert_before (&bsi, stmt3, BSI_SAME_STMT);
    bsi_insert_before (&bsi, stmt4, BSI_SAME_STMT);


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