diff --git a/src/mapleall/maple_be/src/cg/aarch64/aarch64_cgfunc.cpp b/src/mapleall/maple_be/src/cg/aarch64/aarch64_cgfunc.cpp index bbc327e9fa3089a173d8c567d8958e669ff58600..d5f2eaf5ae71dca8bd5f56087bf3a95e01a6584e 100644 --- a/src/mapleall/maple_be/src/cg/aarch64/aarch64_cgfunc.cpp +++ b/src/mapleall/maple_be/src/cg/aarch64/aarch64_cgfunc.cpp @@ -1418,8 +1418,11 @@ void AArch64CGFunc::SelectRegassign(RegassignNode &stmt, Operand &opnd0) { ASSERT(regOpnd != nullptr, "null ptr check!"); SelectCopy(*regOpnd, dtype, opnd0, rhsType); if (GetCG()->GenerateVerboseCG()) { - GetCurBB()->GetLastInsn()->AppendComment(" regassign %" + std::to_string(pregIdx)); - GetCurBB()->GetLastInsn()->AppendComment("; "); + if (GetCurBB()->GetLastInsn()) { + GetCurBB()->GetLastInsn()->AppendComment(" regassign %" + std::to_string(pregIdx) + "; "); + } else if (GetCurBB()->GetPrev()->GetLastInsn()) { + GetCurBB()->GetPrev()->GetLastInsn()->AppendComment(" regassign %" + std::to_string(pregIdx) + "; "); + } } if ((Globals::GetInstance()->GetOptimLevel() == 0) && (pregIdx >= 0)) {