On 03/24/2017 07:04 AM, Jakub Jelinek wrote:
On Fri, Mar 24, 2017 at 06:37:10AM -0600, Jeff Law wrote:
2017-03-21  Jakub Jelinek  <ja...@redhat.com>

        PR target/80102
        * cfgcleanup.c (old_insns_match_p): Don't cross-jump in between /f
        and non-/f instructions.  If both i1 and i2 are frame related,
        verify all CFA notes, their order and content.

        * g++.dg/opt/pr80102.C: New test.
Presumably this didn't ICE at some point in the past, so it's a regression?
(it's not marked as such in the BZ).

It doesn't ICE for me with r238210 and ICEs with current trunk, I don't have
too many ppc64le compilers around though.

+  /* If both i1 and i2 are frame related, verify all the CFA notes
+     in the same order and with the same content.  */
+  if (RTX_FRAME_RELATED_P (i1))
+    {
+      static enum reg_note cfa_note_kinds[] = {
+       REG_FRAME_RELATED_EXPR, REG_CFA_DEF_CFA, REG_CFA_ADJUST_CFA,
+       REG_CFA_OFFSET, REG_CFA_REGISTER, REG_CFA_EXPRESSION,
+       REG_CFA_VAL_EXPRESSION, REG_CFA_RESTORE, REG_CFA_SET_VDRAP,
+       REG_CFA_TOGGLE_RA_MANGLE, REG_CFA_WINDOW_SAVE, REG_CFA_FLUSH_QUEUE
+      };
ISTM this could get out of date very easily.  Is there a clean way to
generate the array of cfa notes as we build up the notes from reg-notes.def?

We could e.g.
#ifndef REG_CFA_NOTE
# define REG_CFA_NOTE(NAME) REG_NOTE(NAME)
#endif
and then
REG_CFA_NOTE (FRAME_RELATED_EXPR)
etc. in reg-notes.def (and document that REG_CFA_NOTE should be used for
notes related to CFA).
Then in cfgcleanups.c we could just
#undef REG_CFA_NOTE
#define DEF_REG_NOTE(NAME)
#define REG_CFA_NOTE(NAME) REG_##NAME,
#include "reg-notes.def"
#undef DEF_REG_NOTE
#undef REG_CFA_NOTE
to populate the cfa_note_kinds array.
Something like that seems preferable -- I think we're a lot more likely to catch the need to use REG_CFA_NOTE when defining the notes in reg-notes.def than we are to remember to update an array in a different file.

jeff

Reply via email to