re PR target/91604 (ICE in extract_insn at recog.c:2310 since r272323)
authorJakub Jelinek <jakub@redhat.com>
Tue, 3 Sep 2019 16:46:06 +0000 (18:46 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 3 Sep 2019 16:46:06 +0000 (18:46 +0200)
PR target/91604
* config/i386/i386-expand.c (split_double_mode): If there is more than
one MEM operand and they are rtx_equal_p, reuse lo_half/hi_half from
already split matching MEM operand instead of calling adjust_address
again.

* gcc.target/i386/pr91604.c: New test.

From-SVN: r275344

gcc/ChangeLog
gcc/config/i386/i386-expand.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr91604.c [new file with mode: 0644]

index 4996f8cecec210ae4fc2542607a149b953cf2b70..6ac810fca55530fa9b8adc91451d6bd756ae8fab 100644 (file)
@@ -1,3 +1,11 @@
+2019-09-03  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/91604
+       * config/i386/i386-expand.c (split_double_mode): If there is more than
+       one MEM operand and they are rtx_equal_p, reuse lo_half/hi_half from
+       already split matching MEM operand instead of calling adjust_address
+       again.
+
 2019-09-03  Ulrich Weigand  <uweigand@de.ibm.com>
 
        * config.gcc: Obsolete spu target.  Remove references to spu.
index ec50de297eefd478a3ec17af540aef6be404e282..862cd81da4d14fbce30ab3c3b4a6caea5ed0469d 100644 (file)
@@ -106,6 +106,8 @@ split_double_mode (machine_mode mode, rtx operands[],
 {
   machine_mode half_mode;
   unsigned int byte;
+  rtx mem_op = NULL_RTX;
+  int mem_num = 0;
 
   switch (mode)
     {
@@ -129,8 +131,18 @@ split_double_mode (machine_mode mode, rtx operands[],
          but we still have to handle it.  */
       if (MEM_P (op))
        {
-         lo_half[num] = adjust_address (op, half_mode, 0);
-         hi_half[num] = adjust_address (op, half_mode, byte);
+         if (mem_op && rtx_equal_p (op, mem_op))
+           {
+             lo_half[num] = lo_half[mem_num];
+             hi_half[num] = hi_half[mem_num];
+           }
+         else
+           {
+             mem_op = op;
+             mem_num = num;
+             lo_half[num] = adjust_address (op, half_mode, 0);
+             hi_half[num] = adjust_address (op, half_mode, byte);
+           }
        }
       else
        {
index 1a17b066401519fe93379f69f0be384375c98041..44c43d26b938618ba821e183e7c3c89022434740 100644 (file)
@@ -1,3 +1,8 @@
+2019-09-03  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/91604
+       * gcc.target/i386/pr91604.c: New test.
+
 2019-09-03  Ulrich Weigand  <uweigand@de.ibm.com>
 
        * lib/compat.exp: Remove references to spu.
diff --git a/gcc/testsuite/gcc.target/i386/pr91604.c b/gcc/testsuite/gcc.target/i386/pr91604.c
new file mode 100644 (file)
index 0000000..329f17f
--- /dev/null
@@ -0,0 +1,11 @@
+/* PR target/91604 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -msse2 --param max-gcse-memory=0 -fno-rerun-cse-after-loop" } */
+
+long long v;
+
+void
+foo (void)
+{
+  v = ~v;
+}