From 6b1c935a1d78919043da641c1c3292078311eaca Mon Sep 17 00:00:00 2001 From: Fred Chow Date: Thu, 13 May 2021 14:45:27 -0700 Subject: [PATCH] Fixed some missed field checks in MeExpr::IsTheSameWorkcand() for issue I3R8IO --- src/mapleall/maple_me/include/me_ir.h | 2 +- src/mapleall/maple_me/src/me_ir.cpp | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/mapleall/maple_me/include/me_ir.h b/src/mapleall/maple_me/include/me_ir.h index dbc62decfe..c9a466d53f 100644 --- a/src/mapleall/maple_me/include/me_ir.h +++ b/src/mapleall/maple_me/include/me_ir.h @@ -814,7 +814,7 @@ class OpMeExpr : public MeExpr { opndType = opndTypeVal; } - uint8 GetBitsOffSet() { + uint8 GetBitsOffSet() const { return bitsOffset; } diff --git a/src/mapleall/maple_me/src/me_ir.cpp b/src/mapleall/maple_me/src/me_ir.cpp index b2b52abe06..f006fb2b67 100644 --- a/src/mapleall/maple_me/src/me_ir.cpp +++ b/src/mapleall/maple_me/src/me_ir.cpp @@ -40,13 +40,17 @@ bool MeExpr::IsTheSameWorkcand(const MeExpr &expr) const { if (GetPrimTypeSize(primType) != GetPrimTypeSize(expr.GetPrimType())) { return false; } - if (op == OP_cvt && primType != expr.GetPrimType()) { - // exclude cvt for different return type - return false; + if (kOpcodeInfo.IsTypeCvt(op) || kOpcodeInfo.IsCompare(op)) { + if (primType != expr.primType || + static_cast(this)->GetOpndType() != static_cast(expr).GetOpndType()) { + return false; + } } - if (op == OP_sext && - static_cast(this)->GetBitsSize() != static_cast(expr).GetBitsSize()) { - return false; + if (op == OP_extractbits || op == OP_depositbits || op == OP_sext || op == OP_zext) { + if (static_cast(this)->GetBitsOffSet() != static_cast(expr).GetBitsOffSet() || + static_cast(this)->GetBitsSize() != static_cast(expr).GetBitsSize()) { + return false; + } } if (op == OP_resolveinterfacefunc || op == OP_resolvevirtualfunc || op == OP_iaddrof) { if (static_cast(this)->GetFieldID() != static_cast(expr).GetFieldID()) { -- Gitee