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]))
GCC 10.4 is being released, retargeting bugs to GCC 10.5.
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]))
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.
GCC 10 branch is being closed.