aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MCA
diff options
context:
space:
mode:
authorClement Courbet <courbet@google.com>2023-03-02 13:34:43 +0100
committerClement Courbet <courbet@google.com>2023-03-02 13:43:26 +0100
commit28eef3bd5bc7cf2544df6fd8ab83c67e500b126c (patch)
treea5b55841e196b10fde05b25a3193ae7a15d8a224 /llvm/lib/MCA
parent948ed21f1251f2ca1456057d5289b4c29c8d7aad (diff)
downloadllvm-28eef3bd5bc7cf2544df6fd8ab83c67e500b126c.zip
llvm-28eef3bd5bc7cf2544df6fd8ab83c67e500b126c.tar.gz
llvm-28eef3bd5bc7cf2544df6fd8ab83c67e500b126c.tar.bz2
[MCA] Fix crash in `EntryStage::cycleEnd` when there are no instructions.
Diffstat (limited to 'llvm/lib/MCA')
-rw-r--r--llvm/lib/MCA/Stages/EntryStage.cpp3
1 files changed, 2 insertions, 1 deletions
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<Instruction> &I) {
return !I->isRetired();
});