[PATCH 7/7] kds: fix recursion in kill_dead_stores_bb()

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

 



In kill_dead_stores_bb(), after having scanned the current BB,
we may recurse into the parent BBs. But we must do this only if
we're sure that the store there may not be needed in another BB.
In other words, we must do this only if the current BB is the only
child of the parent.

However, if one of the parent has more than one child, instead
of trying the next parent, the function stops there and returns.
Furthermore, the check is done with an open loop instead of using
the helper bb_list_size().

Fix this by using bb_list_size() to check if the parent has only
one child, do the recursion if it is the case and try the next
parent if not.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 flow.c                          | 7 ++-----
 validation/optim/kill-stores2.c | 1 -
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/flow.c b/flow.c
index 2c685cee6..1dade8dd8 100644
--- a/flow.c
+++ b/flow.c
@@ -598,11 +598,8 @@ static void kill_dead_stores_bb(pseudo_t pseudo, unsigned long generation, struc
 	} END_FOR_EACH_PTR_REVERSE(insn);
 
 	FOR_EACH_PTR(bb->parents, parent) {
-		struct basic_block *child;
-		FOR_EACH_PTR(parent->children, child) {
-			if (child && child != bb)
-				return;
-		} END_FOR_EACH_PTR(child);
+		if (bb_list_size(parent->children) > 1)
+			continue;
 		kill_dead_stores_bb(pseudo, generation, parent, local);
 	} END_FOR_EACH_PTR(parent);
 }
diff --git a/validation/optim/kill-stores2.c b/validation/optim/kill-stores2.c
index 692888489..861b5ece0 100644
--- a/validation/optim/kill-stores2.c
+++ b/validation/optim/kill-stores2.c
@@ -11,7 +11,6 @@ static void foo(void)
 /*
  * check-name: kill-stores2
  * check-command: test-linearize $file
- * check-known-to-fail
  *
  * check-output-ignore
  * check-output-excludes: store\\.
-- 
2.16.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