diff --git a/src/mapleall/maple_me/src/alias_class.cpp b/src/mapleall/maple_me/src/alias_class.cpp index dffbafc1f167946fe43c475642355d02a373235f..ab5fa2b9b2d0976cf591431e90bb7d72dd7b0890 100644 --- a/src/mapleall/maple_me/src/alias_class.cpp +++ b/src/mapleall/maple_me/src/alias_class.cpp @@ -579,6 +579,9 @@ void AliasClass::SetPtrOpndNextLevNADS(const BaseNode &opnd, AliasElem *aliasEle !(opnd.GetOpCode() == OP_addrof && IsReadOnlyOst(aliasElem->GetOriginalSt()))) { aliasElem->SetNextLevNotAllDefsSeen(true); } + if (opnd.GetOpCode() == OP_cvt) { + SetPtrOpndNextLevNADS(*opnd.Opnd(0), aliasElem, hasNoPrivateDefEffect); + } } // Set aliasElem of the pointer-type opnds of a call as next_level_not_all_defines_seen @@ -1804,7 +1807,11 @@ void AliasClass::CollectMayUseForCallOpnd(const StmtNode &stmt, std::setGetPrimType(), &mirModule)) { - continue; + if (expr->GetOpCode() != OP_cvt) { + continue; + } else if (!IsPotentialAddress(static_cast(expr)->FromType(), &mirModule)) { + continue; + } } AliasInfo aInfo = CreateAliasElemsExpr(*expr); diff --git a/src/mapleall/maple_me/src/me_emit.cpp b/src/mapleall/maple_me/src/me_emit.cpp index f1f4a514836c199239222710582dc7c374a9ddbb..2bea5377a98269124d897cd1cb3531196bd8ec44 100644 --- a/src/mapleall/maple_me/src/me_emit.cpp +++ b/src/mapleall/maple_me/src/me_emit.cpp @@ -53,8 +53,9 @@ AnalysisResult *MeDoEmit::Run(MeFunction *func, MeFuncResultMgr *m, ModuleResult // emit from mir function body func->EmitBeforeHSSA((*(func->GetMirFunc())), func->GetLaidOutBBs()); } - if (!DEBUGFUNC(func)) { - // constantfolding does not update BB's stmtNodeList, which breaks MirCFG::DumpToFile() + if (!DEBUGFUNC(func) && func->GetIRMap()) { + // constantfolding does not update BB's stmtNodeList, which breaks MirCFG::DumpToFile(); + // constantfolding also cannot work on SSANode's ConstantFold cf(func->GetMIRModule()); cf.Simplify(func->GetMirFunc()->GetBody()); } diff --git a/src/mapleall/maple_me/src/me_rename2preg.cpp b/src/mapleall/maple_me/src/me_rename2preg.cpp index 7cbfa34344452b2b8ba8b750596482befa1e6c31..d8cace24e1dc3f1a009652a8c621f66fc9f46fe1 100644 --- a/src/mapleall/maple_me/src/me_rename2preg.cpp +++ b/src/mapleall/maple_me/src/me_rename2preg.cpp @@ -88,6 +88,9 @@ RegMeExpr *SSARename2Preg::RenameVar(const VarMeExpr *varmeexpr) { if (!mirst->IsLocal() || mirst->GetStorageClass() == kScPstatic || mirst->GetStorageClass() == kScFstatic) { return nullptr; } + if (ost->IsAddressTaken()) { + return nullptr; + } RegMeExpr *curtemp = nullptr; MIRType *ty = GlobalTables::GetTypeTable().GetTypeFromTyIdx(ost->GetTyIdx());