The following patch fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89676
The patch was successfully bootstrapped and tested on x86-64. Committed as rev. 269878.
Index: ChangeLog =================================================================== --- ChangeLog (revision 269876) +++ ChangeLog (working copy) @@ -1,3 +1,9 @@ +2019-03-22 Vladimir Makarov <vmaka...@redhat.com> + + PR rtl-optimization/89676 + * lra-constraints.c (curr_insn_transform): Do match reload for + early clobbers even if the match was successful. + 2019-03-22 Jakub Jelinek <ja...@redhat.com> PR c++/87481 Index: lra-constraints.c =================================================================== --- lra-constraints.c (revision 269876) +++ lra-constraints.c (working copy) @@ -4256,6 +4256,20 @@ curr_insn_transform (bool check_only_p) || MEM_P (SET_DEST (curr_insn_set)) || GET_CODE (SET_DEST (curr_insn_set)) == SUBREG)))) optional_p = true; + else if (goal_alt_matched[i][0] != -1 + && curr_static_id->operand[i].type == OP_OUT + && (curr_static_id->operand_alternative + [goal_alt_number * n_operands + i].earlyclobber)) + { + /* Generate reloads for output and matched inputs. This + is the easiest way to avoid creation of non-existing + conflicts in lra-lives.c. */ + match_reload (i, goal_alt_matched[i], outputs, goal_alt[i], &before, + &after, TRUE); + outputs[n_outputs++] = i; + outputs[n_outputs] = -1; + continue; + } else continue; } Index: testsuite/ChangeLog =================================================================== --- testsuite/ChangeLog (revision 269876) +++ testsuite/ChangeLog (working copy) @@ -1,3 +1,8 @@ +2019-03-22 Vladimir Makarov <vmaka...@redhat.com> + + PR rtl-optimization/89676 + * gcc.target/i386/pr89676.c: New. + 2019-03-22 Jakub Jelinek <ja...@redhat.com> PR c++/60702 Index: testsuite/gcc.target/i386/pr89676.c =================================================================== --- testsuite/gcc.target/i386/pr89676.c (nonexistent) +++ testsuite/gcc.target/i386/pr89676.c (working copy) @@ -0,0 +1,10 @@ +/* PR rtl-optimization/89676 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -m32 -march=i686" } */ +unsigned long long +foo (unsigned long long i) +{ + return i << 3; +} + +/* { dg-final { scan-assembler-times "movl" 2 } } */