From 3489cc3363c657e70b5c4dd25abf6f0de6d83c72 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Fri, 7 Feb 2014 14:49:12 +0000 Subject: [PATCH] var-tracking.c (vt_stack_adjustments): Don't require stack_adjusts to match for the exit block. gcc/ * var-tracking.c (vt_stack_adjustments): Don't require stack_adjusts to match for the exit block. From-SVN: r207602 --- gcc/ChangeLog | 5 +++++ gcc/var-tracking.c | 21 +++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 13fac243bb4..f6e3143b32f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-02-07 Richard Sandiford + + * var-tracking.c (vt_stack_adjustments): Don't require stack_adjusts + to match for the exit block. + 2014-02-07 Andreas Krebbel * config/s390/s390.md ("atomic_load", "atomic_store") diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c index a13cac79f37..c5ce1dd17b4 100644 --- a/gcc/var-tracking.c +++ b/gcc/var-tracking.c @@ -886,8 +886,25 @@ vt_stack_adjustments (void) } else { - /* Check whether the adjustments on the edges are the same. */ - if (VTI (dest)->in.stack_adjust != VTI (src)->out.stack_adjust) + /* We can end up with different stack adjustments for the exit block + of a shrink-wrapped function if stack_adjust_offset_pre_post + doesn't understand the rtx pattern used to restore the stack + pointer in the epilogue. For example, on s390(x), the stack + pointer is often restored via a load-multiple instruction + and so no stack_adjust offset is recorded for it. This means + that the stack offset at the end of the epilogue block is the + the same as the offset before the epilogue, whereas other paths + to the exit block will have the correct stack_adjust. + + It is safe to ignore these differences because (a) we never + use the stack_adjust for the exit block in this pass and + (b) dwarf2cfi checks whether the CFA notes in a shrink-wrapped + function are correct. + + We must check whether the adjustments on other edges are + the same though. */ + if (dest != EXIT_BLOCK_PTR_FOR_FN (cfun) + && VTI (dest)->in.stack_adjust != VTI (src)->out.stack_adjust) { free (stack); return false;