From 6568a2218674808570a0de5303eb85894cb661a1 Mon Sep 17 00:00:00 2001 From: William Chen Date: Mon, 13 Dec 2021 08:59:41 -0800 Subject: [PATCH] Fix ebo for defuse opnd where number of opnds might be less --- src/mapleall/maple_be/src/cg/ebo.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mapleall/maple_be/src/cg/ebo.cpp b/src/mapleall/maple_be/src/cg/ebo.cpp index e51bbe51a8..f1df8b98ae 100644 --- a/src/mapleall/maple_be/src/cg/ebo.cpp +++ b/src/mapleall/maple_be/src/cg/ebo.cpp @@ -673,8 +673,8 @@ void Ebo::SimplifyInsn(Insn &insn, bool &insnReplaced, bool opndsConstant, /* special case */ if (insn.GetResultNum() > 0 && ResIsNotDefAndUse(insn)) { if ((opndNum == 2) && (insn.GetResultNum() == 1) && - (((opnds[kInsnSecondOpnd] != nullptr) && opnds[kInsnSecondOpnd]->IsConstant()) || - ((opnds[kInsnThirdOpnd] != nullptr) && opnds[kInsnThirdOpnd]->IsConstant()))) { + (((kInsnSecondOpnd < opnds.size()) && (opnds[kInsnSecondOpnd] != nullptr) && opnds[kInsnSecondOpnd]->IsConstant()) || + ((kInsnThirdOpnd < opnds.size()) && (opnds[kInsnThirdOpnd] != nullptr) && opnds[kInsnThirdOpnd]->IsConstant()))) { insnReplaced = SimplifyConstOperand(insn, opnds, opndInfos); } } -- Gitee