This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tree-profiling] Fix to value profile transformations
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org, dalej at apple dot com
- Date: Fri, 25 Mar 2005 17:43:33 +0100
- Subject: [tree-profiling] Fix to value profile transformations
Hi,
in Mesa benchmark we actually cath the t%width where width is always
256, but we unwind it into the code
tmp = (cast)256;
if (val = tmp)
t = t % tmp;
else
t = t % val;
that is not faster than the former at all. Fixed by avoidiing the bogus
cast produced.
Bootstrapped/regtested x86-64-linux and commited.
Honza
2005-03-25 Jan Hubicka <jh@suse.cz>
* value-prof.c (tree_divmod_fixed_value): Use fold_convert to produce
conversion.
(tree_mon_pow2): Likewise.
Index: value-prof.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/value-prof.c,v
retrieving revision 1.2.4.7.2.8
diff -c -3 -p -r1.2.4.7.2.8 value-prof.c
*** value-prof.c 17 Mar 2005 22:24:29 -0000 1.2.4.7.2.8
--- value-prof.c 25 Mar 2005 00:09:01 -0000
*************** tree_divmod_fixed_value (tree stmt, tree
*** 1121,1127 ****
tmpv = create_tmp_var (optype, "PROF");
tmp1 = create_tmp_var (optype, "PROF");
! stmt1 = build2 (MODIFY_EXPR, optype, tmpv, build1 (NOP_EXPR, optype, value));
stmt2 = build2 (MODIFY_EXPR, optype, tmp1, op2);
stmt3 = build3 (COND_EXPR, void_type_node,
build2 (NE_EXPR, boolean_type_node, tmp1, tmpv),
--- 1121,1127 ----
tmpv = create_tmp_var (optype, "PROF");
tmp1 = create_tmp_var (optype, "PROF");
! stmt1 = build2 (MODIFY_EXPR, optype, tmpv, fold_convert (optype, value));
stmt2 = build2 (MODIFY_EXPR, optype, tmp1, op2);
stmt3 = build3 (COND_EXPR, void_type_node,
build2 (NE_EXPR, boolean_type_node, tmp1, tmpv),
*************** tree_mod_pow2 (tree stmt, tree operation
*** 1277,1283 ****
tmp1 = create_tmp_var (optype, "PROF");
tmp2 = create_tmp_var (optype, "PROF");
tmp3 = create_tmp_var (optype, "PROF");
! stmt1 = build2 (MODIFY_EXPR, optype, tmp1, build1 (NOP_EXPR, optype, op2));
stmt2 = build2 (MODIFY_EXPR, optype, tmp2,
build2 (PLUS_EXPR, optype, op2, integer_minus_one_node));
stmt3 = build2 (MODIFY_EXPR, optype, tmp3,
--- 1277,1283 ----
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,