]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR inline-asm/85034 (-O1 internal compiler error: in elimination_costs_i...
authorJakub Jelinek <jakub@redhat.com>
Fri, 22 Jun 2018 20:58:02 +0000 (22:58 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 22 Jun 2018 20:58:02 +0000 (22:58 +0200)
Backported from mainline
2018-03-23  Jakub Jelinek  <jakub@redhat.com>

PR inline-asm/85034
* function.c (match_asm_constraints_1): Don't optimize if input
doesn't satisfy general_operand predicate for output's mode.

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

From-SVN: r261938

gcc/ChangeLog
gcc/function.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr85034.c [new file with mode: 0644]

index 546fbf3c80f4235a77271cd9c2960b6371a313d9..6b8aba51fc242cc4c5f7ea16afd5c5bbf8a28409 100644 (file)
@@ -3,6 +3,10 @@
        Backported from mainline
        2018-03-23  Jakub Jelinek  <jakub@redhat.com>
 
+       PR inline-asm/85034
+       * function.c (match_asm_constraints_1): Don't optimize if input
+       doesn't satisfy general_operand predicate for output's mode.
+
        PR inline-asm/85022
        * alias.c (write_dependence_p): Don't require for x_canonicalized
        non-VOIDmode if x has VOIDmode.
index ebb8aaf0cf07929cbe9bce5d365cafe2d306ff1a..bde4da073c28e1cb751873d256ed050dcee01404 100644 (file)
@@ -6576,10 +6576,9 @@ match_asm_constraints_1 (rtx_insn *insn, rtx *p_sets, int noutputs)
       /* Only do the transformation for pseudos.  */
       if (! REG_P (output)
          || rtx_equal_p (output, input)
-         || (GET_MODE (input) != VOIDmode
-             && GET_MODE (input) != GET_MODE (output))
          || !(REG_P (input) || SUBREG_P (input)
-              || MEM_P (input) || CONSTANT_P (input)))
+              || MEM_P (input) || CONSTANT_P (input))
+         || !general_operand (input, GET_MODE (output)))
        continue;
 
       /* We can't do anything if the output is also used as input,
index 6a4fd900848b404ee47df5cf228102d42265a419..d868d52ccd35c3b471130faefa416f8a72fce1d8 100644 (file)
@@ -3,6 +3,9 @@
        Backported from mainline
        2018-03-23  Jakub Jelinek  <jakub@redhat.com>
 
+       PR inline-asm/85034
+       * gcc.target/i386/pr85034.c: New test.
+
        PR inline-asm/85022
        * c-c++-common/torture/pr85022.c: New test.
 
diff --git a/gcc/testsuite/gcc.target/i386/pr85034.c b/gcc/testsuite/gcc.target/i386/pr85034.c
new file mode 100644 (file)
index 0000000..4a35b11
--- /dev/null
@@ -0,0 +1,11 @@
+/* PR inline-asm/85034 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void
+foo (void)
+{
+  volatile float a;
+  struct S { char a; } b = { 0 };
+  asm volatile ("" : "=r" (a) : "0ir" (b));
+}