All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Christopher Li <sparse@chrisli.org>,
	Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH 04/16] fix killing of OP_PHIs
Date: Thu, 16 Feb 2017 05:56:56 +0100	[thread overview]
Message-ID: <20170216045708.50661-5-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20170216045708.50661-1-luc.vanoostenryck@gmail.com>

OP_PHIs were killed by calling clear_phi() but this function
only replaces the phi node's sources by VOID without adjusting
the usage of these sources.

Fix this by instead calling kill_use() on each of the sources
via the newly created helper kill_use_list().

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 simplify.c                 | 2 +-
 validation/kill-phi-node.c | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/simplify.c b/simplify.c
index d4e730894..17f1e2b61 100644
--- a/simplify.c
+++ b/simplify.c
@@ -218,7 +218,7 @@ void kill_instruction(struct instruction *insn)
 		break;
 
 	case OP_PHI:
-		clear_phi(insn);
+		kill_use_list(insn->phi_list);
 		break;
 	case OP_PHISOURCE:
 		kill_use(&insn->phi_src);
diff --git a/validation/kill-phi-node.c b/validation/kill-phi-node.c
index 88de9f962..cff62b649 100644
--- a/validation/kill-phi-node.c
+++ b/validation/kill-phi-node.c
@@ -9,6 +9,15 @@ void foo(int a, int *b, unsigned int g)
 		d = 8;
 }
 
+int bar(void);
+int bar(void)
+{
+	int i;
+	for (i = 0; i; i--)
+		;
+	return 0;
+}
+
 /*
  * check-name: kill-phi-node
  * check-command: test-linearize $file
-- 
2.11.0


  parent reply	other threads:[~2017-02-16  4:57 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-16  4:56 [PATCH 00/16] instructions killing & operands usage Luc Van Oostenryck
2017-02-16  4:56 ` [PATCH 01/16] add killing of OP_SLICEs Luc Van Oostenryck
2017-02-16  4:56 ` [PATCH 02/16] add killing of OP_PHISOURCEs Luc Van Oostenryck
2017-02-16  4:56 ` [PATCH 03/16] add helper kill_use_list() Luc Van Oostenryck
2017-02-16  4:56 ` Luc Van Oostenryck [this message]
2017-02-16  4:56 ` [PATCH 05/16] fix clear_phi(), replace it by kill_instruction() Luc Van Oostenryck
2017-02-16  4:56 ` [PATCH 06/16] remove unused clear_phi() Luc Van Oostenryck
2017-02-16  4:56 ` [PATCH 07/16] fix killing of otherwise not-handled instructions Luc Van Oostenryck
2017-02-16  4:57 ` [PATCH 08/16] kill_instruction() may need to be forced or not Luc Van Oostenryck
2017-02-16  4:57 ` [PATCH 09/16] add killing of pure calls Luc Van Oostenryck
2017-02-16  4:57 ` [PATCH 10/16] fix killing OP_CALL via pointers Luc Van Oostenryck
2017-02-16  4:57 ` [PATCH 11/16] add killing of non-volatile loads Luc Van Oostenryck
2017-02-16  4:57 ` [PATCH 12/16] add killing of stores Luc Van Oostenryck
2017-02-16  4:57 ` [PATCH 13/16] fix killing of rewritten loads Luc Van Oostenryck
2017-02-16  4:57 ` [PATCH 14/16] use kill_instruction() when killing an OP_PHI during CSE Luc Van Oostenryck
2017-02-16  4:57 ` [PATCH 15/16] use kill_instruction() when killing any instructions " Luc Van Oostenryck
2017-02-16  4:57 ` [PATCH 16/16] fix OP_PHI usage in try_to_simplify_bb() 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=20170216045708.50661-5-luc.vanoostenryck@gmail.com \
    --to=luc.vanoostenryck@gmail.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=sparse@chrisli.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.