[Mlir-commits] [mlir] [mlir][reducer] Separate Reduction Steps in `findOptimal` and `applyPatterns` (PR #190560)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Apr 8 16:17:40 PDT 2026
================
@@ -101,17 +48,20 @@ static LogicalResult findOptimal(ModuleOp module, Region ®ion,
// Duplicate the module for root node and locate the region in the copy.
if (failed(root->initialize(module, region)))
llvm_unreachable("unexpected initialization failure");
- root->update(initStatus);
+
+ // Create a duplicate of the root node as the first variant of the root.
+ // This will keep the root intact when applying `applyFn`.
+ ReductionNode *firstVariant = allocator.Allocate();
+ new (firstVariant) ReductionNode(root, ranges, allocator);
+ root->addVariant(firstVariant);
----------------
aidint wrote:
I explained here:
https://github.com/llvm/llvm-project/pull/190560#issuecomment-4210319799
https://github.com/llvm/llvm-project/pull/190560
More information about the Mlir-commits
mailing list