From 57c0f78e03a587a4b30aeb7f5730941cae9a5de2 Mon Sep 17 00:00:00 2001 From: Fred Chow Date: Wed, 5 Jan 2022 14:11:15 -0800 Subject: [PATCH] ivcanon screens out global vars as IV Suppressed an overflow assertion with debug compiler in me_ivopts.cpp --- src/mapleall/maple_me/src/lfo_iv_canon.cpp | 3 +++ src/mapleall/maple_me/src/me_ivopts.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mapleall/maple_me/src/lfo_iv_canon.cpp b/src/mapleall/maple_me/src/lfo_iv_canon.cpp index 6cdd31727a..fed13132b7 100644 --- a/src/mapleall/maple_me/src/lfo_iv_canon.cpp +++ b/src/mapleall/maple_me/src/lfo_iv_canon.cpp @@ -40,6 +40,9 @@ bool IVCanon::ResolveExprValue(MeExpr *x, ScalarMeExpr *phiLHS) { return true; } ScalarMeExpr *scalar = static_cast(x); + if (!scalar->GetOst()->IsLocal() || scalar->GetOst()->IsAddressTaken()) { + return false; + } if (scalar->GetDefBy() != kDefByStmt) { return false; } diff --git a/src/mapleall/maple_me/src/me_ivopts.cpp b/src/mapleall/maple_me/src/me_ivopts.cpp index 84d3615592..3dab05df7e 100644 --- a/src/mapleall/maple_me/src/me_ivopts.cpp +++ b/src/mapleall/maple_me/src/me_ivopts.cpp @@ -1432,7 +1432,7 @@ MeExpr *IVOptimizer::ComputeExtraExprOfBase(MeExpr &candBase, MeExpr &groupBase, for (auto &itCand : candMap) { auto itGroup = groupMap.find(itCand.first); if (itCand.first == kInvalidExprID) { - candConst = itCand.second.second * ratio; + candConst = (uint64)itCand.second.second * ratio; groupConst = itGroup == groupMap.end() ? 0 : itGroup->second.second; continue; } -- Gitee