From cae1f6c63cada3ec20c9e1ab2cd54e106604e05a Mon Sep 17 00:00:00 2001 From: Fred Chow Date: Thu, 10 Mar 2022 20:16:54 -0800 Subject: [PATCH] Use IsNoCvtNeeded() instead of == to check for whether CVT needs to be added --- src/mapleall/mpl2mpl/src/constantfold.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mapleall/mpl2mpl/src/constantfold.cpp b/src/mapleall/mpl2mpl/src/constantfold.cpp index 7fb0bbb400..6d38afb1c7 100644 --- a/src/mapleall/mpl2mpl/src/constantfold.cpp +++ b/src/mapleall/mpl2mpl/src/constantfold.cpp @@ -1709,7 +1709,7 @@ std::pair ConstantFold::FoldBinary(BinaryNode *node) { result = NewBinaryNode(node, op, primType, l, PairToExpr(rPrimTypes, rp)); sum = 0; } - if (result->GetPrimType() != primType) { + if (!IsNoCvtNeeded(result->GetPrimType(), primType)) { result = mirModule->CurFuncCodeMemPool()->New(OP_cvt, primType, result->GetPrimType(), result); } } else if (rConst != nullptr && isInt) { @@ -1799,7 +1799,7 @@ std::pair ConstantFold::FoldBinary(BinaryNode *node) { result = NewBinaryNode(node, op, primType, PairToExpr(lPrimTypes, lp), r); sum = 0; } - if (result->GetPrimType() != primType) { + if (!IsNoCvtNeeded(result->GetPrimType(), primType)) { result = mirModule->CurFuncCodeMemPool()->New(OP_cvt, primType, result->GetPrimType(), result); } } else if (isInt && (op == OP_add || op == OP_sub)) { -- Gitee