This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, committed] Fix PR 57422


Hello,

As described in the PR, the ICE reason was the typo made when introducing calls to add_hard_reg_set. Fixed by the first attached patch, bootstrapped and tested on both ia64 and x86_64, committed as obvious.

The test case is very sensitive to the scheduler decisions (e.g. it didn't fail on trunk but only on the revision reported for me), so instead of adding the test I have put in the code two asserts checking that we can always schedule the fence instruction as is. This hunk was tested together with the first but committed separately.

The first patch can be safely committed to 4.8, the second can stay on trunk only. Jakub, will it be fine with you?

Andrey
Index: gcc/ChangeLog
===================================================================
*** gcc/ChangeLog	(revision 206172)
--- gcc/ChangeLog	(revision 206173)
***************
*** 1,3 ****
--- 1,9 ----
+ 2013-12-23  Andrey Belevantsev  <abel@ispras.ru>
+ 
+ 	PR rtl-optimization/57422
+ 	* sel-sched.c (mark_unavailable_hard_regs): Fix typo when calling
+ 	add_to_hard_reg_set.
+ 
  2013-12-20  Sharad Singhai  <singhai@google.com>
  
  	* Makefile.in: Add optinfo.texi.
Index: gcc/sel-sched.c
===================================================================
*** gcc/sel-sched.c	(revision 206172)
--- gcc/sel-sched.c	(revision 206173)
*************** mark_unavailable_hard_regs (def_t def, s
*** 1253,1259 ****
  
        if (!HARD_FRAME_POINTER_IS_FRAME_POINTER)
          add_to_hard_reg_set (&reg_rename_p->unavailable_hard_regs, 
! 			     Pmode, HARD_FRAME_POINTER_IS_FRAME_POINTER);
      }
  
  #ifdef STACK_REGS
--- 1253,1259 ----
  
        if (!HARD_FRAME_POINTER_IS_FRAME_POINTER)
          add_to_hard_reg_set (&reg_rename_p->unavailable_hard_regs, 
! 			     Pmode, HARD_FRAME_POINTER_REGNUM);
      }
  
  #ifdef STACK_REGS
Index: gcc/ChangeLog
===================================================================
*** gcc/ChangeLog	(revision 206173)
--- gcc/ChangeLog	(revision 206174)
***************
*** 1,6 ****
--- 1,12 ----
  2013-12-23  Andrey Belevantsev  <abel@ispras.ru>
  
  	PR rtl-optimization/57422
+ 	* sel-sched.c (fill_vec_av_set): Assert that the fence insn
+ 	can always be scheduled in its current form.
+ 
+ 2013-12-23  Andrey Belevantsev  <abel@ispras.ru>
+ 
+ 	PR rtl-optimization/57422
  	* sel-sched.c (mark_unavailable_hard_regs): Fix typo when calling
  	add_to_hard_reg_set.
  
Index: gcc/sel-sched.c
===================================================================
*** gcc/sel-sched.c	(revision 206173)
--- gcc/sel-sched.c	(revision 206174)
*************** fill_vec_av_set (av_set_t av, blist_t bn
*** 3801,3806 ****
--- 3801,3807 ----
        signed char target_available;
        bool is_orig_reg_p = true;
        int need_cycles, new_prio;
+       bool fence_insn_p = INSN_UID (insn) == INSN_UID (FENCE_INSN (fence));
  
        /* Don't allow any insns other than from SCHED_GROUP if we have one.  */
        if (FENCE_SCHED_NEXT (fence) && insn != FENCE_SCHED_NEXT (fence))
*************** fill_vec_av_set (av_set_t av, blist_t bn
*** 3855,3863 ****
            if (sched_verbose >= 4)
              sel_print ("Expr %d has no suitable target register\n",
                         INSN_UID (insn));
!           continue;
          }
  
        /* Filter expressions that need to be renamed or speculated when
  	 pipelining, because compensating register copies or speculation
  	 checks are likely to be placed near the beginning of the loop,
--- 3856,3871 ----
            if (sched_verbose >= 4)
              sel_print ("Expr %d has no suitable target register\n",
                         INSN_UID (insn));
! 
! 	  /* A fence insn should not get here.  */
! 	  gcc_assert (!fence_insn_p);
! 	  continue;
          }
  
+       /* At this point a fence insn should always be available.  */
+       gcc_assert (!fence_insn_p
+ 		  || INSN_UID (FENCE_INSN (fence)) == INSN_UID (EXPR_INSN_RTX (expr)));
+ 
        /* Filter expressions that need to be renamed or speculated when
  	 pipelining, because compensating register copies or speculation
  	 checks are likely to be placed near the beginning of the loop,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]