[x86] Fix PR target/48142
Uros Bizjak
ubizjak@gmail.com
Thu Mar 31 10:10:00 GMT 2011
Hello!
> this is a regression present for x86-64 on mainline and 4.6 branch with the
> options -Os -mpreferred-stack-boundary=5 -fstack-check -fno-omit-frame-pointer.
> This improbable combination of options is necessary because you need to have
> stack checking + stack realignment + !ACCUMULATE_OUTGOING_ARGS. In this case,
> the DW_CFA_GNU_args_size CFIs must be correct in spite of the frame pointer.
>
> Tested on {i586,x86_64}-suse-linux, OK for mainline and 4.6 branch?
>
>
> 2011-03-30 Eric Botcazou <ebotcazou@adacore.com>
>
> PR target/48142
> * config/i386/i386.c (ix86_adjust_stack_and_probe): Differentiate
> frame-related from frame-unrelated adjustments to the stack pointer.
- cfun->machine->fs.sp_offset += size;
+
+ /* Even if the stack pointer isn't the CFA register, we need to correctly
+ describe the adjustments made to it, in particular differentiate the
+ frame-related ones from the frame-unrelated ones. */
+ if (size > 0)
+ {
+ rtx expr = gen_rtx_SEQUENCE (VOIDmode, rtvec_alloc (2));
+ XVECEXP (expr, 0, 0)
+ = gen_rtx_SET (VOIDmode, stack_pointer_rtx,
+ plus_constant (stack_pointer_rtx, -size));
+ XVECEXP (expr, 0, 1)
+ = gen_rtx_SET (VOIDmode, stack_pointer_rtx,
+ plus_constant (stack_pointer_rtx,
+ PROBE_INTERVAL + dope + size));
+ add_reg_note (last, REG_FRAME_RELATED_EXPR, expr);
+ RTX_FRAME_RELATED_P (last) = 1;
+
+ cfun->machine->fs.sp_offset += size;
+ }
Is there a reason why we can't just cancel (+ size and -size) in these
two expressions to:
XVECEXP (expr, 0, 0)
= gen_rtx_SET (VOIDmode, stack_pointer_rtx,
plus_constant (stack_pointer_rtx,
PROBE_INTERVAL + dope));
Uros.
More information about the Gcc-patches
mailing list