linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH 1/5] add testcases for stores simplifications
Date: Sun, 11 Apr 2021 00:30:40 +0200	[thread overview]
Message-ID: <20210410223044.86100-2-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20210410223044.86100-1-luc.vanoostenryck@gmail.com>

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 validation/memops/kill-dead-store-parent0.c | 15 ++++++++++++
 validation/memops/kill-dead-store-parent2.c | 26 +++++++++++++++++++++
 validation/memops/kill-redundant-store0.c   | 14 +++++++++++
 3 files changed, 55 insertions(+)
 create mode 100644 validation/memops/kill-dead-store-parent0.c
 create mode 100644 validation/memops/kill-dead-store-parent2.c
 create mode 100644 validation/memops/kill-redundant-store0.c

diff --git a/validation/memops/kill-dead-store-parent0.c b/validation/memops/kill-dead-store-parent0.c
new file mode 100644
index 000000000000..1413134b8c23
--- /dev/null
+++ b/validation/memops/kill-dead-store-parent0.c
@@ -0,0 +1,15 @@
+void foo(int *ptr, int p)
+{
+	if (p)
+		*ptr = 1;
+	*ptr = 0;
+}
+
+/*
+ * check-name: kill-dead-store-parent0
+ * check-command: test-linearize -Wno-decl $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-pattern(1): store
+ */
diff --git a/validation/memops/kill-dead-store-parent2.c b/validation/memops/kill-dead-store-parent2.c
new file mode 100644
index 000000000000..b563fd31b669
--- /dev/null
+++ b/validation/memops/kill-dead-store-parent2.c
@@ -0,0 +1,26 @@
+int ladder02(int *ptr, int p, int x)
+{
+	*ptr = x++;
+	if (p)
+		goto l11;
+	else
+		goto l12;
+l11:
+	*ptr = x++;
+	goto l20;
+l12:
+	*ptr = x++;
+	goto l20;
+l20:
+	*ptr = x++;
+	return *ptr;
+}
+
+/*
+ * check-name: kill-dead-store-parent2
+ * check-command: test-linearize -Wno-decl $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-pattern(1): store
+ */
diff --git a/validation/memops/kill-redundant-store0.c b/validation/memops/kill-redundant-store0.c
new file mode 100644
index 000000000000..e911166dd953
--- /dev/null
+++ b/validation/memops/kill-redundant-store0.c
@@ -0,0 +1,14 @@
+void foo(int *ptr)
+{
+	int i = *ptr;
+	*ptr = i;
+}
+
+/*
+ * check-name: kill-redundant-store0
+ * check-command: test-linearize -Wno-decl $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-excludes: store
+ */
-- 
2.31.1


  reply	other threads:[~2021-04-10 22:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-10 22:30 [PATCH 0/5] kill more dead stores Luc Van Oostenryck
2021-04-10 22:30 ` Luc Van Oostenryck [this message]
2021-04-10 22:30 ` [PATCH 2/5] extract try_to_kill_store() from kill_dominated_stores() Luc Van Oostenryck
2021-04-10 22:30 ` [PATCH 3/5] volatile stores are never dead Luc Van Oostenryck
2021-04-10 22:30 ` [PATCH 4/5] kill parent's dead stores too Luc Van Oostenryck
2021-04-10 22:30 ` [PATCH 5/5] kill redundant stores (local) Luc Van Oostenryck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210410223044.86100-2-luc.vanoostenryck@gmail.com \
    --to=luc.vanoostenryck@gmail.com \
    --cc=linux-sparse@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).