------- Comment #28 from jakub at gcc dot gnu dot org 2007-12-11 10:02 ------- This smells dataflow related. At least if I understood right, the problem is that the _ZSt10__search_nIN10__gnu_test24forward_iterator_wrapperIiEEiiPFbiiEET_S5_S5_T0_RKT1_T2_St20forward_iterator_tag function is called with bogus %r28, right?
The final bogus value seems to be there because of dbr, which inserts load of address of a string literal into %r28 into one delay slot, but that's because %r28 was said to be REG_DEAD, even when it really wasn't. But it seems there are problems much earlier (everything with just -O2 on the attached iterator.ii with a x86_64-linux -> hppa2.0w-hp-hpux11.11 cross): In *optimized dump: <bb 20>: temp.573 = <retval>; D.54493.D.53815.ptr = __first->D.53815.ptr; D.54493.D.53815.SharedInfo = __first->D.53815.SharedInfo; D.54494.D.53815.ptr = __last->D.53815.ptr; D.54494.D.53815.SharedInfo = __last->D.53815.SharedInfo; D.54515 = {}; *temp.573 = __search_n (&D.54493, &D.54494, __count, __val, __binary_pred, D.54515) [return slot optimization]; In *subreg dump (each ... relation is that previous insns dominate later from what I can see): (insn 2 9 3 2 libstdc++-v3/include/bits/stl_algo.h:4396 (set (reg/f:SI 107 [ <result> ]) (reg:SI 28 %r28)) 37 {*pa.md:2542} (nil)) ... (call_insn 99 98 100 18 libstdc++-v3/include/bits/stl_algo.h:4408 (parallel [ (set (reg:SI 28 %r28) (call (mem:SI (reg:SI 22 %r22) [0 S4 A32]) (const_int 16 [0x10]))) (clobber (reg:SI 1 %r1)) (clobber (reg:SI 2 %r2)) (use (const_int 1 [0x1])) ]) 215 {call_val_reg} (nil) (expr_list:REG_DEP_TRUE (use (reg:SI 25 %r25)) (expr_list:REG_DEP_TRUE (use (reg:SI 26 %r26)) (nil)))) (insn 100 99 101 18 libstdc++-v3/include/bits/stl_algo.h:4408 (set (reg:SI 127) (reg:SI 28 %r28)) 37 {*pa.md:2542} (nil)) ... (insn 113 112 114 20 libstdc++-v3/include/bits/stl_algo.h:4413 (set (reg/f:SI 96 [ temp.573 ]) (reg/f:SI 107 [ <result> ])) 37 {*pa.md:2542} (nil)) ... (insn 125 124 156 20 libstdc++-v3/include/bits/stl_algo.h:4413 (set (reg:SI 28 %r28) (reg/f:SI 96 [ temp.573 ])) 37 {*pa.md:2542} (nil)) ... (call_insn 130 129 135 20 libstdc++-v3/include/bits/stl_algo.h:4413 (parallel [ (call (mem:SI (symbol_ref/v:SI ("@_ZSt10__search_nIN10__gnu_test24forward_iterator_wrapperIiEEiiPFbiiEET_S5_S5_T0_RKT1_T2_St20forward_iterator_tag") [flags 0x3] <function_decl 0x2aaab0cf0820 __search_n>) [0 S4 A32]) (const_int 24 [0x18])) (clobber (reg:SI 1 %r1)) (clobber (reg:SI 2 %r2)) (use (const_int 0 [0x0])) ]) 206 {call_symref} (nil) (expr_list:REG_DEP_TRUE (use (reg:SI 23 %r23)) (expr_list:REG_DEP_TRUE (use (reg:SI 24 %r24)) (expr_list:REG_DEP_TRUE (use (reg:SI 25 %r25)) (expr_list:REG_DEP_TRUE (use (reg:SI 26 %r26)) (expr_list:REG_DEP_TRUE (use (reg:SI 28 %r28)) (nil))))))) In *cse1 dump: (insn 2 9 3 2 libstdc++-v3/include/bits/stl_algo.h:4396 (set (reg/f:SI 107 [ <result> ]) (reg:SI 28 %r28)) 37 {*pa.md:2542} (nil)) ... (call_insn 99 98 100 18 libstdc++-v3/include/bits/stl_algo.h:4408 (parallel [ (set (reg:SI 28 %r28) (call (mem:SI (reg:SI 22 %r22) [0 S4 A32]) (const_int 16 [0x10]))) (clobber (reg:SI 1 %r1)) (clobber (reg:SI 2 %r2)) (use (const_int 1 [0x1])) ]) 215 {call_val_reg} (nil) (expr_list:REG_DEP_TRUE (use (reg:SI 25 %r25)) (expr_list:REG_DEP_TRUE (use (reg:SI 26 %r26)) (nil)))) (insn 100 99 101 18 libstdc++-v3/include/bits/stl_algo.h:4408 (set (reg:SI 127) (reg:SI 28 %r28)) 37 {*pa.md:2542} (nil)) ... (insn 113 112 114 20 libstdc++-v3/include/bits/stl_algo.h:4413 (set (reg/f:SI 96 [ temp.573 ]) (reg/f:SI 107 [ <result> ])) 37 {*pa.md:2542} (nil)) ... (insn 125 124 156 20 libstdc++-v3/include/bits/stl_algo.h:4413 (set (reg:SI 28 %r28 [ temp.573 ]) (reg:SI 28 %r28 [ temp.573 ])) 37 {*pa.md:2542} (nil)) I hope I haven't missed any control flow that could be in the way, but assuming for all ... snippets insns before it dominate those after it, cse1 change of insn 125 is not correct, %r28 is clobbered by call_insn 99. -- jakub at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |NEW GCC target triplet|cris-elf |hppa2.0w-hp-hpux11.11 Keywords|ice-checking |wrong-code Last reconfirmed|2007-07-07 15:17:58 |2007-12-11 10:02:49 date| | Summary|[4.3 Regression] |[4.3 Regression] |25_algorithms/search_n/itera|25_algorithms/search_n/itera |tor.cc: pch-related |tor.cc: miscompiled on |verify_ssa failure |hppa2.0w-hp-hpux11.11 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32636