[Mlir-commits] [mlir] [MLIR][XeGPU] Clone trivial operations with multiple consumers in recoverTemporaryLayout to avoid layout conflict (PR #197514)

Igor Zamyatin llvmlistbot at llvm.org
Thu May 14 06:56:40 PDT 2026


================
@@ -124,13 +126,90 @@ static xegpu::DistributeLayoutAttr getLayoutFromUsePoints(Value result) {
   return layout;
 }
 
+// Returns true if `op` is safe and cheap to clone (no side effects, no
+// regions, and all operands are themselves trivially rematerializable, e.g.
+// block-arg-free pure value generators such as `vector.step`, splat
+// `arith.constant`, or `vector.create_mask` whose operands are constants).
+static bool isTriviallyRematerializable(Operation *op) {
+  if (!op || op->getNumRegions() != 0)
+    return false;
+  if (!isMemoryEffectFree(op))
+    return false;
+  for (Value v : op->getOperands()) {
+    Operation *defOp = v.getDefiningOp();
----------------
Garra1980 wrote:

can you pls add a test for this case not just operand-less step?

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


More information about the Mlir-commits mailing list