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]

Fix bootstrap with -mno-accumulate-outgoing-args


Hi,
this patch fixes ICE seen with -mno-accumulate-outgoing-args bootstrap building go runtime.
The ICE is in dwarf2cfi.c while checking that on all paths into given basic block stack
frames are same.  It goes away either with disabling crossjumping or sched2 but the problem
IMO really originates in combine-stack-adj.
Crossjumping combines two call seqences and breaks basic blocks in half of argument setups.

OK, sched2 reorders:

(insn 762 761 765 50 (set (mem/c:SI (plus:SI (reg/f:SI 7 sp)
                (const_int 112 [0x70])) [17 MEM[(struct  *)&bs + 8B]+0 S4 A64])
        (const_int 8 [0x8])) ../../../../libgo/go/encoding/binary/binary.go:273 90 {*movsi_internal}
     (nil))

(insn 765 762 766 50 (set (mem:HI (reg/f:SI 7 sp) [49  S2 A16])
        (reg/v:HI 1 dx [orig:232 v ] [232])) ../../../../libgo/go/encoding/binary/binary.go:273 91 {*movhi_internal}
     (expr_list:REG_DEAD (reg/v:HI 1 dx [orig:232 v ] [232])
        (expr_list:REG_ARGS_SIZE (const_int 16 [0x10])
            (nil))))
(insn 766 765 2326 50 (parallel [
            (set (reg/f:SI 7 sp)
                (plus:SI (reg/f:SI 7 sp)
                    (const_int -12 [0xfffffffffffffff4])))
            (clobber (reg:CC 17 flags))
        ]) ../../../../libgo/go/encoding/binary/binary.go:273 265 {*addsi_1}
     (expr_list:REG_UNUSED (reg:CC 17 flags)
        (expr_list:REG_ARGS_SIZE (const_int 28 [0x1c])
            (nil))))

to
(insn 766 761 762 54 (parallel [
            (set (reg/f:SI 7 sp)
                (plus:SI (reg/f:SI 7 sp)
                    (const_int -12 [0xfffffffffffffff4])))
            (clobber (reg:CC 17 flags))
        ]) ../../../../libgo/go/encoding/binary/binary.go:273 265 {*addsi_1}
     (expr_list:REG_UNUSED (reg:CC 17 flags) 
        (expr_list:REG_ARGS_SIZE (const_int 28 [0x1c])
            (nil))))
(insn:TI 762 766 765 54 (set (mem/c:SI (plus:SI (reg/f:SI 7 sp)
                (const_int 124 [0x7c])) [17 MEM[(struct  *)&bs + 8B]+0 S4 A64])
        (const_int 8 [0x8])) ../../../../libgo/go/encoding/binary/binary.go:273 90 {*movsi_internal}
     (nil))     
(insn 765 762 770 54 (set (mem:HI (plus:SI (reg/f:SI 7 sp)
                (const_int 12 [0xc])) [49  S2 A16])
        (reg/v:HI 1 dx [orig:232 v ] [232])) ../../../../libgo/go/encoding/binary/binary.go:273 91 {*movhi_internal}
     (expr_list:REG_DEAD (reg/v:HI 1 dx [orig:232 v ] [232])
        (expr_list:REG_ARGS_SIZE (const_int 16 [0x10])
            (nil))))

Here insn 765 gets adjusted for insn766 wihtout updating REG_ARGS_SIZE.  
This is IMO not bug in scheduler but bug in fact that insn 775 should not have the note on it
when it is not adjusting stack pointer. This is because originally it was push instruction,
but combine-stack-adjustments turned it into move.
I think it should remove the ARG_SIZE note when doing so, since argument block size should
be corrently annotated by preceeding stack adjustment insn.

Bootstrapped/regtested x86_64-linux. Did not double check it is solves the ARM issue
reported in PR, too.
OK?

	* combine-stack-adj.c (combine_stack_adjustments_for_block): Remove
	ARG_SIZE note when adjustment was eliminated.
Index: combine-stack-adj.c
===================================================================
--- combine-stack-adj.c	(revision 206233)
+++ combine-stack-adj.c	(working copy)
@@ -567,6 +567,7 @@ combine_stack_adjustments_for_block (bas
 	      && try_apply_stack_adjustment (insn, reflist, 0,
 					     -last_sp_adjust))
 	    {
+	      rtx note;
 	      if (last2_sp_set)
 		maybe_move_args_size_note (last2_sp_set, last_sp_set, false);
 	      else
@@ -576,6 +577,11 @@ combine_stack_adjustments_for_block (bas
 	      reflist = NULL;
 	      last_sp_set = NULL_RTX;
 	      last_sp_adjust = 0;
+	      /* We no longer adjust stack size.  Whoever adjusted it earlier
+		 hopefully got the note right.  */
+	      note = find_reg_note (insn, REG_ARGS_SIZE, NULL_RTX);
+	      if (note)
+		remove_note (insn, note);
 	      continue;
 	    }
 	}


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