LRA: side_effects_p stmts' output is not invariant (PR89721)
authorSegher Boessenkool <segher@kernel.crashing.org>
Fri, 15 Mar 2019 22:09:15 +0000 (23:09 +0100)
committerSegher Boessenkool <segher@gcc.gnu.org>
Fri, 15 Mar 2019 22:09:15 +0000 (23:09 +0100)
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

gcc/ChangeLog
gcc/lra-constraints.c

index 55d80e5..67dc0bf 100644 (file)
@@ -1,3 +1,8 @@
+2019-03-15  Segher Boessenkool  <segher@kernel.crashing.org>
+
+       PR rtl-optimization/89721
+       * lra-constraints (invariant_p): Return false if side_effects_p holds.
+
 2019-03-15  Kelvin Nilsen  <kelvin@gcc.gnu.org>
 
        PR target/87532
index d7d69c6..ccca130 100644 (file)
@@ -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)