[PATCH 3/8] optim: kill unreachable BBS after CFG simplification

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

 



Normal instruction simplification & CSE must not be done
on dead block (otherwise it's possible to have unsound
situations like having an instruction defining its own
operand with possible infinite loops as consequence).
This is insured by the main optimization loop but not after
BB packing or flow simplification.

Fix this by calling kill_unreachabe_bbs() after BB packing
and flow simplification.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 optimize.c                   | 4 ++++
 validation/optim/dup-cond0.c | 1 -
 validation/optim/phi-ret.c   | 1 -
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/optimize.c b/optimize.c
index 10b33f548..33ed81986 100644
--- a/optimize.c
+++ b/optimize.c
@@ -80,6 +80,8 @@ repeat:
 				simplify_memops(ep);
 		} while (repeat_phase & REPEAT_CSE);
 		pack_basic_blocks(ep);
+		if (repeat_phase & REPEAT_CFG_CLEANUP)
+			kill_unreachable_bbs(ep);
 	} while (repeat_phase & REPEAT_CSE);
 
 	kill_unreachable_bbs(ep);
@@ -99,6 +101,8 @@ repeat:
 	 */
 	if (simplify_flow(ep)) {
 		clear_liveness(ep);
+		if (repeat_phase & REPEAT_CFG_CLEANUP)
+			kill_unreachable_bbs(ep);
 		goto repeat;
 	}
 
diff --git a/validation/optim/dup-cond0.c b/validation/optim/dup-cond0.c
index dc4991cb0..0525250c7 100644
--- a/validation/optim/dup-cond0.c
+++ b/validation/optim/dup-cond0.c
@@ -13,7 +13,6 @@ static int foo(struct s *s)
 /*
  * check-name: dup-cond0
  * check-command: test-linearize -Wno-decl $file
- * check-known-to-fail
  *
  * check-output-ignore
  * check-output-contains: select
diff --git a/validation/optim/phi-ret.c b/validation/optim/phi-ret.c
index 204366a90..bc3e04749 100644
--- a/validation/optim/phi-ret.c
+++ b/validation/optim/phi-ret.c
@@ -15,7 +15,6 @@ int foo(int p, int q, int v)
 /*
  * check-name: phi-ret
  * check-command: test-linearize -Wno-decl $file
- * check-known-to-fail
  *
  * check-output-ignore
  * check-output-excludes: phi\\.
-- 
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