diff mbox series

[4/6] let insert_phis() use insert_last_instruction()

Message ID 20210321161609.45905-5-luc.vanoostenryck@gmail.com (mailing list archive)
State Mainlined, archived
Headers show
Series use an helper to add an instruction to a BB | expand

Commit Message

Luc Van Oostenryck March 21, 2021, 4:16 p.m. UTC
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 linearize.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/linearize.c b/linearize.c
index 4787689b37b8..95fb3b59b90b 100644
--- a/linearize.c
+++ b/linearize.c
@@ -1708,10 +1708,9 @@  static void insert_phis(struct basic_block *bb, pseudo_t src, struct symbol *cty
 	struct basic_block *parent;
 
 	FOR_EACH_PTR(bb->parents, parent) {
-		struct instruction *br = delete_last_instruction(&parent->insns);
-		pseudo_t phi = alloc_phi(parent, src, ctype);
-		add_instruction(&parent->insns, br);
-		link_phi(node, phi);
+		struct instruction *phisrc = alloc_phisrc(src, ctype);
+		insert_last_instruction(parent, phisrc);
+		link_phi(node, phisrc->target);
 	} END_FOR_EACH_PTR(parent);
 }