public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "linkw at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/94043] [9/10 Regression] ICE in superloop_at_depth, at cfgloop.c:78 Date: Fri, 20 Mar 2020 02:56:31 +0000 [thread overview] Message-ID: <bug-94043-4-jcgvmlgqDF@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-94043-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94043 --- Comment #4 from Kewen Lin <linkw at gcc dot gnu.org> --- This was just exposed from my commit, it can also be reproduced without my commit but with -fno-vect-cost-model. Some loops we have for this case: ;; Loop 1 ;; header 3, latch 10 ;; depth 1, outer 0 ;; nodes: 3 10 8 23 25 34 35 26 29 32 33 38 4 11 37 31 ;; Loop 2 ;; header 4, latch 11 ;; depth 2, outer 1 ;; nodes: 4 11 ;; Loop 4 ;; header 26, latch 29 ;; depth 2, outer 1 ;; nodes: 26 29 When we are doing versioning for loop4 required for aliasing check, the related scalar_loop_iters is based on e2.2_31, which is defined in BB 4, that is: <bb 4> [local count: 4343773762]: # e2.2_31 = PHI <_15(11), 1(37)> # ivtmp_14 = PHI <ivtmp_23(11), 4(37)> For the codes: if ((def_bb = gimple_bb (SSA_NAME_DEF_STMT (USE_FROM_PTR (use_p)))) && flow_bb_inside_loop_p (outermost, def_bb)) outermost = superloop_at_depth (loop, bb_loop_depth (def_bb) + 1) bb_loop_depth is 2, the +1 make the assertion in superloop_at_depth fail since the current loop 4 only has the depth 2. I think the existing code has the assumption that all operands in stmts of cond_expr_stmt_list are defined in some outer loop of current, but the assumption breaks in this case. I guess the current scalar_loop_iters is valid? Then the fix can be: --- a/gcc/tree-vect-loop-manip.c +++ b/gcc/tree-vect-loop-manip.c @@ -3312,7 +3312,13 @@ vect_loop_versioning (loop_vec_info loop_vinfo, FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_USE) if ((def_bb = gimple_bb (SSA_NAME_DEF_STMT (USE_FROM_PTR (use_p)))) && flow_bb_inside_loop_p (outermost, def_bb)) - outermost = superloop_at_depth (loop, loop_depth (outermost) + 1); + { + /* Def block can be in either one outer loop of loop_to_version or + one sibling of outer loop of loop_to_version. */ + class loop *common_loop + = find_common_loop (def_bb->loop_father, loop); + outermost = superloop_at_depth (loop, loop_depth (common_loop) + 1); + } }
next prev parent reply other threads:[~2020-03-20 2:56 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-94043-4@http.gcc.gnu.org/bugzilla/> 2020-03-12 11:58 ` jakub at gcc dot gnu.org 2020-03-17 14:36 ` marxin at gcc dot gnu.org 2020-03-18 2:49 ` linkw at gcc dot gnu.org 2020-03-20 2:56 ` linkw at gcc dot gnu.org [this message] 2020-03-20 7:06 ` rguenther at suse dot de 2020-03-20 7:14 ` linkw at gcc dot gnu.org 2020-03-20 7:22 ` rguenther at suse dot de 2020-03-22 8:39 ` linkw at gcc dot gnu.org 2020-03-23 13:21 ` rguenth at gcc dot gnu.org 2020-03-24 2:59 ` linkw at gcc dot gnu.org 2020-03-24 6:44 ` rguenther at suse dot de 2020-03-26 2:45 ` linkw at gcc dot gnu.org 2020-03-26 8:26 ` rguenth at gcc dot gnu.org 2020-03-26 8:54 ` linkw at gcc dot gnu.org 2020-03-26 9:05 ` rguenther at suse dot de 2020-03-26 12:56 ` linkw at gcc dot gnu.org 2020-03-26 13:36 ` rguenth at gcc dot gnu.org 2020-04-01 5:24 ` cvs-commit at gcc dot gnu.org 2020-04-01 6:44 ` linkw at gcc dot gnu.org 2020-04-01 6:56 ` [Bug tree-optimization/94043] [9 " rguenth at gcc dot gnu.org 2020-04-01 7:30 ` linkw at gcc dot gnu.org 2020-04-02 13:21 ` clyon at gcc dot gnu.org 2020-04-17 8:55 ` cvs-commit at gcc dot gnu.org 2020-04-17 9:01 ` linkw 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-94043-4-jcgvmlgqDF@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: linkBe 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).