public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/106096] New: [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu since r13-911
@ 2022-06-27  0:26 xry111 at mengyan1223 dot wang
  2022-06-27  8:27 ` [Bug target/106096] " xry111 at mengyan1223 dot wang
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: xry111 at mengyan1223 dot wang @ 2022-06-27  0:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106096

            Bug ID: 106096
           Summary: [13 regression] ICE building stage 2 libgcc on
                    loongarch64-linux-gnu since r13-911
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: xry111 at mengyan1223 dot wang
  Target Milestone: ---

Since r13-911, bootstrapping on loongarch64-linux-gnu is broken because of an
ICE building stage 2 libgcc.

This issue is particularly diffcult to diagnose, due to the reasons:

1. r13-910 and r13-909 does not build, so it's hard to tell which change
"really" triggers the issue.
2. r13-{909,910,911} consist a very large change.
3. GCC even fails to produce a stacktrace on the ICE.
4. It's not reproducible with a cross compiler on x86_64 host, even with ASan
and UBSan.

A backtrace gathered using GDB:

#0  0x0000000000002000 in ?? ()
#1  0x0000000120b2157c in path_range_query::range_defined_in_block (
    this=this@entry=0x121b3bb20, r=..., name=name@entry=0x7ffff55a17a0, 
    bb=bb@entry=0x7ffff5598750) at ../../gcc/gcc/gimple-range-path.cc:354
#2  0x0000000120b21880 in path_range_query::compute_ranges_in_phis (
    this=this@entry=0x121b3bb20, bb=bb@entry=0x7ffff5598750)
    at ../../gcc/gcc/gimple-range-path.cc:400
#3  0x0000000120b21b70 in path_range_query::compute_ranges_in_block (
    this=this@entry=0x121b3bb20, bb=bb@entry=0x7ffff5598750)
    at ../../gcc/gcc/gimple-range-path.cc:448
#4  0x0000000120b225b8 in path_range_query::compute_ranges (this=0x121b3bb20, 
    path=..., imports=<optimized out>)
    at ../../gcc/gcc/gimple-range-path.cc:665
#5  0x0000000120bb1ba0 in back_threader::find_taken_edge_cond (
    this=0x7fffffff6d18, path=..., cond=0x7ffff5775f40)
    at ../../gcc/gcc/tree-ssa-threadbackward.cc:319
#6  0x0000000120bb1d9c in back_threader::find_taken_edge (
    this=this@entry=0x7fffffff6d18, path=...)
    at ../../gcc/gcc/tree-ssa-threadbackward.cc:276
#7  0x0000000120bb2768 in back_threader::maybe_register_path (
    this=this@entry=0x7fffffff6d18)
    at ../../gcc/gcc/tree-ssa-threadbackward.cc:232
#8  0x0000000120bb2f34 in back_threader::find_paths_to_names (
    this=this@entry=0x7fffffff6d18, bb=<optimized out>, 
    interesting=interesting@entry=0x7fffffff6c90)
    at ../../gcc/gcc/tree-ssa-threadbackward.cc:419
#9  0x0000000120bb317c in back_threader::resolve_phi (
    interesting=<optimized out>, phi=<optimized out>, this=<optimized out>)
    at ../../gcc/gcc/tree-ssa-threadbackward.cc:396
#10 back_threader::resolve_phi (this=0x7fffffff6d18, phi=0x7ffff57a0d00, 
    interesting=0x7fffffff6c90) at ../../gcc/gcc/tree-ssa-threadbackward.cc:356
#11 0x0000000120bb2cf0 in back_threader::find_paths_to_names (
    this=this@entry=0x7fffffff6d18, bb=<optimized out>, 
    interesting=interesting@entry=0x7fffffff6c90)
    at ../../gcc/gcc/tree-ssa-threadbackward.cc:444
#12 0x0000000120bb2ddc in back_threader::find_paths_to_names (
    this=this@entry=0x7fffffff6d18, bb=<optimized out>, 
    bb@entry=0x7ffff55986e8, interesting=interesting@entry=0x7fffffff6c90)
    at ../../gcc/gcc/tree-ssa-threadbackward.cc:459
#13 0x0000000120bb3408 in back_threader::find_paths (this=0x7fffffff6d18, 
    bb=0x7ffff55986e8, name=0x7ffff55a1050) at ../../gcc/gcc/bitmap.h:955
#14 0x0000000120bb3620 in back_threader::thread_blocks (
    this=this@entry=0x7fffffff6d18)
    at ../../gcc/gcc/tree-ssa-threadbackward.cc:901
#15 0x0000000120bb3694 in (anonymous namespace)::pass_thread_jumps::execute (
    this=<optimized out>, fun=<optimized out>)
    at ../../gcc/gcc/tree-ssa-threadbackward.cc:1003
#16 0x000000012082a10c in execute_one_pass (pass=pass@entry=0x1219d0550)
    at ../../gcc/gcc/passes.cc:2638
#17 0x000000012082aa68 in execute_pass_list_1 (pass=0x1219d0550)
    at ../../gcc/gcc/passes.cc:2738
#18 0x000000012082aa78 in execute_pass_list_1 (pass=0x1219cded0)
    at ../../gcc/gcc/passes.cc:2739
#19 0x000000012082aad8 in execute_pass_list (fn=<optimized out>, 
    pass=<optimized out>) at ../../gcc/gcc/passes.cc:2749
#20 0x00000001203e1a1c in cgraph_node::expand (this=0x7ffff5609980)
    at ../../gcc/gcc/context.h:48
#21 cgraph_node::expand (this=0x7ffff5609980)
    at ../../gcc/gcc/cgraphunit.cc:1788
#22 0x00000001203e3540 in expand_all_functions ()
    at ../../gcc/gcc/cgraphunit.cc:1999
#23 symbol_table::compile (this=this@entry=0x7ffff548c000)
    at ../../gcc/gcc/cgraphunit.cc:2349
#24 0x00000001203e6be0 in symbol_table::compile (this=0x7ffff548c000)
    at ../../gcc/gcc/cgraphunit.cc:2262
#25 symbol_table::finalize_compilation_unit (this=0x7ffff548c000)
    at ../../gcc/gcc/cgraphunit.cc:2530
#26 0x000000012092d148 in compile_file () at ../../gcc/gcc/toplev.cc:479
#27 0x00000001201ca3d4 in do_compile (no_backend=false)
    at ../../gcc/gcc/toplev.cc:2144
#28 toplev::main (this=this@entry=0x7fffffff7148, argc=<optimized out>, 
    argc@entry=3, argv=<optimized out>, argv@entry=0x7fffffff72d8)
    at ../../gcc/gcc/toplev.cc:2296
#29 0x00000001201cba28 in main (argc=<optimized out>, argv=0x7fffffff72d8)
    at ../../gcc/gcc/main.cc:39

The #0 "0x2000" frame looks very strange, but currently I have no idea why it
appears.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/106096] [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu since r13-911
  2022-06-27  0:26 [Bug target/106096] New: [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu since r13-911 xry111 at mengyan1223 dot wang
@ 2022-06-27  8:27 ` xry111 at mengyan1223 dot wang
  2022-06-27  9:59 ` xry111 at mengyan1223 dot wang
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: xry111 at mengyan1223 dot wang @ 2022-06-27  8:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106096

--- Comment #1 from Xi Ruoyao <xry111 at mengyan1223 dot wang> ---
Stage 1 GCC generates some very strange code for stage 2 GCC, jumping to
"0x2000":

.L747:
    beqz    $r12,.L750
    lu12i.w $r13,8192>>12           # 0x2000
    ld.d    $r5,$r26,8
    add.d   $r3,$r3,$r13
    ld.d    $r1,$r3,168
    ld.d    $r22,$r3,160
    ld.d    $r23,$r3,152
    ld.d    $r24,$r3,144
    ld.d    $r26,$r3,128
    ld.d    $r27,$r3,120
    ld.d    $r28,$r3,112
    ld.d    $r29,$r3,104
    ld.d    $r30,$r3,96
    ld.d    $r31,$r3,88
    or  $r4,$r25,$r0
    ld.d    $r25,$r3,136
    addi.d  $r3,$r3,176
    jr  $r13

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/106096] [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu since r13-911
  2022-06-27  0:26 [Bug target/106096] New: [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu since r13-911 xry111 at mengyan1223 dot wang
  2022-06-27  8:27 ` [Bug target/106096] " xry111 at mengyan1223 dot wang
@ 2022-06-27  9:59 ` xry111 at mengyan1223 dot wang
  2022-06-27 10:02 ` [Bug target/106096] [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu because stage 2 gcc is miscompiled xry111 at mengyan1223 dot wang
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: xry111 at mengyan1223 dot wang @ 2022-06-27  9:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106096

--- Comment #2 from Xi Ruoyao <xry111 at mengyan1223 dot wang> ---
Created attachment 53208
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53208&action=edit
reduced testcase

It looks like a LoongArch code generation issue, not really related to the
changes in r13-911.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/106096] [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu because stage 2 gcc is miscompiled
  2022-06-27  0:26 [Bug target/106096] New: [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu since r13-911 xry111 at mengyan1223 dot wang
  2022-06-27  8:27 ` [Bug target/106096] " xry111 at mengyan1223 dot wang
  2022-06-27  9:59 ` xry111 at mengyan1223 dot wang
@ 2022-06-27 10:02 ` xry111 at mengyan1223 dot wang
  2022-06-27 10:03 ` xry111 at mengyan1223 dot wang
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: xry111 at mengyan1223 dot wang @ 2022-06-27 10:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106096

Xi Ruoyao <xry111 at mengyan1223 dot wang> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Build|loongarch64-linux-gnu       |
            Summary|[13 regression] ICE         |[13 regression] ICE
                   |building stage 2 libgcc on  |building stage 2 libgcc on
                   |loongarch64-linux-gnu since |loongarch64-linux-gnu
                   |r13-911                     |because stage 2 gcc is
                   |                            |miscompiled
               Host|loongarch64-linux-gnu       |

--- Comment #3 from Xi Ruoyao <xry111 at mengyan1223 dot wang> ---
(In reply to Xi Ruoyao from comment #2)
> Created attachment 53208 [details]
> reduced testcase

For this testcase GCC generates:

.L20:
        lu12i.w $r13,4096>>12                   # 0x1000
        add.d   $r3,$r3,$r13
        ld.d    $r1,$r3,24
        or      $r4,$r23,$r0
        ld.d    $r23,$r3,16
        la.local        $r5,b
        addi.d  $r3,$r3,32
        jr      $r13

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/106096] [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu because stage 2 gcc is miscompiled
  2022-06-27  0:26 [Bug target/106096] New: [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu since r13-911 xry111 at mengyan1223 dot wang
                   ` (2 preceding siblings ...)
  2022-06-27 10:02 ` [Bug target/106096] [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu because stage 2 gcc is miscompiled xry111 at mengyan1223 dot wang
@ 2022-06-27 10:03 ` xry111 at mengyan1223 dot wang
  2022-06-27 10:47 ` rguenth at gcc dot gnu.org
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: xry111 at mengyan1223 dot wang @ 2022-06-27 10:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106096

Xi Ruoyao <xry111 at mengyan1223 dot wang> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|12.1.0                      |

--- Comment #4 from Xi Ruoyao <xry111 at mengyan1223 dot wang> ---
Remove "known to work" because 12.1.0 miscompiles the test case too.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/106096] [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu because stage 2 gcc is miscompiled
  2022-06-27  0:26 [Bug target/106096] New: [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu since r13-911 xry111 at mengyan1223 dot wang
                   ` (3 preceding siblings ...)
  2022-06-27 10:03 ` xry111 at mengyan1223 dot wang
@ 2022-06-27 10:47 ` rguenth at gcc dot gnu.org
  2022-06-28  8:30 ` chenglulu at loongson dot cn
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-06-27 10:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106096

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.0

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/106096] [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu because stage 2 gcc is miscompiled
  2022-06-27  0:26 [Bug target/106096] New: [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu since r13-911 xry111 at mengyan1223 dot wang
                   ` (4 preceding siblings ...)
  2022-06-27 10:47 ` rguenth at gcc dot gnu.org
@ 2022-06-28  8:30 ` chenglulu at loongson dot cn
  2022-06-28  8:42 ` xry111 at mengyan1223 dot wang
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: chenglulu at loongson dot cn @ 2022-06-28  8:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106096

--- Comment #5 from chenglulu <chenglulu at loongson dot cn> ---
Created attachment 53213
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53213&action=edit
Modify the allocation order of caller saved registers.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/106096] [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu because stage 2 gcc is miscompiled
  2022-06-27  0:26 [Bug target/106096] New: [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu since r13-911 xry111 at mengyan1223 dot wang
                   ` (5 preceding siblings ...)
  2022-06-28  8:30 ` chenglulu at loongson dot cn
@ 2022-06-28  8:42 ` xry111 at mengyan1223 dot wang
  2022-06-28  8:47 ` xry111 at mengyan1223 dot wang
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: xry111 at mengyan1223 dot wang @ 2022-06-28  8:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106096

--- Comment #6 from Xi Ruoyao <xry111 at mengyan1223 dot wang> ---
(In reply to chenglulu from comment #5)
> Created attachment 53213 [details]
> Modify the allocation order of caller saved registers.

I think we need to completely prevent LARCH_PROLOGUE_TEMP from being used for
sibcall:

diff --git a/gcc/config/loongarch/loongarch.h
b/gcc/config/loongarch/loongarch.h
index 4d107a42209..f9de9a6e4fb 100644
--- a/gcc/config/loongarch/loongarch.h
+++ b/gcc/config/loongarch/loongarch.h
@@ -511,7 +511,7 @@ enum reg_class
 #define REG_CLASS_CONTENTS                                             \
 {                                                                      \
   { 0x00000000, 0x00000000, 0x00000000 },      /* NO_REGS  */          \
-  { 0x001ff000, 0x00000000, 0x00000000 },      /* SIBCALL_REGS  */     \
+  { 0x001fd000, 0x00000000, 0x00000000 },      /* SIBCALL_REGS  */     \
   { 0xff9ffff0, 0x00000000, 0x00000000 },      /* JIRL_REGS  */        \
   { 0xfffffffc, 0x00000000, 0x00000000 },      /* CSR_REGS  */         \
   { 0xffffffff, 0x00000000, 0x00000000 },      /* GR_REGS  */          \

Or even if LARCH_PROLOGUE_TEMP is less preferred, the register allocator may
still use it for sibcall and blow something up again.

(Above is for $r13, if you want to use $r12 instead as LARCH_PROLOGUE_TEMP you
need to adjust it.)

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/106096] [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu because stage 2 gcc is miscompiled
  2022-06-27  0:26 [Bug target/106096] New: [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu since r13-911 xry111 at mengyan1223 dot wang
                   ` (6 preceding siblings ...)
  2022-06-28  8:42 ` xry111 at mengyan1223 dot wang
@ 2022-06-28  8:47 ` xry111 at mengyan1223 dot wang
  2022-06-28  9:42 ` chenglulu at loongson dot cn
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: xry111 at mengyan1223 dot wang @ 2022-06-28  8:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106096

--- Comment #7 from Xi Ruoyao <xry111 at mengyan1223 dot wang> ---
(In reply to Xi Ruoyao from comment #6)
> (In reply to chenglulu from comment #5)
> > Created attachment 53213 [details]
> > Modify the allocation order of caller saved registers.
> 
> I think we need to completely prevent LARCH_PROLOGUE_TEMP from being used
> for sibcall

For example, the RISC-V change explicitly exclude x5 (their temp for epilogue):

https://gcc.gnu.org/legacy-ml/gcc-patches/2019-10/msg01228.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/106096] [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu because stage 2 gcc is miscompiled
  2022-06-27  0:26 [Bug target/106096] New: [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu since r13-911 xry111 at mengyan1223 dot wang
                   ` (7 preceding siblings ...)
  2022-06-28  8:47 ` xry111 at mengyan1223 dot wang
@ 2022-06-28  9:42 ` chenglulu at loongson dot cn
  2022-06-28  9:59 ` xry111 at mengyan1223 dot wang
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: chenglulu at loongson dot cn @ 2022-06-28  9:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106096

--- Comment #8 from chenglulu <chenglulu at loongson dot cn> ---
(In reply to Xi Ruoyao from comment #6)
> (In reply to chenglulu from comment #5)
> > Created attachment 53213 [details]
> > Modify the allocation order of caller saved registers.
> 
> I think we need to completely prevent LARCH_PROLOGUE_TEMP from being used
> for sibcall:
> 
> diff --git a/gcc/config/loongarch/loongarch.h
> b/gcc/config/loongarch/loongarch.h
> index 4d107a42209..f9de9a6e4fb 100644
> --- a/gcc/config/loongarch/loongarch.h
> +++ b/gcc/config/loongarch/loongarch.h
> @@ -511,7 +511,7 @@ enum reg_class
>  #define REG_CLASS_CONTENTS                                             \
>  {                                                                      \
>    { 0x00000000, 0x00000000, 0x00000000 },      /* NO_REGS  */          \
> -  { 0x001ff000, 0x00000000, 0x00000000 },      /* SIBCALL_REGS  */     \
> +  { 0x001fd000, 0x00000000, 0x00000000 },      /* SIBCALL_REGS  */     \
>    { 0xff9ffff0, 0x00000000, 0x00000000 },      /* JIRL_REGS  */        \
>    { 0xfffffffc, 0x00000000, 0x00000000 },      /* CSR_REGS  */         \
>    { 0xffffffff, 0x00000000, 0x00000000 },      /* GR_REGS  */          \
> 
> Or even if LARCH_PROLOGUE_TEMP is less preferred, the register allocator may
> still use it for sibcall and blow something up again.
> 
This solved my doubt. ^v^

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/106096] [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu because stage 2 gcc is miscompiled
  2022-06-27  0:26 [Bug target/106096] New: [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu since r13-911 xry111 at mengyan1223 dot wang
                   ` (8 preceding siblings ...)
  2022-06-28  9:42 ` chenglulu at loongson dot cn
@ 2022-06-28  9:59 ` xry111 at mengyan1223 dot wang
  2022-06-28 10:18 ` chenglulu at loongson dot cn
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: xry111 at mengyan1223 dot wang @ 2022-06-28  9:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106096

--- Comment #9 from Xi Ruoyao <xry111 at mengyan1223 dot wang> ---
Created attachment 53214
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53214&action=edit
patch removing r13 from SIBCALL_REGS

I'm testing this patch now.

I suggest to apply this for trunk and gcc-12 branch first (as gcc-12 also
miscompiles the test case).

Then if the reordering of RA preference can improve performance, you may apply
it later (and also adjust the changes in this patch again).

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/106096] [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu because stage 2 gcc is miscompiled
  2022-06-27  0:26 [Bug target/106096] New: [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu since r13-911 xry111 at mengyan1223 dot wang
                   ` (9 preceding siblings ...)
  2022-06-28  9:59 ` xry111 at mengyan1223 dot wang
@ 2022-06-28 10:18 ` chenglulu at loongson dot cn
  2022-06-28 11:03 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: chenglulu at loongson dot cn @ 2022-06-28 10:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106096

--- Comment #10 from chenglulu <chenglulu at loongson dot cn> ---
(In reply to Xi Ruoyao from comment #9)
> Created attachment 53214 [details]
> patch removing r13 from SIBCALL_REGS
> 
> I'm testing this patch now.
> 
> I suggest to apply this for trunk and gcc-12 branch first (as gcc-12 also
> miscompiles the test case).
> 
> Then if the reordering of RA preference can improve performance, you may
> apply it later (and also adjust the changes in this patch again).

OK!

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/106096] [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu because stage 2 gcc is miscompiled
  2022-06-27  0:26 [Bug target/106096] New: [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu since r13-911 xry111 at mengyan1223 dot wang
                   ` (10 preceding siblings ...)
  2022-06-28 10:18 ` chenglulu at loongson dot cn
@ 2022-06-28 11:03 ` cvs-commit at gcc dot gnu.org
  2022-06-28 11:05 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-06-28 11:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106096

--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Xi Ruoyao <xry111@gcc.gnu.org>:

https://gcc.gnu.org/g:020b7d98589bbc928b5a66b1ed56b42af8791355

commit r13-1319-g020b7d98589bbc928b5a66b1ed56b42af8791355
Author: Xi Ruoyao <xry111@xry111.site>
Date:   Tue Jun 28 16:00:14 2022 +0800

    loongarch: exclude LARCH_PROLOGUE_TEMP from SIBCALL_REGS [PR 106096]

    The epilogue may clobber LARCH_PROLOGUE_TEMP ($r13/$t1), so it cannot be
    used for sibcalls.

    gcc/ChangeLog:

            PR target/106096
            * config/loongarch/loongarch.h (REG_CLASS_CONTENTS): Exclude
            $r13 from SIBCALL_REGS.
            * config/loongarch/loongarch.cc (loongarch_regno_to_class):
            Change $r13 to JIRL_REGS.

    gcc/testsuite/ChangeLog:

            PR target/106096
            * g++.target/loongarch/loongarch.exp: New test support file.
            * g++.target/loongarch/pr106096.C: New test.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/106096] [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu because stage 2 gcc is miscompiled
  2022-06-27  0:26 [Bug target/106096] New: [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu since r13-911 xry111 at mengyan1223 dot wang
                   ` (11 preceding siblings ...)
  2022-06-28 11:03 ` cvs-commit at gcc dot gnu.org
@ 2022-06-28 11:05 ` cvs-commit at gcc dot gnu.org
  2022-06-28 11:09 ` xry111 at mengyan1223 dot wang
  2022-07-04  6:45 ` xry111 at gcc dot gnu.org
  14 siblings, 0 replies; 16+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-06-28 11:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106096

--- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Xi Ruoyao <xry111@gcc.gnu.org>:

https://gcc.gnu.org/g:8e230a3c02641792d87252bff7f7554e46da2c25

commit r12-8520-g8e230a3c02641792d87252bff7f7554e46da2c25
Author: Xi Ruoyao <xry111@xry111.site>
Date:   Tue Jun 28 16:00:14 2022 +0800

    loongarch: exclude LARCH_PROLOGUE_TEMP from SIBCALL_REGS [PR 106096]

    The epilogue may clobber LARCH_PROLOGUE_TEMP ($r13/$t1), so it cannot be
    used for sibcalls.

    gcc/ChangeLog:

            PR target/106096
            * config/loongarch/loongarch.h (REG_CLASS_CONTENTS): Exclude
            $r13 from SIBCALL_REGS.
            * config/loongarch/loongarch.cc (loongarch_regno_to_class):
            Change $r13 to JIRL_REGS.

    gcc/testsuite/ChangeLog:

            PR target/106096
            * g++.target/loongarch/loongarch.exp: New test support file.
            * g++.target/loongarch/pr106096.C: New test.

    (cherry picked from commit 020b7d98589bbc928b5a66b1ed56b42af8791355)

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/106096] [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu because stage 2 gcc is miscompiled
  2022-06-27  0:26 [Bug target/106096] New: [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu since r13-911 xry111 at mengyan1223 dot wang
                   ` (12 preceding siblings ...)
  2022-06-28 11:05 ` cvs-commit at gcc dot gnu.org
@ 2022-06-28 11:09 ` xry111 at mengyan1223 dot wang
  2022-07-04  6:45 ` xry111 at gcc dot gnu.org
  14 siblings, 0 replies; 16+ messages in thread
From: xry111 at mengyan1223 dot wang @ 2022-06-28 11:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106096

Xi Ruoyao <xry111 at mengyan1223 dot wang> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #13 from Xi Ruoyao <xry111 at mengyan1223 dot wang> ---
Fixed for trunk and gcc-12.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/106096] [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu because stage 2 gcc is miscompiled
  2022-06-27  0:26 [Bug target/106096] New: [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu since r13-911 xry111 at mengyan1223 dot wang
                   ` (13 preceding siblings ...)
  2022-06-28 11:09 ` xry111 at mengyan1223 dot wang
@ 2022-07-04  6:45 ` xry111 at gcc dot gnu.org
  14 siblings, 0 replies; 16+ messages in thread
From: xry111 at gcc dot gnu.org @ 2022-07-04  6:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106096

Xi Ruoyao <xry111 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|13.0                        |12.2

--- Comment #14 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
Though the bootstrap failure is a 13 regression, the code generation issue has
been already haunting 12.1.  It also breaks building GCC 13 on a system with
GCC 12.1 and --disable-bootstrap.

Change target milestone to 12.2 so it will show up on list of PRs fixed in
12.2.

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2022-07-04  6:45 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-27  0:26 [Bug target/106096] New: [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu since r13-911 xry111 at mengyan1223 dot wang
2022-06-27  8:27 ` [Bug target/106096] " xry111 at mengyan1223 dot wang
2022-06-27  9:59 ` xry111 at mengyan1223 dot wang
2022-06-27 10:02 ` [Bug target/106096] [13 regression] ICE building stage 2 libgcc on loongarch64-linux-gnu because stage 2 gcc is miscompiled xry111 at mengyan1223 dot wang
2022-06-27 10:03 ` xry111 at mengyan1223 dot wang
2022-06-27 10:47 ` rguenth at gcc dot gnu.org
2022-06-28  8:30 ` chenglulu at loongson dot cn
2022-06-28  8:42 ` xry111 at mengyan1223 dot wang
2022-06-28  8:47 ` xry111 at mengyan1223 dot wang
2022-06-28  9:42 ` chenglulu at loongson dot cn
2022-06-28  9:59 ` xry111 at mengyan1223 dot wang
2022-06-28 10:18 ` chenglulu at loongson dot cn
2022-06-28 11:03 ` cvs-commit at gcc dot gnu.org
2022-06-28 11:05 ` cvs-commit at gcc dot gnu.org
2022-06-28 11:09 ` xry111 at mengyan1223 dot wang
2022-07-04  6:45 ` xry111 at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).