[Mlir-commits] [mlir] [MLIR][XeVM] Rewrite llvm.alloca if addr_space is not 0 (PR #183417)

Artem Kroviakov llvmlistbot at llvm.org
Thu Feb 26 04:12:37 PST 2026


================
@@ -1014,8 +1056,19 @@ struct ConvertXeVMToLLVMPass
 
 void ::mlir::populateXeVMToLLVMConversionPatterns(ConversionTarget &target,
                                                   RewritePatternSet &patterns) {
-  target.addDynamicallyLegalDialect<LLVM::LLVMDialect>(
-      [](Operation *op) { return !op->hasAttr("cache_control"); });
+  // some LLVM operations need to be converted.
+  target.addDynamicallyLegalDialect<LLVM::LLVMDialect>([](Operation *op) {
+    // addrspace 0 (function) is the default for alloca, and it is legal.
+    // other address spaces need to replaced with llvm global.
----------------
akroviakov wrote:

We only have one pattern, and it is for SLM. I feel like it would make more sense to mark SLM allocas illegal, and the rest is legal (i.e., not handled here).

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


More information about the Mlir-commits mailing list