ira: volatile asm's are not moveable (PR82602)
authorSegher Boessenkool <segher@kernel.crashing.org>
Wed, 18 Oct 2017 21:08:18 +0000 (23:08 +0200)
committerSegher Boessenkool <segher@gcc.gnu.org>
Wed, 18 Oct 2017 21:08:18 +0000 (23:08 +0200)
A volatile asm statement can not be moved (relative to other volatile
asm, etc.), but IRA would do it nevertheless.  This patch fixes it.

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

From-SVN: r253869

gcc/ChangeLog
gcc/ira.c

index 9ddb3fc5724af87459db6e5276e19812bad7ef31..a139a824d35e012b4344c1168c1399fedb9bf029 100644 (file)
@@ -1,3 +1,8 @@
+2017-10-18  Segher Boessenkool  <segher@kernel.crashing.org>
+
+       PR rtl-optimization/82602
+       * ira.c (rtx_moveable_p): Return false for volatile asm.
+
 2017-10-18  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/82580
index 046ce3bc49508145fb205561d4ef270009448685..8c93d3df518e0c2fa7524fa9fd6526c3b164677b 100644 (file)
--- 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;
     }