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指令 };