[PATCH] Value profile based optimizations, part 1

Jan Hubicka jh@suse.cz
Sat Jun 14 12:49:00 GMT 2003


> Hello,
> 
> here is the new version of the patch updated for your comments.
> 
> Zdenek
> Index: flow.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/flow.c,v
> retrieving revision 1.551
> diff -c -3 -p -r1.551 flow.c
> *** flow.c	3 Jun 2003 23:17:27 -0000	1.551
> --- flow.c	13 Jun 2003 12:20:06 -0000
> *************** mark_used_regs (pbi, x, cond, insn)
> *** 3843,3849 ****
>   
>       case SUBREG:
>   #ifdef CANNOT_CHANGE_MODE_CLASS
> !       if (GET_CODE (SUBREG_REG (x)) == REG
>   	  && REGNO (SUBREG_REG (x)) >= FIRST_PSEUDO_REGISTER)
>   	bitmap_set_bit (&subregs_of_mode, REGNO (SUBREG_REG (x))
>   					  * MAX_MACHINE_MODE
> --- 3843,3850 ----
>   
>       case SUBREG:
>   #ifdef CANNOT_CHANGE_MODE_CLASS
> !       if ((flags & PROP_REG_INFO)
> ! 	  && GET_CODE (SUBREG_REG (x)) == REG

This should probably go to the other patch?
> +       safe_insert_insn_on_edge (sequence, e);

There will deifnitly be plaftorms not being able to save the flags
registers and so on.  Perhaps safe_insert_insn_on_edge should return
false in such case  and we should simply refuse to profile that value.
(this is probably saner behaviour than raw abort even when abort will
probably force us to add neccesary patterns).  But this can be done later.

> +   if (flag_profile_values)
> +     {
> +       life_analysis (get_insns (), NULL, PROP_DEATH_NOTES);
> +       find_values_to_profile (&n_values, &values);
> +       allocate_reg_info (max_reg_num (), FALSE, FALSE);

Please switch the current profiling code to safe insertion too once the
patch is approved. That would fix s390 misscompilation.
> +   /* Check if the stored value matches.  */
> +   do_compare_rtx_and_jump (copy_rtx (uval), copy_rtx (stored_value), EQ,
> + 			   0, mode, NULL_RTX, NULL_RTX, same_label);

Realizing Richard's idea of calling unshare_rtx on newly created
sequences would probably kill a lot of hidden dragons here (RTL sharing
is nasty and can in general come from machine dependent expanders)

> value-prof.c:
:)

Rest of the patch is OK so it can go in once the safe edge splitting
patch is reviewed.

Honza



More information about the Gcc-patches mailing list