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

Nishant Patel llvmlistbot at llvm.org
Tue May 26 09:01:16 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();
----------------
nbpatel wrote:

added

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


More information about the Mlir-commits mailing list