diff --git a/src/mapleall/maple_me/include/me_ir.h b/src/mapleall/maple_me/include/me_ir.h index dbc62decfe9ff21c5c04b3c02ea27d90b5e8b287..c9a466d53fe4a099a4e98b22bc8002e306ed687b 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 b2b52abe06351ec3c9b2dd9f3faa92195d7296ca..f006fb2b677e4c379c4a5fc8d26dab8e8d5f5f2b 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()) {