diff --git a/src/mapleall/maple_be/src/cg/aarch64/aarch64_ico.cpp b/src/mapleall/maple_be/src/cg/aarch64/aarch64_ico.cpp index 2bd3637ccb9ffae7cb24202a4464b35e1ff61029..64c6bd05ddc52525f99aeb278bc10f1609fda14b 100644 --- a/src/mapleall/maple_be/src/cg/aarch64/aarch64_ico.cpp +++ b/src/mapleall/maple_be/src/cg/aarch64/aarch64_ico.cpp @@ -721,6 +721,8 @@ bool AArch64ICOMorePredsPattern::Optimize(BB &curBB) { return false; } } + Insn *gotoBr = curBB.GetLastMachineInsn(); + auto &gotoLabel = static_cast(gotoBr->GetOperand(gotoBr->GetOperandSize() - 1)); for (BB *preBB : curBB.GetPreds()) { Insn *condBr = cgFunc->GetTheCFG()->FindLastCondBrInsn(*preBB); ASSERT(condBr != nullptr, "nullptr check"); @@ -730,6 +732,10 @@ bool AArch64ICOMorePredsPattern::Optimize(BB &curBB) { if (labelOpnd.GetLabelIndex() != curBB.GetLabIdx()) { return false; } + if (gotoLabel.GetLabelIndex() != preBB->GetNext()->GetLabIdx()) { + /* do not if convert if 'else' clause present */ + return false; + } } return DoOpt(curBB); }