[Mlir-commits] [mlir] [mlir][ArmSME] Use liveness information in the tile allocator (PR #90448)

Andrzej WarzyƄski llvmlistbot at llvm.org
Tue Apr 30 07:49:41 PDT 2024


================
@@ -116,4 +116,50 @@ VectorType getSMETileTypeForElement(Type elementType) {
   return VectorType::get({minNumElts, minNumElts}, elementType, {true, true});
 }
 
+void eraseTriviallyDeadTileOps(IRRewriter &rewriter,
+                               FunctionOpInterface function) {
+  SmallVector<Operation *> worklist;
+  function->walk([&](Operation *op) {
+    auto armSMEOp = dyn_cast<arm_sme::ArmSMETileOpInterface>(op);
+    if (armSMEOp && isOpTriviallyDead(armSMEOp))
+      worklist.push_back(armSMEOp);
+  });
+  while (!worklist.empty()) {
+    Operation *op = worklist.pop_back_val();
+    if (!isOpTriviallyDead(op))
+      continue;
----------------
banach-space wrote:

I guess this is for operands collected on L133? Could you add some comments above `while` to describe the logic? For example:
```
// Iterate over all ops collected above and erase, including their operands if these are "dead" as well.
```

Btw, why not (as in, only add operands which are "dead"): 
```
if (auto armSMEOp = value.getDefiningOp<arm_sme::ArmSMETileOpInterface>())
 if (isOpTriviallyDead(armSMEOp))
    worklist.push_back(armSMEOp);
 ```

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


More information about the Mlir-commits mailing list