From: Andrea Di Biagio Date: Wed, 27 Mar 2019 15:41:53 +0000 (+0000) Subject: [MCA][Pipeline] Don't visit stages in reverse order when calling method cycleEnd... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=15b78418a419f5f2e4a2e63e205dad8067a39b35;p=llvm [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 --- 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;