public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/111950] [14 Regression] ICE in compute_live_loop_exits, at tree-ssa-loop-manip.cc:250 since r14-4786-gd118738e71c
Date: Fri, 03 Nov 2023 12:02:15 +0000	[thread overview]
Message-ID: <bug-111950-4-AjaZgjOQwC@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-111950-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
t.c:6:10: note:   init: stmt relevant? iftmp.0_9 = _32 ? 1 : iftmp.0_39;
t.c:6:10: note:   vec_stmt_relevant_p: used out of loop.
t.c:6:10: note:   vect_is_simple_use: operand _1 != 0, type of def: external
t.c:6:10: note:   vect_is_simple_use: operand (unsigned int) a.3_23, type of
def: external
t.c:6:10: note:   mark relevant 0, live 1: iftmp.0_9 = _32 ? 1 : iftmp.0_39;
t.c:6:10: note:   last stmt in pattern. don't mark relevant/live.
t.c:6:10: note:   vec_stmt_relevant_p: forcing live pattern stmt relevant.
t.c:6:10: note:   mark relevant 1, live 1: patt_43 = _32 != 0 ? 1 : iftmp.0_39;
t.c:6:10: note:   init: stmt relevant? c_I_lsm.18_38 = _32 ? 1 : a.3_23;
t.c:6:10: note:   vec_stmt_relevant_p: used out of loop.
t.c:6:10: note:   vec_stmt_relevant_p: used out of loop.
t.c:6:10: note:   vect_is_simple_use: operand _1 != 0, type of def: external
t.c:6:10: note:   vect_is_simple_use: operand a, type of def: external
t.c:6:10: note:   mark relevant 0, live 1: c_I_lsm.18_38 = _32 ? 1 : a.3_23;
t.c:6:10: note:   last stmt in pattern. don't mark relevant/live.
t.c:6:10: note:   vec_stmt_relevant_p: forcing live pattern stmt relevant.
t.c:6:10: note:   mark relevant 1, live 1: patt_41 = _32 != 0 ? 1 : a.3_23;
t.c:6:10: note:   init: stmt relevant? _37 = d.12_13 + 1;
t.c:6:10: note:   init: stmt relevant? if (_37 != 0)
t.c:6:10: note:   worklist: examine stmt: patt_41 = _32 != 0 ? 1 : a.3_23;
t.c:6:10: note:   vect_is_simple_use: operand _1 != 0, type of def: external
t.c:6:10: note:   vect_is_simple_use: operand 0, type of def: constant
t.c:6:10: note:   vect_is_simple_use: operand a, type of def: external
t.c:6:10: note:   worklist: examine stmt: patt_43 = _32 != 0 ? 1 : iftmp.0_39;
t.c:6:10: note:   vect_is_simple_use: operand _1 != 0, type of def: external
t.c:6:10: note:   vect_is_simple_use: operand 0, type of def: constant
t.c:6:10: note:   vect_is_simple_use: operand (unsigned int) a.3_23, type of
def: external

now, if-conversion managed to CSE the LC PHI node:

  <bb 19> [local count: 16140304]:
  # prephitmp_40 = PHI <c_I_lsm.18_38(11), prephitmp_34(23)>
  # c_I_lsm.18_24 = PHI <c_I_lsm.18_38(11), c_I_lsm.18_33(23)>
  # iftmp.0_21 = PHI <iftmp.0_9(11), iftmp.0_8(23)>

that triggers "interesting" behavior in vectorizable_live_operation which
inserts a PHI for the vectorized c_I_lsm.18_38.  It will remove the
_first_ PHI node using the old scalar (prephitmp_40) and insert a copy
for that.  It leaves the second around, but will then, running into the
remaining USE, replace all uses of c_I_lsm.18_24 with the vectorized
result:

<bb 32> [local count: 14526274]:
# c_I_lsm.18_59 = PHI <c_I_lsm.18_38(11)>
# d.12_61 = PHI <_37(11)>
# vect_patt_43.28_82 = PHI <vect_patt_43.28_81(11)>
# vect_patt_41.29_91 = PHI <vect_patt_41.29_90(11)>
_92 = BIT_FIELD_REF <vect_patt_41.29_91, 32, 96>;
prephitmp_58 = _92;
_83 = BIT_FIELD_REF <vect_patt_43.28_82, 32, 96>;
iftmp.0_60 = _83;
niters_vector_mult_vf.26_68 = bnd.25_67 << 2;
_70 = (int) niters_vector_mult_vf.26_68;
tmp.27_69 = d.12_5 + _70;
if (niters.24_48 == niters_vector_mult_vf.26_68)

this all doesn't make much sense to me ... doing the "obvious" doesn't fix
this bug.  It seems things are wrong already when the epilog peeling happens
where for the merge PHI after the epilog we somehow failed to update
the PHI node for c_I_lsm.18_73.

Looks like we didn't get rid of 'find_guard_arg' ... and it relies on
get_current_def which in turn relies on "copying" that info from
the scalar copy to the original loop (the magic in
slpeel_duplicate_current_defs_from_edges).  That was all fragile
in the past, I guess it's now simply broken, at least for the special
case we have here.

  parent reply	other threads:[~2023-11-03 12:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-24  7:15 [Bug tree-optimization/111950] New: " shaohua.li at inf dot ethz.ch
2023-10-24  7:50 ` [Bug tree-optimization/111950] [14 Regression] " rguenth at gcc dot gnu.org
2023-10-27 14:14 ` rguenth at gcc dot gnu.org
2023-10-27 14:29 ` tnfchris at gcc dot gnu.org
2023-10-27 16:02 ` tnfchris at gcc dot gnu.org
2023-11-03 12:02 ` rguenth at gcc dot gnu.org [this message]
2023-11-03 13:27 ` rguenth at gcc dot gnu.org
2023-11-03 14:14 ` rguenth at gcc dot gnu.org
2023-11-03 14:57 ` rguenth at gcc dot gnu.org
2023-11-03 15:58 ` tnfchris at gcc dot gnu.org
2023-11-06  9:51 ` rguenth at gcc dot gnu.org
2023-11-06 13:16 ` cvs-commit at gcc dot gnu.org
2023-11-06 13:18 ` rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-111950-4-AjaZgjOQwC@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).