[PATCH 2/2] fix: volatile stores must not be simplified

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



kill_dominated_stores() simplify away redundant stores.
Nice but volatile stores are never redundant and must
never be simplified away.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 memops.c                     | 6 +++++-
 validation/memops-volatile.c | 1 -
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/memops.c b/memops.c
index aeacdf566..1c845a5f9 100644
--- a/memops.c
+++ b/memops.c
@@ -158,8 +158,12 @@ static void kill_dominated_stores(struct basic_block *bb)
 		if (insn->opcode == OP_STORE) {
 			struct instruction *dom;
 			pseudo_t pseudo = insn->src;
-			int local = local_pseudo(pseudo);
+			int local;
+
+			if (insn->type->ctype.modifiers & MOD_VOLATILE)
+				continue;
 
+			local = local_pseudo(pseudo);
 			RECURSE_PTR_REVERSE(insn, dom) {
 				int dominance;
 				if (!dom->bb)
diff --git a/validation/memops-volatile.c b/validation/memops-volatile.c
index 71299f49d..15314e1ce 100644
--- a/validation/memops-volatile.c
+++ b/validation/memops-volatile.c
@@ -9,7 +9,6 @@ static int foo(volatile int *a, int v)
  * check-name: memops-volatile
  * check-command: test-linearize $file
  *
- * check-known-to-fail
  * check-output-ignore
  * check-output-contains: store\\..*%arg2 -> 0\\[%arg1]
  * check-output-contains: store\\..*\\$0 -> 0\\[%arg1]
-- 
2.14.0

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux