From c7c658a4e04f09fb31da9f4c143bbad9ecc82320 Mon Sep 17 00:00:00 2001 From: Andrey Efremov Date: Wed, 14 Aug 2024 21:01:23 +0800 Subject: [PATCH] Remove for..break in cse.cpp Issue: https://gitee.com/openharmony/arkcompiler_runtime_core/issues/IAK2YK Signed-off-by: Andrey Efremov --- .../compiler/optimizer/optimizations/cse.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/static_core/compiler/optimizer/optimizations/cse.cpp b/static_core/compiler/optimizer/optimizations/cse.cpp index 9b004fb7e1..72bb3c2925 100644 --- a/static_core/compiler/optimizer/optimizations/cse.cpp +++ b/static_core/compiler/optimizer/optimizations/cse.cpp @@ -207,14 +207,13 @@ void Cse::GlobalCse() } Exp exp = NotIn(sameExpPair_, GetExp(inst)) ? GetExpCommutative(inst) : GetExp(inst); auto &pair = sameExpPair_.find(exp)->second; - for (auto instl : pair.first) { - // If one decides to enable Cse in OSR mode then - // ensure that inst's basic block is not OsrEntry. - deletedInsts_.emplace_back(inst); - auto lrpair = std::make_pair(instl, *(pair.second.begin())); - matchedTuple_.emplace_back(inst, std::move(lrpair)); - break; - } + ASSERT(!pair.first.empty()); + auto instl = *pair.first.begin(); + // If one decides to enable Cse in OSR mode then + // ensure that inst's basic block is not OsrEntry. + deletedInsts_.emplace_back(inst); + auto lrpair = std::make_pair(instl, *(pair.second.begin())); + matchedTuple_.emplace_back(inst, std::move(lrpair)); } } // Add phi instruction -- Gitee