[Mlir-commits] [mlir] [milr][gpu] Make barrier elimination address-space aware (PR #178101)

Jakub Kuderski llvmlistbot at llvm.org
Tue Jan 27 11:51:05 PST 2026


================
@@ -78,14 +78,132 @@ static void addAllValuelessEffects(
   effects.emplace_back(MemoryEffects::Effect::get<MemoryEffects::Free>());
 }
 
+/// Looks through known "view-like" ops to find the base memref.
+static Value getBase(Value v) {
+  while (true) {
+    Operation *definingOp = v.getDefiningOp();
+    if (!definingOp)
+      break;
+
+    bool shouldContinue = TypeSwitch<Operation *, bool>(v.getDefiningOp())
+                              .Case([&](ViewLikeOpInterface op) {
+                                v = op.getViewSource();
+                                return true;
+                              })
+                              .Case([&](memref::TransposeOp op) {
+                                v = op.getIn();
+                                return true;
+                              })
+                              .Default(false);
+    if (!shouldContinue)
----------------
kuhar wrote:

nit: Err, actually, I'd probably use two ifs instead

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


More information about the Mlir-commits mailing list