From: Segher Boessenkool Date: Fri, 15 Mar 2019 22:09:15 +0000 (+0100) Subject: LRA: side_effects_p stmts' output is not invariant (PR89721) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=850b8aa3091a2c62200bde93fc61101e4dec45b6;p=gcc.git LRA: side_effects_p stmts' output is not invariant (PR89721) PR89721 shows LRA treating an unspec_volatile's result as invariant, which of course isn't correct. This patch fixes it. PR rtl-optimization/89721 * lra-constraints (invariant_p): Return false if side_effects_p holds. From-SVN: r269716 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 55d80e56367..67dc0bfdbb6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2019-03-15 Segher Boessenkool + + PR rtl-optimization/89721 + * lra-constraints (invariant_p): Return false if side_effects_p holds. + 2019-03-15 Kelvin Nilsen PR target/87532 diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index d7d69c6ba50..ccca1303ec2 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)