[llvm] r357074 - [MCA][Pipeline] Don't visit stages in reverse order when calling method cycleEnd(). NFCI

Andrea Di Biagio via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 27 08:41:53 PDT 2019


Author: adibiagio
Date: Wed Mar 27 08:41:53 2019
New Revision: 357074

URL: http://llvm.org/viewvc/llvm-project?rev=357074&view=rev
Log:
[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.

Modified:
    llvm/trunk/lib/MCA/Pipeline.cpp

Modified: llvm/trunk/lib/MCA/Pipeline.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MCA/Pipeline.cpp?rev=357074&r1=357073&r2=357074&view=diff
==============================================================================
--- llvm/trunk/lib/MCA/Pipeline.cpp (original)
+++ llvm/trunk/lib/MCA/Pipeline.cpp Wed Mar 27 08:41:53 2019
@@ -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<Stage> &S = *I;
-    Err = S->cycleEnd();
+  for (const std::unique_ptr<Stage> &S : Stages) {
+    if (Err = S->cycleEnd())
+      break;
   }
 
   return Err;




More information about the llvm-commits mailing list