The following patch fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85860
The patch was successfully bootstrapped and tested on x86-64. Committed as rev. 269662 to trunk and as rev. 269663 to gcc-8-branch.
Index: ChangeLog =================================================================== --- ChangeLog (revision 269661) +++ ChangeLog (working copy) @@ -1,3 +1,9 @@ +2019-03-13 Vladimir Makarov <vmaka...@redhat.com> + + PR target/85860 + * lra-constraints.c (inherit_in_ebb): Update + potential_reload_hard_regs along with live_hard_regs. + 2019-03-13 Jakub Jelinek <ja...@redhat.com> PR debug/89498 Index: lra-constraints.c =================================================================== --- lra-constraints.c (revision 269651) +++ lra-constraints.c (working copy) @@ -6365,6 +6365,7 @@ inherit_in_ebb (rtx_insn *head, rtx_insn add_to_hard_reg_set (&s, PSEUDO_REGNO_MODE (dst_regno), reg_renumber[dst_regno]); AND_COMPL_HARD_REG_SET (live_hard_regs, s); + AND_COMPL_HARD_REG_SET (potential_reload_hard_regs, s); } /* We should invalidate potential inheritance or splitting for the current insn usages to the next Index: testsuite/ChangeLog =================================================================== --- testsuite/ChangeLog (revision 269661) +++ testsuite/ChangeLog (working copy) @@ -1,3 +1,8 @@ +2019-03-13 Vladimir Makarov <vmaka...@redhat.com> + + PR target/85860 + * gcc.target/i386/pr85860.c: New. + 2019-03-13 Marek Polacek <pola...@redhat.com> PR c++/89686 - mixing init-capture and simple-capture in lambda. Index: testsuite/gcc.target/i386/pr85860.c =================================================================== --- testsuite/gcc.target/i386/pr85860.c (nonexistent) +++ testsuite/gcc.target/i386/pr85860.c (working copy) @@ -0,0 +1,23 @@ +/* { dg-do compile { target lp64 } } */ +/* { dg-options "-O2 -fno-guess-branch-probability -flive-range-shrinkage -mbmi2" } */ + +int a, b, c, d, e; + +extern int bar(void); + +__int128 +foo (unsigned g, int h, long i, __int128 j, short k, __int128 l) +{ + unsigned __int128 m = j; + do + { + j %= 5; + c = c >> (m & 31); + e = __builtin_sub_overflow (b, 0, &m); + d = bar (); + l *= __builtin_mul_overflow_p ((unsigned) d, ~(unsigned __int128) 1, + (unsigned __int128) 0); + } + while (a); + return m + j + k + l; +}