PR89721 shows LRA treating an unspec_volatile's result as invariant, which of course isn't correct. This patch fixes it.
Question. Is side_effects_p the correct check? Or do we want to allow PRE_INC etc. here? What about CALL? Segher 2019-04-15 Segher Boessenkool <seg...@kernel.crashing.org> PR rtl-optimization/89721 * lra-constraints (invariant_p): Return false if side_effects_p holds. --- gcc/lra-constraints.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index afbd5d0..24f11ed 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -5839,6 +5839,9 @@ invariant_p (const_rtx x) enum rtx_code code; int i, j; + if (side_effects_p (x)) + return false; + code = GET_CODE (x); mode = GET_MODE (x); if (code == SUBREG) -- 1.8.3.1