From: Jakub Jelinek Date: Fri, 23 Mar 2018 09:10:02 +0000 (+0100) Subject: re PR inline-asm/85034 (-O1 internal compiler error: in elimination_costs_in_insn... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b3d8938043f400cb462600c3f5fb7d346c45caea;p=gcc.git re PR inline-asm/85034 (-O1 internal compiler error: in elimination_costs_in_insn, at reload1.c:3633) 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: r258796 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0be26ef2b16..577cba628e4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2018-03-23 Jakub Jelinek + 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. diff --git a/gcc/function.c b/gcc/function.c index 485ddfbd642..61515e38e47 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -6661,10 +6661,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, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 14e78332f97..f0048519430 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2018-03-23 Jakub Jelinek + 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 index 00000000000..4a35b112174 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr85034.c @@ -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)); +}