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

--- Comment #3 from Andrew Macleod <amacleod at redhat dot com> ---
I think we're tripping over statements that haven't been entered into the IL
yet maybe?

Using -O3 -march=skylake-avx512 on x86_64, I'm seeing vect_recog_divmod_pattern
()calls :
  get_range_query (cfun)->range_of_expr (r, oprnd0);
with oprnd0 = patt_72

  patt_72 = patt_75 ? patt_70 : _40;   
is tagged as being in BB15, and range folding asks for the range of patt_75,
which invokes rang_of_stmt on
  patt_75 = patt_74 != 0;
which is also set as being in BB15

This invokes range_of expr/stmt on patt_74 defined by:
  patt_74 = _26 ? 65535 : 0;
but that statement has no BB set, so it invokes range_on_entry for patt_74...
and since it has no BB set, we get the trap as that is suppose to be invalid.

When I look at a live CFG dump after the trap, I don't see any of these
statements actually in the IL., so I presume they are being built.

bb15 look slike:
;;   basic block 15, loop depth 2
;;    pred:       24
;;                37
  # e_27 = PHI <e_24(24), e_2(37)>
  _13 = .MASK_LOAD (&a[3], 8B, _26, 0);
  _58 = (int) _13;
  _40 = .MASK_LOAD (&b[7], 16B, _68, 0);
  _39 = (int) _40;
  _67 = _26 ? _58 : _39;
  _4 = _67 / 6;
  h[_25] = _4;
  e_24 = e_27 + 1;
  if (e_24 != 9)
    goto <bb 24>; [88.89%]
  else
    goto <bb 12>; [11.11%]


I see a predecessor block defines _26 as
  _26 = _32 != 0;
And _26 is being used in   _13 = .MASK_LOAD (&a[3], 8B, _26, 0);

It seems likely that this is expansion code being built and that perhaps the
stmt defining patt_74 missed having the BB set on it?

Reply via email to