The following patch fixes
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83147
The patch was successfully boostrapped and tested on x86_64.
There is no test for the patch because a test from the PR does not
reproduce the bug anymore.
Committed as rev. 256902.
Index: ChangeLog
===================================================================
--- ChangeLog (revision 256901)
+++ ChangeLog (working copy)
@@ -1,3 +1,9 @@
+2018-01-19 Andreas Krebbel <kreb...@linux.vnet.ibm.com>
+
+ PR rtl-optimization/83147
+ * lra-constraints.c (remove_inheritance_pseudos): Use
+ lra_substitute_pseudo_within_insn.
+
2018-01-19 Tom de Vries <t...@codesourcery.com>
Cesar Philippidis <ce...@codesourcery.com>
Index: lra-constraints.c
===================================================================
--- lra-constraints.c (revision 256891)
+++ lra-constraints.c (working copy)
@@ -6719,10 +6719,12 @@ remove_inheritance_pseudos (bitmap remov
{
lra_assert (GET_MODE (SET_SRC (prev_set))
== GET_MODE (regno_reg_rtx[sregno]));
- if (GET_CODE (SET_SRC (set)) == SUBREG)
- SUBREG_REG (SET_SRC (set)) = SET_SRC (prev_set);
- else
- SET_SRC (set) = SET_SRC (prev_set);
+ /* Although we have a single set, the insn can
+ contain more one sregno register occurrence
+ as a source. Change all occurrences. */
+ lra_substitute_pseudo_within_insn (curr_insn, sregno,
+ SET_SRC (prev_set),
+ false);
/* As we are finishing with processing the insn
here, check the destination too as it might
inheritance pseudo for another pseudo. */