From: "Kewen.Lin" <linkw@linux.ibm.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Cc: "H.J. Lu" <hjl.tools@gmail.com>,
Richard Biener <richard.guenther@gmail.com>,
Bill Schmidt <wschmidt@linux.ibm.com>,
Segher Boessenkool <segher@kernel.crashing.org>
Subject: [PATCH] Fix PR94443 with gsi_insert_seq_before
Date: Thu, 2 Apr 2020 18:43:09 +0800 [thread overview]
Message-ID: <e6227dc6-439c-d232-2897-1ece5dc05a6f@linux.ibm.com> (raw)
In-Reply-To: <CAMe9rOqJ=YbzroV3yDmo0H+zy48uh=9deytOsJE+YJVQmpgEuw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 936 bytes --]
on 2020/4/2 上午6:51, H.J. Lu wrote:
>
> This caused:
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94449
>
Thanks for reporting this. The attached patch is to fix the stupid
mistake by using gsi_insert_seq_before instead of gsi_insert_before.
BTW, the regression testing on one x86_64 machine from CFarm is
unable to reveal it (I guess due to native arch sandybridge?), so I
specified additional option -march=znver2 and verified the coverage.
Bootstrapped/regtested on powerpc64le-linux-gnu (P9) and
x86_64-pc-linux-gnu, also verified the fail cases in related PRs.
BR,
Kewen
-----------
gcc/ChangeLog
2020-04-02 Kewen Lin <linkw@gcc.gnu.org>
PR tree-optimization/94443
* tree-vect-loop.c (vectorizable_live_operation): Use
gsi_insert_seq_before to replace gsi_insert_before.
gcc/testsuite/ChangeLog
2020-04-02 Kewen Lin <linkw@gcc.gnu.org>
PR tree-optimization/94443
* gcc.dg/vect/pr94443.c: New test.
[-- Attachment #2: PR94443.diff --]
[-- Type: text/plain, Size: 1391 bytes --]
diff --git a/gcc/testsuite/gcc.dg/vect/pr94443.c b/gcc/testsuite/gcc.dg/vect/pr94443.c
new file mode 100644
index 0000000..f8cbaf1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr94443.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=znver2" { target { x86_64-*-* i?86-*-* } } } */
+
+/* Check it to be compiled successfully without any ICE. */
+
+int a;
+unsigned *b;
+
+void foo()
+{
+ for (unsigned i; i <= a; ++i, ++b)
+ ;
+}
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index c9b6534..34adf79 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -8050,7 +8050,7 @@ vectorizable_live_operation (stmt_vec_info stmt_info,
if (stmts)
{
gimple_stmt_iterator exit_gsi = gsi_after_labels (exit_bb);
- gsi_insert_before (&exit_gsi, stmts, GSI_CONTINUE_LINKING);
+ gsi_insert_seq_before (&exit_gsi, stmts, GSI_SAME_STMT);
/* Remove existing phi from lhs and create one copy from new_tree. */
tree lhs_phi = NULL_TREE;
@@ -8063,7 +8063,7 @@ vectorizable_live_operation (stmt_vec_info stmt_info,
remove_phi_node (&gsi, false);
lhs_phi = gimple_phi_result (phi);
gimple *copy = gimple_build_assign (lhs_phi, new_tree);
- gsi_insert_after (&exit_gsi, copy, GSI_CONTINUE_LINKING);
+ gsi_insert_before (&exit_gsi, copy, GSI_SAME_STMT);
break;
}
}
next prev parent reply other threads:[~2020-04-02 10:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-30 10:24 [PATCH] Fix PR94043 by making vect_live_op generate lc-phi Kewen.Lin
2020-03-30 10:38 ` Richard Biener
2020-04-01 22:51 ` H.J. Lu
2020-04-02 10:43 ` Kewen.Lin [this message]
2020-04-02 18:55 ` [PATCH] Fix PR94443 with gsi_insert_seq_before H.J. Lu
2020-04-03 7:01 ` Richard Biener
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=e6227dc6-439c-d232-2897-1ece5dc05a6f@linux.ibm.com \
--to=linkw@linux.ibm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=hjl.tools@gmail.com \
--cc=richard.guenther@gmail.com \
--cc=segher@kernel.crashing.org \
--cc=wschmidt@linux.ibm.com \
/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).