Changing a SET that has a REG_CFA_REGISTER note is wrong if we are
changing the SET_DEST, or if the REG_CFA_REGISTER has nil as its
argument, and maybe some other cases. It's never really useful to
propagate into such an instruction, so let's just bail whenever we
see such a note.
Bootstrapped and tested on powerpc64-linux {-m32,-m64}. Is this
okay for trunk?
Segher
2018-05-08 Segher Boessenkool <[email protected]>
PR rtl-optimization/85645
* regcprop.c (copyprop_hardreg_forward_1): Don't propagate into an
insn that has a REG_CFA_REGISTER note.
---
gcc/regcprop.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/gcc/regcprop.c b/gcc/regcprop.c
index a664f76..1813242 100644
--- a/gcc/regcprop.c
+++ b/gcc/regcprop.c
@@ -848,6 +848,12 @@ copyprop_hardreg_forward_1 (basic_block bb, struct
value_data *vd)
&& reg_overlap_mentioned_p (XEXP (link, 0), SET_SRC (set)))
set = NULL;
}
+
+ /* We need to keep CFI info correct, and the same on all paths,
+ so we cannot normally replace the registers REG_CFA_REGISTER
+ refers to. Bail. */
+ if (REG_NOTE_KIND (link) == REG_CFA_REGISTER)
+ goto did_replacement;
}
/* Special-case plain move instructions, since we may well
--
1.8.3.1