This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/81030] [8 Regression] ICE on valid code at -O1 (only) on x86_64-linux-gnu: verify_flow_info failed


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

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vries at gcc dot gnu.org

--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
When we expand this jump:
...
  _23 = _21 | _22;
  if (_23 != 0)
    goto <bb 7>; [73.27%] [count: INV]
  else
    goto <bb 6>; [26.73%] [count: INV]
;;    succ:       7 [73.3% (guessed)]  (TRUE_VALUE,EXECUTABLE)
;;                6 [26.7% (guessed)]  (FALSE_VALUE,EXECUTABLE)
...


we hit the TRUTH_ORIF_EXPR handling in do_jump_1:
...
    case TRUTH_ANDIF_EXPR:
      {
        /* Spread the probability that the expression is false evenly between
           the two conditions. So the first condition is false half the total
           probability of being false. The second condition is false the other
           half of the total probability of being false, so its jump has a
false
           probability of half the total, relative to the probability we
           reached it (i.e. the first condition was true).  */
        profile_probability op0_prob = profile_probability::uninitialized ();
        profile_probability op1_prob = profile_probability::uninitialized ();
        if (prob.initialized_p ())
          {
            profile_probability false_prob = prob.invert ();
            profile_probability op0_false_prob = false_prob.apply_scale (1, 2);
            profile_probability op1_false_prob = false_prob.apply_scale (1, 2)
                                / op0_false_prob.invert ();
            /* Get the probability that each jump below is true.  */
            op0_prob = op0_false_prob.invert ();
            op1_prob = op1_false_prob.invert ();
          }
        if (if_false_label == NULL)
          {
            drop_through_label = gen_label_rtx ();
            do_jump (op0, drop_through_label, NULL, op0_prob);
            do_jump (op1, NULL, if_true_label, op1_prob);
          }
        else
          {
            do_jump (op0, if_false_label, NULL, op0_prob);
            do_jump (op1, if_false_label, if_true_label, op1_prob);
          }
        break;
      }
...

The true edge to bb7 with probability 7327 is split into two probabilities, as
the comment explains:
...
(gdb) p op0_prob
$5 = {static n_bits = 30, static max_probability = 10000, 
  static uninitialized_probability = 1073741823, m_val = 3664, m_quality =
profile_guessed}
(gdb) p op1_prob
$6 = {static n_bits = 30, static max_probability = 10000, 
  static uninitialized_probability = 1073741823, m_val = 5783, m_quality =
profile_guessed}
...


The assert we run into is:
....
test2.c:26:1: error: verify_flow_info: REG_BR_PROB does not match cfg 3664 7327
...
The assert complains that the first do_jump generates a branch with REG_BR_PROB
3664, while the corresponding edge remains at 7327.

In other words:
...
(jump_insn 15 14 18 5 (set (pc)
        (if_then_else (ne (reg:CCZ 17 flags)
                (const_int 0 [0]))
            (label_ref:DI 32)
            (pc))) "test2.c":20 617 {*jcc_1}
     (int_list:REG_BR_PROB 3664 (nil))
 -> 32)
;;    succ:       10 [73.3% (guessed)]
;;                6 [26.7% (guessed)]  (FALLTHRU)
...

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]