[llvm] 28eef3b - [MCA] Fix crash in `EntryStage::cycleEnd` when there are no instructions.

Clement Courbet via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 2 04:43:40 PST 2023


Author: Clement Courbet
Date: 2023-03-02T13:43:26+01:00
New Revision: 28eef3bd5bc7cf2544df6fd8ab83c67e500b126c

URL: https://github.com/llvm/llvm-project/commit/28eef3bd5bc7cf2544df6fd8ab83c67e500b126c
DIFF: https://github.com/llvm/llvm-project/commit/28eef3bd5bc7cf2544df6fd8ab83c67e500b126c.diff

LOG: [MCA] Fix crash in `EntryStage::cycleEnd` when there are no instructions.

Added: 
    

Modified: 
    llvm/lib/MCA/Stages/EntryStage.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/MCA/Stages/EntryStage.cpp b/llvm/lib/MCA/Stages/EntryStage.cpp
index 6b3fbb8c6236b..5c82ce780478c 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();
   });


        


More information about the llvm-commits mailing list