修复IR打印器中浮点比较指令的类型错误,确保生成正确的LLVM IR代码

This commit is contained in:
2025-08-03 22:23:52 +08:00
parent c8a8bf9a37
commit 0ecd47f0ac

View File

@ -299,7 +299,12 @@ void SysYPrinter::printInst(Instruction *pInst) {
// Types and operands
std::cout << " ";
printType(binInst->getType());
// For comparison operations, print operand types instead of result type
if (pInst->getKind() >= Kind::kICmpEQ && pInst->getKind() <= Kind::kFCmpGE) {
printType(binInst->getLhs()->getType());
} else {
printType(binInst->getType());
}
std::cout << " ";
printValue(binInst->getLhs());
std::cout << ", ";