This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] ira: volatile asm's are not moveable (PR82602)


A volatile asm statement can not be moved (relative to other volatile
asm, etc.), but IRA could do it nevertheless.  This patch fixes it.

Testing on powerpc64-linux {-m32,-m64}; okay if it succeeds?  Also
for backports?


Segher


2017-10-18  Segher Boessenkool  <segher@kernel.crashing.org>

	PR rtl-optimization/82602
	* ira.c (rtx_moveable_p): Return false for volatile asm.

---
 gcc/ira.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gcc/ira.c b/gcc/ira.c
index 046ce3b..8c93d3d 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -4400,6 +4400,12 @@ rtx_moveable_p (rtx *loc, enum op_type type)
 	 for a reason.  */
       return false;
 
+    case ASM_OPERANDS:
+      /* The same is true for volatile asm: it has unknown side effects, it
+         cannot be moved at will.  */
+      if (MEM_VOLATILE_P (x))
+	return false;
+
     default:
       break;
     }
-- 
1.8.3.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]