[Bug target/80938] [7/8 Regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2330

2017-09-13 Thread aldyh at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80938

--- Comment #8 from Aldy Hernandez  ---
Author: aldyh
Date: Wed Sep 13 17:04:04 2017
New Revision: 252454

URL: https://gcc.gnu.org/viewcvs?rev=252454=gcc=rev
Log:
[RS6000] PR 80938, Don't emit frame info for regs that don't need saving

It is possible when using out-of-line register saves or store multiple
to save some registers unnecessarily, for example one reg in the block
saved might be unused.  We don't need to emit frame info for those
registers as that just bloats the info, and also can result in an ICE
when shrink-wrap gives multiple paths through the function saving
different sets of registers.  Join points need to have identical frame
register save state regardless of the path taken.

This patch reverts the previous fix for PR80939 "Use SAVE_MULTIPLE
only if we restore what it saves (PR80938)" and instead fixes the PR
by correcting the frame info.  The change to rs6000_savres_strategy
is an optimization, but note that it hides the underlying problem in
the PR testcase.

PR target/80938
* config/rs6000/rs6000.c (rs6000_savres_strategy): Revert 2017-08-09.
Don't use store multiple if only one reg needs saving.
(interesting_frame_related_regno): New function.
(rs6000_frame_related): Don't emit frame info for regs that
don't need saving.
(rs6000_emit_epilogue): Likewise.

Modified:
branches/range-gen2/gcc/ChangeLog
branches/range-gen2/gcc/config/rs6000/rs6000.c

[Bug target/80938] [7/8 Regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2330

2017-09-13 Thread aldyh at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80938

--- Comment #7 from Aldy Hernandez  ---
Author: aldyh
Date: Wed Sep 13 16:44:59 2017
New Revision: 252367

URL: https://gcc.gnu.org/viewcvs?rev=252367=gcc=rev
Log:
rs6000: Use SAVE_MULTIPLE only if we restore what it saves (PR80938)

We can have SAVE_MULTIPLE while we do not have REST_MULTIPLE.  If the
inline restore does not restore all registers, the CFI for the save
and restore can conflict if things are shrink-wrapped.

We could restore all registers that are saved (not ideal), or emit
the CFI notes to say we did (which will work fine, but is also not
so great); instead, let's not save the registers that are unused.


PR target/80938
* config/rs6000/rs6000.c (rs6000_savres_strategy): Don't use
SAVE_MULTIPLE if not all the registers that saves, should be saved.

Modified:
branches/range-gen2/gcc/ChangeLog
branches/range-gen2/gcc/config/rs6000/rs6000.c

[Bug target/80938] [7/8 Regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2330

2017-08-16 Thread amodra at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80938

--- Comment #6 from Alan Modra  ---
Author: amodra
Date: Thu Aug 17 02:03:03 2017
New Revision: 251140

URL: https://gcc.gnu.org/viewcvs?rev=251140=gcc=rev
Log:
[RS6000] PR 80938, Don't emit frame info for regs that don't need saving

It is possible when using out-of-line register saves or store multiple
to save some registers unnecessarily, for example one reg in the block
saved might be unused.  We don't need to emit frame info for those
registers as that just bloats the info, and also can result in an ICE
when shrink-wrap gives multiple paths through the function saving
different sets of registers.  Join points need to have identical frame
register save state regardless of the path taken.

This patch reverts the previous fix for PR80939 "Use SAVE_MULTIPLE
only if we restore what it saves (PR80938)" and instead fixes the PR
by correcting the frame info.  The change to rs6000_savres_strategy
is an optimization, but note that it hides the underlying problem in
the PR testcase.

PR target/80938
* config/rs6000/rs6000.c (rs6000_savres_strategy): Revert 2017-08-09.
Don't use store multiple if only one reg needs saving.
(interesting_frame_related_regno): New function.
(rs6000_frame_related): Don't emit frame info for regs that
don't need saving.
(rs6000_emit_epilogue): Likewise.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/rs6000/rs6000.c

[Bug target/80938] [7/8 Regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2330

2017-08-09 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80938

--- Comment #5 from Segher Boessenkool  ---
Fixed on trunk for rs6000; backports pending.

[Bug target/80938] [7/8 Regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2330

2017-08-09 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80938

--- Comment #4 from Segher Boessenkool  ---
Author: segher
Date: Wed Aug  9 21:08:33 2017
New Revision: 251005

URL: https://gcc.gnu.org/viewcvs?rev=251005=gcc=rev
Log:
rs6000: Use SAVE_MULTIPLE only if we restore what it saves (PR80938)

We can have SAVE_MULTIPLE while we do not have REST_MULTIPLE.  If the
inline restore does not restore all registers, the CFI for the save
and restore can conflict if things are shrink-wrapped.

We could restore all registers that are saved (not ideal), or emit
the CFI notes to say we did (which will work fine, but is also not
so great); instead, let's not save the registers that are unused.


PR target/80938
* config/rs6000/rs6000.c (rs6000_savres_strategy): Don't use
SAVE_MULTIPLE if not all the registers that saves, should be saved.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/rs6000/rs6000.c