From 725da2858dca122822bb93163e5d1162dbda81f1 Mon Sep 17 00:00:00 2001 From: rain2133 <1370973498@qq.com> Date: Thu, 17 Jul 2025 21:34:19 +0800 Subject: [PATCH] =?UTF-8?q?[IR]=E6=8C=87=E4=BB=A4=E6=9E=84=E9=80=A0?= =?UTF-8?q?=E5=99=A8=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/include/IRBuilder.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/include/IRBuilder.h b/src/include/IRBuilder.h index aab9a1d..6df82e7 100644 --- a/src/include/IRBuilder.h +++ b/src/include/IRBuilder.h @@ -333,15 +333,11 @@ class IRBuilder { block->getInstructions().emplace(position, inst); return inst; } ///< 创建store指令 - PhiInst * createPhiInst(Type *type, Value *lhs, BasicBlock *parent, const std::string &name = "") { - auto predNum = parent->getNumPredecessors(); - std::vector rhs; - for (size_t i = 0; i < predNum; i++) { - rhs.push_back(lhs); - } - auto inst = new PhiInst(type, lhs, rhs, lhs, parent, name); + PhiInst * createPhiInst(Type *type, const std::vector &vals = {}, const std::vector &blks = {}, const std::string &name = "") { + auto predNum = block->getNumPredecessors(); + auto inst = new PhiInst(type, vals, blks, block, name); assert(inst); - parent->getInstructions().emplace(parent->begin(), inst); + block->getInstructions().emplace(block->begin(), inst); return inst; } ///< 创建Phi指令 };