aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2017-04-25 09:27:01 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2017-04-25 09:27:01 +0200
commit392594621391ab6dd6f6ccd4ad8a77b883c84a5b (patch)
treeb0b530909370b7365616489af776c09b7d34fdc7
parent904588d85412c65250c7f6fe9947714b2c590b8b (diff)
downloadgcc-392594621391ab6dd6f6ccd4ad8a77b883c84a5b.zip
gcc-392594621391ab6dd6f6ccd4ad8a77b883c84a5b.tar.gz
gcc-392594621391ab6dd6f6ccd4ad8a77b883c84a5b.tar.bz2
re PR rtl-optimization/80500 (ICE: internal consistency failure (error: invalid rtl sharing found in the insn))
PR rtl-optimization/80500 * loop-unroll.c (combine_var_copies_in_loop_exit): Call copy_rtx on sum's initial value. * gcc.dg/pr80500.c: New test. From-SVN: r247126
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/loop-unroll.c3
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr80500.c15
4 files changed, 29 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9b389a0..1138786 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2017-04-25 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/80500
+ * loop-unroll.c (combine_var_copies_in_loop_exit): Call copy_rtx on
+ sum's initial value.
+
2017-04-25 Julian Brown <julian@codesourcery.com>
Naveen H.S <Naveen.Hurugalawadi@cavium.com>
diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c
index dd5bdc5..3d48a8f 100644
--- a/gcc/loop-unroll.c
+++ b/gcc/loop-unroll.c
@@ -1913,6 +1913,9 @@ combine_var_copies_in_loop_exit (struct var_to_expand *ve, basic_block place)
if (ve->var_expansions.length () == 0)
return;
+ /* ve->reg might be SUBREG or some other non-shareable RTL, and we use
+ it both here and as the destination of the assignment. */
+ sum = copy_rtx (sum);
start_sequence ();
switch (ve->op)
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 4fb111e..96f33f0 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2017-04-25 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/80500
+ * gcc.dg/pr80500.c: New test.
+
2017-04-25 Marc Glisse <marc.glisse@inria.fr>
* gcc.dg/tree-ssa/cmpmul-1.c: New file.
diff --git a/gcc/testsuite/gcc.dg/pr80500.c b/gcc/testsuite/gcc.dg/pr80500.c
new file mode 100644
index 0000000..ae3ac01
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr80500.c
@@ -0,0 +1,15 @@
+/* PR rtl-optimization/80500 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -funroll-loops -ftree-loop-if-convert -fvariable-expansion-in-unroller" } */
+
+signed char v;
+
+void
+foo (int x)
+{
+ while (x != 0)
+ {
+ v = (x >= 0) + 1;
+ ++x;
+ }
+}