[PATCH] Fix PR optimization/5892

Jakub Jelinek jakub@redhat.com
Tue Mar 12 11:35:00 GMT 2002


Hi!

The following testcase causes ICE on IA-64 in gen_type_nops.
The problem is that rotate_one_bundle was called on
.mlx .m??
sched_data and almost immediately after this in ia64_variable_issue
because of asm_operands rotate_two_bundles was called.
As rotate_one_bundle did not update sched_data.packet and no function in
between the 2 rotations did, this resulted into wrong bundle
selector being used for the second insn tripple:
(insn 96 95 107 (unspec[
            (const_int 9 [0x9])
        ]  22) 242 {bundle_selector} (nil)
    (nil))
(insn:TI 26 107 108 (set (reg/v:SI 15 r15 [347])
        (mem/s:SI (reg/f:DI 14 r14 [349]) [6 <variable>.c+0 S4 A64])) 4 {*movsi_internal} (insn_list 24 (nil))
    (expr_list:REG_DEAD (reg/f:DI 14 r14 [349])
        (nil)))
(insn 88 108 115 (set (reg:DI 14 r14 [359])
        (const_int 16777216 [0x1000000])) 6 {*movdi_internal} (insn_list:REG_DEP_ANTI 26 (insn_list:REG_DEP_OUTPUT 24 (nil)))
    (expr_list:REG_EQUIV (const_int 16777216 [0x1000000])
        (nil)))
(insn 115 88 98 (const_int 5 [0x5]) -1 (nil)
    (nil))
(insn 98 115 15 (unspec[
            (const_int 9 [0x9])
        ]  22) 242 {bundle_selector} (nil)
    (nil))
(insn 15 98 97 (set (reg/v/f:DI 16 r16 [342])
        (mem/s:DI (reg/f:DI 112 r32 [344]) [5 <variable>.b+0 S8 A64])) 6 {*movdi_internal} (insn_list 13 (nil))
    (expr_list:REG_DEAD (reg/f:DI 112 r32 [344])
        (nil)))
(insn 97 15 110 (unspec_volatile[
            (const_int 1 [0x1])
        ]  2) -1 (nil)
    (nil))
(insn 31 109 99 (set (reg/v:DI 15 r15 [351])
        (asm_operands:DI ("") ("=r") 0[
                (reg/v:SI 15 r15 [347])
            ]
            [
                (asm_input:SI ("0"))
            ]  ("z.c") 8)) -1 (insn_list 26 (nil))
    (nil))
The second bundle should have been what was sched_data.packet->t2
before rotate_one_bundle but ended up sched_data.packet->t1.
There is no TYPE_L nop, so we ICEd.
The following patch updates sched_data.packet in rotate_one_bundle, so that
its t1 reflects current bundle.
Bootstrap/regression testing pending on ia64, ok to commit if it succeeds?

2002-03-12  Jakub Jelinek  <jakub@redhat.com>

	PR optimization/5892
	* config/ia64/ia64.c (rotate_one_bundle): Update current packet.

	* gcc.c-torture/compile/20020312-1.c: New test.

--- gcc/config/ia64/ia64.c.jj	Thu Mar  7 12:10:25 2002
+++ gcc/config/ia64/ia64.c	Tue Mar 12 20:03:05 2002
@@ -5632,6 +5632,8 @@ rotate_one_bundle (dump)
       memmove (sched_data.insns,
 	       sched_data.insns + 3,
 	       sched_data.cur * sizeof *sched_data.insns);
+      sched_data.packet
+	= &packets[(sched_data.packet->t2 - bundle) * NR_BUNDLES];
     }
   else
     {
--- gcc/testsuite/gcc.c-torture/compile/20020312-1.c.jj	Tue Mar 12 20:19:50 2002
+++ gcc/testsuite/gcc.c-torture/compile/20020312-1.c	Tue Mar 12 20:18:29 2002
@@ -0,0 +1,19 @@
+/* PR optimization/5892 */
+typedef struct { unsigned long a; unsigned int b, c; } A;
+typedef struct { unsigned long a; A *b; int c; } B;
+
+static inline unsigned int
+bar (unsigned int x)
+{
+  unsigned long r;
+  asm ("" : "=r" (r) : "0" (x));
+  return r >> 31;
+}
+
+int foo (B *x)
+{
+  A *y;
+  y = x->b;
+  y->b = bar (x->c);
+  y->c = ({ unsigned int z = 1; (z << 24) | (z >> 24); });
+}

	Jakub



More information about the Gcc-patches mailing list