[go: nahoru, domu]

Bug 105653 - [11/12/13/14/15 Regression] '-fcompare-debug' failure w/ -O2
Summary: [11/12/13/14/15 Regression] '-fcompare-debug' failure w/ -O2
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 13.0
: P2 normal
Target Milestone: 11.5
Assignee: Not yet assigned to anyone
URL:
Keywords: compare-debug-failure, needs-bisection
Depends on:
Blocks:
 
Reported: 2022-05-19 06:18 UTC by Arseny Solokha
Modified: 2024-04-26 10:46 UTC (History)
0 users

See Also:
Host:
Target: aarch64-linux-gnu
Build:
Known to work: 8.2.0, 8.5.0
Known to fail: 9.3.0
Last reconfirmed: 2022-10-27 00:00:00


Attachments
Testcase (418 bytes, text/plain)
2022-05-19 06:18 UTC, Arseny Solokha
Details
A shorter testcase (248 bytes, text/plain)
2022-08-03 03:03 UTC, Arseny Solokha
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Arseny Solokha 2022-05-19 06:18:20 UTC
Created attachment 52992 [details]
Testcase

g++ 13.0.0 20220515 snapshot (g:18547874ee205d830acb31f1e3c1c89fc7725c14) fails -fcompare-debug check when compiling the attached testcase w/ -O2:

% aarch64-linux-gnu-g++-13.0.0 -O2 -fcompare-debug -c q9dyty2d.cpp
aarch64-linux-gnu-g++-13.0.0: error: q9dyty2d.cpp: '-fcompare-debug' failure (length)

gkd diff:

--- q9dyty2d.cpp.gkd    2022-05-19 13:16:40.109118502 +0700
+++ q9dyty2d.gk.cpp.gkd 2022-05-19 13:16:40.167118178 +0700
@@ -729,9 +729,7 @@
 (insn:TI # 0 0 (set (reg/f:DI 3 x3 [orig:113 MEM[(struct btVector3 * *)_31 + 8B] ] [113])
         (mem/f:DI (plus:DI (reg:DI 2 x2 [orig:101 D.xxxx ] [101])
                 (const_int 8 [0x8])) [ MEM[(struct btVector3 * *)_31 + 8B]+0 S8 A64])) "q9dyty2d.cpp":39:17# {*movdi_aarch64}
-     (expr_list:REG_EQUIV (mem/f:DI (plus:DI (reg:DI 2 x2 [orig:101 D.xxxx ] [101])
-                (const_int 8 [0x8])) [ MEM[(struct btVector3 * *)_31 + 8B]+0 S8 A64])
-        (nil)))
+     (nil))
 (jump_insn:TI # 0 0 (set (pc)
         (if_then_else (ne (reg/f:DI 3 x3 [orig:113 MEM[(struct btVector3 * *)_31 + 8B] ] [113])
                 (const_int 0 [0]))
@@ -899,9 +897,7 @@
 (insn:TI # 0 0 (set (reg/f:DI 3 x3 [orig:112 MEM[(struct btVector3 * *)_30 + 8B] ] [112])
         (mem/f:DI (plus:DI (reg:DI 2 x2 [orig:101 D.xxxx ] [101])
                 (const_int 8 [0x8])) [ MEM[(struct btVector3 * *)_30 + 8B]+0 S8 A64])) "q9dyty2d.cpp":39:17# {*movdi_aarch64}
-     (expr_list:REG_EQUIV (mem/f:DI (plus:DI (reg:DI 2 x2 [orig:101 D.xxxx ] [101])
-                (const_int 8 [0x8])) [ MEM[(struct btVector3 * *)_30 + 8B]+0 S8 A64])
-        (nil)))
+     (nil))
 (jump_insn:TI # 0 0 (set (pc)
         (if_then_else (ne (reg/f:DI 3 x3 [orig:112 MEM[(struct btVector3 * *)_30 + 8B] ] [112])
                 (const_int 0 [0]))
Comment 1 Jakub Jelinek 2022-06-28 10:49:24 UTC
GCC 10.4 is being released, retargeting bugs to GCC 10.5.
Comment 2 Arseny Solokha 2022-08-03 03:03:21 UTC
Created attachment 53403 [details]
A shorter testcase

% aarch64-linux-gnu-g++-13.0.0 -O2 -fcompare-debug -fno-gcse -c wo91465u.cpp
aarch64-linux-gnu-g++-13.0.0: error: wo91465u.cpp: '-fcompare-debug' failure (length)

--- wo91465u.cpp.gkd    2022-08-03 10:02:59.526593546 +0700
+++ wo91465u.gk.cpp.gkd 2022-08-03 10:02:59.554593642 +0700
@@ -47,10 +47,7 @@
         (zero_extend:DI (mem:SI (plus:DI (mult:DI (reg:DI 1 x1 [orig:96 D.xxxx ] [96])
                         (const_int 4 [0x4]))
                     (reg/f:DI 4 x4 [orig:93 _7 ] [93])) [ MEM[(int *)_7 + ivtmp.6_16 * 4]+0 S4 A32]))) "wo91465u.cpp":10:7# {*zero_extendsidi2_aarch64}
-     (expr_list:REG_EQUIV (mem:SI (plus:DI (mult:DI (reg:DI 1 x1 [orig:96 D.xxxx ] [96])
-                    (const_int 4 [0x4]))
-                (reg/f:DI 4 x4 [orig:93 _7 ] [93])) [ MEM[(int *)_7 + ivtmp.6_16 * 4]+0 S4 A32])
-        (nil)))
+     (nil))
 (jump_insn:TI # 0 0 (set (pc)
         (if_then_else (eq (reg:SI 2 x2 [orig:104 MEM[(int *)_7 + ivtmp.6_16 * 4] ] [104])
                 (const_int 0 [0]))
Comment 3 Andrew Pinski 2022-10-27 00:42:02 UTC
IRA adds the REG_EQUIV note even for both with/without -g.

But it was removed in peephole2 for -g case.
In the -g case we get the following extra output in -g for peephole2 starting with:

df_worklist_dataflow_doublequeue: n_basic_blocks 8 n_edges 10 count 9 (  1.1)
....
DCE: Deleting insn 15
deleting insn with uid = 15.
...

insn 15 was:
(insn:TI 15 13 16 2 (set (reg/f:DI 1 x1 [101])
        (plus:DI (reg/f:DI 0 x0 [orig:99 thisD.4083 ] [99])
            (const_int 8 [0x8]))) "/app/example.cpp":9:25 discrim 1 141 {*adddi3_aarch64}
     (expr_list:REG_UNUSED (reg/f:DI 1 x1 [101])
        (nil)))

in sched_fusion.

But in the -g0 case, it was not removed inside peephole2.

Someone who understands DF DCE better should look into this on why it was not removed inside peephole2 without -g.

The instruction without -g:
(insn:TI 8 3 9 2 (set (reg/f:DI 1 x1 [101])
        (plus:DI (reg/f:DI 0 x0 [orig:99 this ] [99])
            (const_int 8 [0x8]))) "/app/example.cpp":9:25 discrim 1 141 {*adddi3_aarch64}
     (expr_list:REG_UNUSED (reg/f:DI 1 x1 [101])
        (nil)))

Which looks exactly the same even.
Comment 4 Richard Biener 2023-07-07 10:43:25 UTC
GCC 10 branch is being closed.