diff mbox series

[committed] d: Always set ASM_VOLATILE_P on asm statements (PR94425)

Message ID 20200407074514.19090-1-ibuclaw@gdcproject.org
State New
Headers show
Series [committed] d: Always set ASM_VOLATILE_P on asm statements (PR94425) | expand

Commit Message

Li, Pan2 via Gcc-patches April 7, 2020, 7:45 a.m. UTC
Hi,

This patch removes the special treatment of 'asm pure' blocks, as the
need for code correctness outweighs the need for optimization around
these statements.

Bootstrapped and regression tested on x86_64-linux-gnu. Committed to
mainline.

Regards
Iain.

---
gcc/d/ChangeLog:

	* toir.cc (IRVisitor::visit (GccAsmStatement *)): Set ASM_VOLATILE_P
	on all asm statements.

---
 gcc/d/toir.cc   | 5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/gcc/d/toir.cc b/gcc/d/toir.cc
index 21e31dc93d4..6aaf10bf4e4 100644
--- a/gcc/d/toir.cc
+++ b/gcc/d/toir.cc
@@ -1427,8 +1427,9 @@  public:
     if (s->args == NULL && s->clobbers == NULL)
       ASM_INPUT_P (exp) = 1;
 
-    /* Asm statements are treated as volatile unless 'pure'.  */
-    ASM_VOLATILE_P (exp) = !(s->stc & STCpure);
+    /* All asm statements are assumed to have a side effect.  As a future
+       optimization, this could be unset when building in release mode.  */
+    ASM_VOLATILE_P (exp) = 1;
 
     add_stmt (exp);
   }