[Mlir-commits] [mlir] [mlir] Do not merge blocks during canonicalization by default (PR #95057)

Mehdi Amini llvmlistbot at llvm.org
Tue Jun 11 08:20:23 PDT 2024


================
@@ -827,11 +827,13 @@ static LogicalResult mergeIdenticalBlocks(RewriterBase &rewriter,
 /// elimination, as well as some other DCE. This function returns success if any
 /// of the regions were simplified, failure otherwise.
 LogicalResult mlir::simplifyRegions(RewriterBase &rewriter,
-                                    MutableArrayRef<Region> regions) {
+                                    MutableArrayRef<Region> regions,
+                                    bool mergeBlocks) {
   bool eliminatedBlocks = succeeded(eraseUnreachableBlocks(rewriter, regions));
   bool eliminatedOpsOrArgs = succeeded(runRegionDCE(rewriter, regions));
-  bool mergedIdenticalBlocks =
-      succeeded(mergeIdenticalBlocks(rewriter, regions));
+  bool mergedIdenticalBlocks = false;
+  if (mergeBlocks)
+    mergedIdenticalBlocks = succeeded(mergeIdenticalBlocks(rewriter, regions));
----------------
joker-eph wrote:

I don't really like the short circuit with side effects: this would obscure the control flow IMO. 

https://github.com/llvm/llvm-project/pull/95057


More information about the Mlir-commits mailing list