Skip to content

Conversation

@lcvon007
Copy link
Contributor

@lcvon007 lcvon007 commented Feb 20, 2025

The program will exit the outer loop directly if inner loop ends, so the outer do {} while() is redundant.

@llvmbot llvmbot added the mlir label Feb 20, 2025
@llvmbot
Copy link
Member

llvmbot commented Feb 20, 2025

@llvm/pr-subscribers-mlir

Author: laichunfeng (lcvon007)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/127998.diff

1 Files Affected:

  • (modified) mlir/lib/Analysis/DataFlowFramework.cpp (+11-15)
diff --git a/mlir/lib/Analysis/DataFlowFramework.cpp b/mlir/lib/Analysis/DataFlowFramework.cpp
index 028decbae31c3..29f57c602f9cb 100644
--- a/mlir/lib/Analysis/DataFlowFramework.cpp
+++ b/mlir/lib/Analysis/DataFlowFramework.cpp
@@ -118,21 +118,17 @@ LogicalResult DataFlowSolver::initializeAndRun(Operation *top) {
   }
 
   // Run the analysis until fixpoint.
-  do {
-    // Exhaust the worklist.
-    while (!worklist.empty()) {
-      auto [point, analysis] = worklist.front();
-      worklist.pop();
-
-      DATAFLOW_DEBUG(llvm::dbgs() << "Invoking '" << analysis->debugName
-                                  << "' on: " << point << "\n");
-      if (failed(analysis->visit(point)))
-        return failure();
-    }
-
-    // Iterate until all states are in some initialized state and the worklist
-    // is exhausted.
-  } while (!worklist.empty());
+  // Iterate until all states are in some initialized state and the worklist
+  // is exhausted.
+  while (!worklist.empty()) {
+    auto [point, analysis] = worklist.front();
+    worklist.pop();
+
+    DATAFLOW_DEBUG(llvm::dbgs() << "Invoking '" << analysis->debugName
+                                << "' on: " << point << "\n");
+    if (failed(analysis->visit(point)))
+      return failure();
+  }
 
   return success();
 }

@lcvon007 lcvon007 requested a review from Mogball February 20, 2025 12:24
@lcvon007
Copy link
Contributor Author

please help review, thanks @Mogball

@lcvon007 lcvon007 merged commit 35d7bf2 into llvm:main Feb 21, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants