From 28eef3bd5bc7cf2544df6fd8ab83c67e500b126c Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Thu, 2 Mar 2023 13:34:43 +0100 Subject: [PATCH] [MCA] Fix crash in `EntryStage::cycleEnd` when there are no instructions. --- llvm/lib/MCA/Stages/EntryStage.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/llvm/lib/MCA/Stages/EntryStage.cpp b/llvm/lib/MCA/Stages/EntryStage.cpp index 6b3fbb8..5c82ce7 100644 --- a/llvm/lib/MCA/Stages/EntryStage.cpp +++ b/llvm/lib/MCA/Stages/EntryStage.cpp @@ -67,7 +67,8 @@ llvm::Error EntryStage::cycleResume() { llvm::Error EntryStage::cycleEnd() { // Find the first instruction which hasn't been retired. - auto Range = make_range(&Instructions[NumRetired], Instructions.end()); + auto Range = + make_range(Instructions.begin() + NumRetired, Instructions.end()); auto It = find_if(Range, [](const std::unique_ptr &I) { return !I->isRetired(); }); -- 2.7.4