[PATCH, rtl]: Fix PR rtl-optimization/32450: Call to mcount clobbers registers

Eric Botcazou ebotcazou@libertysurf.fr
Fri Jul 6 08:19:00 GMT 2007


> Attached patch fixes this issue with a Big Hammer Approach. When
> profiling is on, "blockage" insn nails instructions down to where they
> should be, preventing them to escape past NOTE_INSN_PROLOGUE_END.

I guess that the alternative would be to also emit the call to the profiling 
routine in the RTL stream.  Probably not worth the pain.

> 2007-07-05  Uros Bizjak  <ubizjak@gmail.com>
>
>         PR rtl_optimization/32450
>        * function.c (thread_prologue_and_epilogue_insns): Emit blockage insn
>         to ensure that instructions are not moved into the prologue when
>         profiling is on.  Remove unused prologue_end variable.
>         (expand_function_end): Emit blockage insn instead of ASM_INPUT rtx
>         as a scheduling barrier.

OK everywhere if you expand a bit on the problem in the comment, e.g.

 /* Ensure that instructions are not moved into the prologue when
    profiling is on, lest the profiling routine is emitted within
    the live range of a call-clobbered register.  */

> 2007-07-05  Uros Bizjak  <ubizjak@gmail.com>
>
>         PR rtl_optimization/32450
>         * gcc.dg/pr32450.c: New runtime test.

-march=core2 is problematic, -mtune=core2 instead if it is accepted (not on 
the 4.1 branch) and the testcase still fails.

-- 
Eric Botcazou



More information about the Gcc-patches mailing list