[PATCH 04/16] fix killing of OP_PHIs

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

 



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@xxxxxxxxx>
---
 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

--
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