From a3222e1dd7aa84a87053e08d6c1c35ab1700ed54 Mon Sep 17 00:00:00 2001 From: Fred Chow Date: Thu, 20 May 2021 23:53:14 -0700 Subject: [PATCH] Do not apply backward substitution for agg types <= 16 bytes, because it interferes with cg's struct return optimizaton --- src/mapleall/maple_me/src/hdse.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mapleall/maple_me/src/hdse.cpp b/src/mapleall/maple_me/src/hdse.cpp index 11422e2f38..b21b584bfd 100644 --- a/src/mapleall/maple_me/src/hdse.cpp +++ b/src/mapleall/maple_me/src/hdse.cpp @@ -43,7 +43,12 @@ void HDSE::CheckBackSubsCandidacy(DassignMeStmt *dass) { return; } ScalarMeExpr *lhsscalar = static_cast(dass->GetLHS()); - if (!lhsscalar->GetOst()->IsLocal()) { + OriginalSt *ost = lhsscalar->GetOst(); + if (!ost->IsLocal()) { + return; + } + MIRType *ty = GlobalTables::GetTypeTable().GetTypeFromTyIdx(ost->GetTyIdx()); + if (ty->GetPrimType() == PTY_agg && ty->GetSize() <= 16) { return; } ScalarMeExpr *rhsscalar = static_cast(dass->GetRHS()); -- Gitee