From 15b78418a419f5f2e4a2e63e205dad8067a39b35 Mon Sep 17 00:00:00 2001 From: Andrea Di Biagio Date: Wed, 27 Mar 2019 15:41:53 +0000 Subject: [PATCH] [MCA][Pipeline] Don't visit stages in reverse order when calling method cycleEnd(). NFCI There is no reason why stages should be visited in reverse order. This patch allows the definition of stages that push instructions forward from their cycleEnd() routine. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357074 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MCA/Pipeline.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/MCA/Pipeline.cpp b/lib/MCA/Pipeline.cpp index 5361f08f154..6860a8caf55 100644 --- a/lib/MCA/Pipeline.cpp +++ b/lib/MCA/Pipeline.cpp @@ -63,9 +63,9 @@ Error Pipeline::runCycle() { Err = FirstStage.execute(IR); // Update stages in preparation for a new cycle. - for (auto I = Stages.rbegin(), E = Stages.rend(); I != E && !Err; ++I) { - const std::unique_ptr &S = *I; - Err = S->cycleEnd(); + for (const std::unique_ptr &S : Stages) { + if (Err = S->cycleEnd()) + break; } return Err; -- 2.50.1