diff --git a/src/ir/passes/LoopUnroll.cpp b/src/ir/passes/LoopUnroll.cpp index 21ec1dc1..8c1fceb4 100644 --- a/src/ir/passes/LoopUnroll.cpp +++ b/src/ir/passes/LoopUnroll.cpp @@ -122,6 +122,11 @@ static std::unique_ptr CloneInstruction( return std::make_unique(op, inst->GetType(), map(cast->GetOperandValue()), ctx.NextTemp()); } + case Opcode::SIToFP: case Opcode::FPToSI: { + auto* cast = static_cast(inst); + return std::make_unique(op, inst->GetType(), + map(cast->GetOperandValue()), ctx.NextTemp()); + } case Opcode::Br: { auto* br = static_cast(inst); return std::make_unique(inst->GetType(), br->GetTarget()); @@ -223,6 +228,8 @@ void RunLoopUnroll(Module& module) { int unrolled = 0; for (auto& func : module.GetFunctions()) { if (func->IsExternal()) continue; + // 只处理 i32 返回值函数(float 循环体含不支持克隆的操作) + if (!func->GetType()->IsInt32()) continue; bool changed = true; while (changed) { changed = false;