diff --git a/src/midend/IR.cpp b/src/midend/IR.cpp index 2cc34dc..e434ced 100644 --- a/src/midend/IR.cpp +++ b/src/midend/IR.cpp @@ -233,7 +233,7 @@ Function * Function::clone(const std::string &suffix) const { // } ss << oldAllocInst->getName() << suffix; auto newAllocInst = - new AllocaInst(oldAllocInst->getType(), dims, oldNewBlockMap.at(oldAllocInst->getParent()), ss.str()); + new AllocaInst(oldAllocInst->getType(), oldNewBlockMap.at(oldAllocInst->getParent()), ss.str()); ss.str(""); oldNewValueMap.emplace(oldAllocInst, newAllocInst); if (isAddedToCreate.find(oldAllocInst) == isAddedToCreate.end()) { @@ -259,7 +259,7 @@ Function * Function::clone(const std::string &suffix) const { // } ss << oldAllocInst->getName() << suffix; auto newAllocInst = - new AllocaInst(oldAllocInst->getType(), dims, oldNewBlockMap.at(oldAllocInst->getParent()), ss.str()); + new AllocaInst(oldAllocInst->getType(), oldNewBlockMap.at(oldAllocInst->getParent()), ss.str()); ss.str(""); oldNewValueMap.emplace(oldAllocInst, newAllocInst); if (isAddedToCreate.find(oldAllocInst) == isAddedToCreate.end()) { @@ -486,7 +486,7 @@ Function * Function::clone(const std::string &suffix) const { // for (const auto &index : oldStoreInst->getIndices()) { // newIndices.emplace_back(oldNewValueMap.at(index->getValue())); // } - auto newStoreInst = new StoreInst(newValue, newPointer, newIndices, + auto newStoreInst = new StoreInst(newValue, newPointer, oldNewBlockMap.at(oldStoreInst->getParent()), oldStoreInst->getName()); oldNewValueMap.emplace(oldStoreInst, newStoreInst); break; diff --git a/src/midend/Pass/Optimize/Reg2Mem.cpp b/src/midend/Pass/Optimize/Reg2Mem.cpp index b2034c0..42316a5 100644 --- a/src/midend/Pass/Optimize/Reg2Mem.cpp +++ b/src/midend/Pass/Optimize/Reg2Mem.cpp @@ -74,7 +74,7 @@ void Reg2MemContext::allocateMemoryForSSAValues(Function *func) { // 默认情况下,将所有参数是提升到内存 if (isPromotableToMemory(arg)) { // 参数的类型就是 AllocaInst 需要分配的类型 - AllocaInst *alloca = builder->createAllocaInst(Type::getPointerType(arg->getType()), {}, arg->getName() + ".reg2mem"); + AllocaInst *alloca = builder->createAllocaInst(Type::getPointerType(arg->getType()), arg->getName() + ".reg2mem"); // 将参数值 store 到 alloca 中 (这是 Mem2Reg 逆转的关键一步) valueToAllocaMap[arg] = alloca; @@ -103,7 +103,7 @@ void Reg2MemContext::allocateMemoryForSSAValues(Function *func) { // AllocaInst 应该在入口块,而不是当前指令所在块 // 这里我们只是创建,并稍后调整其位置 // 通常的做法是在循环结束后统一将 alloca 放到 entryBlock 的顶部 - AllocaInst *alloca = builder->createAllocaInst(Type::getPointerType(inst.get()->getType()), {}, inst.get()->getName() + ".reg2mem"); + AllocaInst *alloca = builder->createAllocaInst(Type::getPointerType(inst.get()->getType()), inst.get()->getName() + ".reg2mem"); valueToAllocaMap[inst.get()] = alloca; } } diff --git a/src/midend/Pass/Optimize/SysYIRCFGOpt.cpp b/src/midend/Pass/Optimize/SysYIRCFGOpt.cpp index 94381f4..99c06aa 100644 --- a/src/midend/Pass/Optimize/SysYIRCFGOpt.cpp +++ b/src/midend/Pass/Optimize/SysYIRCFGOpt.cpp @@ -309,7 +309,7 @@ bool SysYCFGOptUtils::SysYDelEmptyBlock(Function *func, IRBuilder* pBuilder) { SysYIROptUtils::usedelete(thelastinst->get()); thelastinst = basicBlock->getInstructions().erase(thelastinst); pBuilder->setPosition(basicBlock.get(), basicBlock->end()); - pBuilder->createUncondBrInst(thebrBlock, {}); + pBuilder->createUncondBrInst(thebrBlock); changed = true; // 标记IR被修改 continue; } @@ -348,7 +348,7 @@ bool SysYCFGOptUtils::SysYDelEmptyBlock(Function *func, IRBuilder* pBuilder) { SysYIROptUtils::usedelete(thelastinst->get()); thelastinst = basicBlock->getInstructions().erase(thelastinst); pBuilder->setPosition(basicBlock.get(), basicBlock->end()); - pBuilder->createUncondBrInst(thebrBlock, {}); + pBuilder->createUncondBrInst(thebrBlock); changed = true; // 标记IR被修改 continue; } @@ -528,7 +528,7 @@ bool SysYCFGOptUtils::SysYCondBr2Br(Function *func, IRBuilder* pBuilder) { if ((constfloat_Use && constfloat == 1.0F) || (constint_Use && constint == 1)) { // cond为true或非0 pBuilder->setPosition(basicblock.get(), basicblock->end()); - pBuilder->createUncondBrInst(thenBlock, {}); + pBuilder->createUncondBrInst(thenBlock); // 更新CFG关系 basicblock->removeSuccessor(elseBlock); @@ -546,7 +546,7 @@ bool SysYCFGOptUtils::SysYCondBr2Br(Function *func, IRBuilder* pBuilder) { } else { // cond为false或0 pBuilder->setPosition(basicblock.get(), basicblock->end()); - pBuilder->createUncondBrInst(elseBlock, {}); + pBuilder->createUncondBrInst(elseBlock); // 更新CFG关系 basicblock->removeSuccessor(thenBlock);