[PATCH] do not call simplify_instruction() if already removed

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

 



simplify_instruction() is called on every instructions, even
those already removed. It's useless (and annoying when debugging).

So, filter out removed instructions before calling simplify_instruction().

Fixes: c5ba883e6ac47381f8112ed33f22a931a79ac517
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 optimize.c | 2 ++
 simplify.c | 3 ---
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/optimize.c b/optimize.c
index 31d94e6158ef..bfab74c01b62 100644
--- a/optimize.c
+++ b/optimize.c
@@ -34,6 +34,8 @@ static void clean_up_insns(struct entrypoint *ep)
 	FOR_EACH_PTR(ep->bbs, bb) {
 		struct instruction *insn;
 		FOR_EACH_PTR(bb->insns, insn) {
+			if (!insn->bb)
+				continue;
 			repeat_phase |= simplify_instruction(insn);
 			if (!insn->bb)
 				continue;
diff --git a/simplify.c b/simplify.c
index f2aaa52de84b..ba63f28a3231 100644
--- a/simplify.c
+++ b/simplify.c
@@ -1916,9 +1916,6 @@ int simplify_instruction(struct instruction *insn)
 	unsigned flags;
 	int changed = 0;
 
-	if (!insn->bb)
-		return 0;
-
 	flags = opcode_table[insn->opcode].flags;
 	if (flags & OPF_TARGET) {
 		if (!has_users(insn->target))
-- 
2.29.2




[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