re PR rtl-optimization/92510 (ICE in native_encode_rtx, at simplify-rtx.c:6272)
authorJakub Jelinek <jakub@redhat.com>
Wed, 27 Nov 2019 16:32:54 +0000 (17:32 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 27 Nov 2019 16:32:54 +0000 (17:32 +0100)
PR rtl-optimization/92510
* combine.c (gen_lowpart_for_combine): Only transform lowpart subreg
of comparison into a comparison with different mode if both imode and
omode are scalar integral modes.

* gcc.dg/pr92510.c: New test.

From-SVN: r278777

gcc/ChangeLog
gcc/combine.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr92510.c [new file with mode: 0644]

index f2cacc047d832998878af32c8428eb6cc7d39f18..7dbf824938f2f0ce0b1900a2fd94599b1228b2db 100644 (file)
@@ -1,3 +1,10 @@
+2019-11-27  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/92510
+       * combine.c (gen_lowpart_for_combine): Only transform lowpart subreg
+       of comparison into a comparison with different mode if both imode and
+       omode are scalar integral modes.
+
 2019-11-27  Vladimir Makarov  <vmakarov@redhat.com>
 
        PR rtl-optimization/90007
index 3fbd84fcb808b8e0d2d07cfc4d7423030f50b25f..16e606d8a21ff424ff313d16a201055b2d3ce285 100644 (file)
@@ -11812,7 +11812,9 @@ gen_lowpart_for_combine (machine_mode omode, rtx x)
 
   /* If X is a comparison operator, rewrite it in a new mode.  This
      probably won't match, but may allow further simplifications.  */
-  else if (COMPARISON_P (x))
+  else if (COMPARISON_P (x)
+          && SCALAR_INT_MODE_P (imode)
+          && SCALAR_INT_MODE_P (omode))
     return gen_rtx_fmt_ee (GET_CODE (x), omode, XEXP (x, 0), XEXP (x, 1));
 
   /* If we couldn't simplify X any other way, just enclose it in a
index aca3864b184d6d0e45880f4409378bad20fe5d3f..4f97f4cc58c57fde608d312e08f79e365f6bafb1 100644 (file)
@@ -1,3 +1,8 @@
+2019-11-27  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/92510
+       * gcc.dg/pr92510.c: New test.
+
 2019-11-27  Andrew Sutton  <asutton@lock3software.com>
 
        PR c++/92236
diff --git a/gcc/testsuite/gcc.dg/pr92510.c b/gcc/testsuite/gcc.dg/pr92510.c
new file mode 100644 (file)
index 0000000..d468586
--- /dev/null
@@ -0,0 +1,16 @@
+/* PR rtl-optimization/92510 */
+/* { dg-do compile } */
+/* { dg-options "-O1 -ftree-loop-vectorize -fno-forward-propagate -fno-tree-scev-cprop" } */
+
+int v;
+
+long int
+foo (long int x)
+{
+  signed char i;
+
+  for (i = 0; i < 8; ++i)
+    x |= !!v;
+
+  return x + i;
+}