[PATCH 03/13] remove insert_branch() redundant arg

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

 



insert_branch()'s first argument must be the BB of the instruction
given in the second argument.

So, remove it from the argument and simply use insn->bb instead.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 flow.c      | 2 +-
 linearize.c | 3 ++-
 linearize.h | 2 +-
 simplify.c  | 8 ++++----
 4 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/flow.c b/flow.c
index 6d77453a3554..f85c2a30c3cb 100644
--- a/flow.c
+++ b/flow.c
@@ -268,7 +268,7 @@ try_to_rewrite_target:
 	 */
 	if (bb_list_size(target->parents) != 1)
 		return retval;
-	insert_branch(target, insn, final);
+	insert_branch(insn, final);
 	return 1;
 }
 
diff --git a/linearize.c b/linearize.c
index 7248fa56b2ef..ebb03217c9d9 100644
--- a/linearize.c
+++ b/linearize.c
@@ -700,8 +700,9 @@ static void remove_parent(struct basic_block *child, struct basic_block *parent)
 }
 
 /* Change a "switch" or a conditional branch into a branch */
-void insert_branch(struct basic_block *bb, struct instruction *jmp, struct basic_block *target)
+void insert_branch(struct instruction *jmp, struct basic_block *target)
 {
+	struct basic_block *bb = jmp->bb;
 	struct instruction *br, *old;
 	struct basic_block *child;
 
diff --git a/linearize.h b/linearize.h
index 7909b01f29c5..1bb9d77eba1f 100644
--- a/linearize.h
+++ b/linearize.h
@@ -319,7 +319,7 @@ struct entrypoint {
 };
 
 extern void insert_select(struct basic_block *bb, struct instruction *br, struct instruction *phi, pseudo_t if_true, pseudo_t if_false);
-extern void insert_branch(struct basic_block *bb, struct instruction *br, struct basic_block *target);
+extern void insert_branch(struct instruction *br, struct basic_block *target);
 
 struct instruction *alloc_phisrc(pseudo_t pseudo, struct symbol *type);
 struct instruction *alloc_phi_node(struct basic_block *bb, struct symbol *type, struct ident *ident);
diff --git a/simplify.c b/simplify.c
index 207af8edf28f..930c0fa7e83f 100644
--- a/simplify.c
+++ b/simplify.c
@@ -2441,7 +2441,7 @@ static int simplify_branch(struct instruction *insn)
 
 	/* Constant conditional */
 	if (constant(cond)) {
-		insert_branch(insn->bb, insn, cond->value ? insn->bb_true : insn->bb_false);
+		insert_branch(insn, cond->value ? insn->bb_true : insn->bb_false);
 		return REPEAT_CSE;
 	}
 
@@ -2473,11 +2473,11 @@ static int simplify_branch(struct instruction *insn)
 				long long val1 = def->src2->value;
 				long long val2 = def->src3->value;
 				if (!val1 && !val2) {
-					insert_branch(insn->bb, insn, insn->bb_false);
+					insert_branch(insn, insn->bb_false);
 					return REPEAT_CSE;
 				}
 				if (val1 && val2) {
-					insert_branch(insn->bb, insn, insn->bb_true);
+					insert_branch(insn, insn->bb_true);
 					return REPEAT_CSE;
 				}
 				if (val2) {
@@ -2515,7 +2515,7 @@ static int simplify_switch(struct instruction *insn)
 	return 0;
 
 found:
-	insert_branch(insn->bb, insn, jmp->target);
+	insert_branch(insn, jmp->target);
 	return REPEAT_CSE;
 }
 
-- 
2.31.0




[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