[Mlir-commits] [mlir] [mlir][ArmSME] Skip tile allocation for functions with no SME tile values (PR #227153)
Benjamin Maxwell
llvmlistbot at llvm.org
Tue Sep 29 00:51:14 PDT 2026
================
@@ -800,12 +800,45 @@ struct TestTileAllocationPass
};
} // namespace
+/// Returns true if `function` contains any SME tile values, either as block
+/// arguments (e.g., function arguments, or arguments to blocks merging values
+/// from different paths) or as results of operations.
+static bool functionHasSMETileValues(FunctionOpInterface function) {
+ auto hasSMETileType = [](TypeRange types) {
+ return llvm::any_of(
+ types, [](Type type) { return isValidSMETileVectorType(type); });
+ };
+
+ bool hasSMETileValues = false;
+ function.walk([&](Block *block) -> WalkResult {
+ if (hasSMETileType(block->getArgumentTypes())) {
+ hasSMETileValues = true;
+ return WalkResult::interrupt();
+ }
+ return WalkResult::advance();
+ });
+ if (hasSMETileValues)
+ return true;
+ function.walk([&](Operation *op) -> WalkResult {
+ if (hasSMETileType(op->getResultTypes())) {
+ hasSMETileValues = true;
+ return WalkResult::interrupt();
+ }
+ return WalkResult::advance();
+ });
+ return hasSMETileValues;
----------------
MacDue wrote:
You don't need that `hasSMETileValues` bool. You can call `.wasInterrupted()` on the walk.
https://github.com/llvm/llvm-project/pull/227153
More information about the Mlir-commits
mailing list