This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] LRA: side_effects_p stmts' output is not invariant (PR89721)
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Segher Boessenkool <segher at kernel dot crashing dot org>, Vladimir Makarov <vmakarov at redhat dot com>
- Date: Fri, 15 Mar 2019 18:30:25 +0000
- Subject: [PATCH] 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.
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 <segher@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