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

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
The problematic block (for which we trigger the assert is):

(gdb) p debug_bb(bb)
(code_label 8952 8954 310 18 1247 (nil) [2 uses])
(note 310 8952 311 18 [bb 18] NOTE_INSN_BASIC_BLOCK)
(insn:TI 311 310 313 18 (set (reg/f:SI 0 ax [orig:873 MEM[(struct phi_arg_d
*)gsi_240].args[0].def ] [873])
        (mem/f:SI (plus:SI (reg/f:SI 3 bx [orig:127 gsi ] [127])
                (const_int 56 [0x38])) [193 MEM[(struct phi_arg_d
*)gsi_240].args[0].def+0 S4 A32])) "../../gcc/tree-ssa-strlen.c":2729 75
{*movsi_internal}
     (nil))
(call_insn:TI 313 311 315 18 (set (reg:SI 0 ax)
        (call (mem:QI (symbol_ref:SI ("_ZL10get_stridxP9tree_node") [flags 0x3]
<function_decl 0xf46e1480 get_stridx>) [0 get_stridx S1 A8])
            (const_int 0 [0]))) "../../gcc/tree-ssa-strlen.c":2729 553
{*call_value}
     (expr_list:REG_CALL_DECL (symbol_ref:SI ("_ZL10get_stridxP9tree_node")
[flags 0x3] <function_decl 0xf46e1480 get_stridx>)
        (expr_list:REG_EH_REGION (const_int 0 [0])
            (nil)))
    (expr_list:SI (use (reg:SI 0 ax))
        (nil)))
(insn:TI 315 313 314 18 (set (reg:CCZ 17 flags)
        (compare:CCZ (reg:SI 0 ax [orig:110 idx ] [110])
            (const_int 0 [0]))) "../../gcc/tree-ssa-strlen.c":2730 3
{*cmpsi_ccno_1}
     (expr_list:REG_DEAD (reg:SI 0 ax [orig:110 idx ] [110])
        (nil)))
(insn 314 315 316 18 (set (reg/v:SI 5 di [orig:110 idx ] [110])
        (reg:SI 0 ax)) "../../gcc/tree-ssa-strlen.c":2729 75 {*movsi_internal}
     (nil))
(jump_insn:TI 316 314 317 18 (set (pc)
        (if_then_else (eq (reg:CCZ 17 flags)
                (const_int 0 [0]))
            (label_ref:SI 343)
            (pc))) "../../gcc/tree-ssa-strlen.c":2730 536 {*jcc}
     (expr_list:REG_DEAD (reg:CCZ 17 flags)
        (int_list:REG_BR_PROB 1064185877 (nil)))
 -> 343)

Has following count:

(gdb) p bb->count
$10 = {static n_bits = 61, static max_count = 2305843009213693950, static
uninitialized_count = 2305843009213693951, m_val = 9888, m_quality =
profile_precise}

And previous block is:

(gdb) p bb->prev_bb
$11 = (basic_block) 0xf3afc3c0
(gdb) p debug_bb(bb->prev_bb)
(note 8951 309 8953 17 [bb 17] NOTE_INSN_BASIC_BLOCK)
(jump_insn/j:TI 8953 8951 8954 17 (set (pc)
        (label_ref 8952)) 537 {jump}
     (nil)
 -> 8952)

Has count:

(gdb) p bb->prev_bb.count
$13 = {static n_bits = 61, static max_count = 2305843009213693950, static
uninitialized_count = 2305843009213693951, m_val = 0, m_quality =
profile_precise}

And the count is set here:

#0  0x084bce69 in force_nonfallthru_and_redirect (e=0xf4247400,
target=0xf3fd4438, jump_label=0x0) at ../../gcc/cfgrtl.c:1631
#1  0x084bd902 in rtl_force_nonfallthru (e=0xf4247400) at
../../gcc/cfgrtl.c:1709
#2  0x084ac2a4 in force_nonfallthru(edge_def*) ()
#3  0x084c1257 in fixup_new_cold_bb (bb=0xf4233c6c) at ../../gcc/cfgrtl.c:1394
#4  fixup_partitions () at ../../gcc/cfgrtl.c:2384
#5  0x08d688e5 in cleanup_cfg(int) ()
#6  0x08d54afb in (anonymous namespace)::pass_reorder_blocks::execute
(this=0x9938470, fun=0xf47733a8) at ../../gcc/bb-reorder.c:2593
#7  0x0873d5aa in execute_one_pass(opt_pass*) ()
#8  0x0873ddbf in execute_pass_list_1(opt_pass*) ()
#9  0x0873ddd2 in execute_pass_list_1(opt_pass*) ()
#10 0x0873ddd2 in execute_pass_list_1(opt_pass*) ()
#11 0x0873de19 in execute_pass_list(function*, opt_pass*) ()
#12 0x084d547c in cgraph_node::expand() ()
#13 0x084d65ba in symbol_table::compile() [clone .part.55] ()
#14 0x084d8389 in symbol_table::finalize_compilation_unit() ()
#15 0x087f613e in compile_file() ()
#16 0x082c03b9 in toplev::main(int, char**) ()
#17 0x082c2781 in main ()

Reply via email to