[PATCH] fix: try_to_simplify_bb eargerness part 2

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

 



This is a temptative patch for the wine infinitive loop.
---
 flow.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/flow.c b/flow.c
index d8198ce8d..fe16d78d4 100644
--- a/flow.c
+++ b/flow.c
@@ -79,6 +79,19 @@ static int bb_depends_on(struct basic_block *target, struct basic_block *src)
 	return 0;
 }
 
+/*
+ * This is only to be used by try_to_simplify_bb().
+ * It really should be handled by bb_depends_on(), only
+ * that there is no liveness done on OP_PHI/OP_PHISRC.
+ * bb_depends_on() should return true if a phi
+ * is defined by src and used by target but it doesn't.
+ * So for now we add the explicit check.
+ */
+static int bb_uses_phi(struct basic_block *target, pseudo_t phi)
+{
+	return pseudo_in_list(target->needs, phi);
+}
+
 /*
  * This is only to be used by try_to_simplify_bb().
  * It really should be handled by bb_depends_on(), only
@@ -152,6 +165,8 @@ static int try_to_simplify_bb(struct basic_block *bb, struct instruction *first,
 		target = true ? second->bb_true : second->bb_false;
 		if (bb_depends_on(target, bb))
 			continue;
+		if (bb_uses_phi(target, first->target))
+			continue;
 		if (bb_defines_phi(bb, first))
 			continue;
 		changed |= rewrite_branch(source, &br->bb_true, bb, target);
-- 
2.13.2

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