[PATCH] D153750: [mlir][ArmSME] Fix crash on func decls in 'arm_za' legality checks

Cullen Rhodes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 27 00:40:10 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG51b0398b76fa: [mlir][ArmSME] Fix crash on func decls in 'arm_za' legality checks (authored by c-rhodes).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153750/new/

https://reviews.llvm.org/D153750

Files:
  mlir/lib/Dialect/ArmSME/Transforms/LegalizeForLLVMExport.cpp
  mlir/test/Dialect/ArmSME/enable-arm-za.mlir


Index: mlir/test/Dialect/ArmSME/enable-arm-za.mlir
===================================================================
--- mlir/test/Dialect/ArmSME/enable-arm-za.mlir
+++ mlir/test/Dialect/ArmSME/enable-arm-za.mlir
@@ -2,6 +2,9 @@
 // RUN: mlir-opt %s -enable-arm-streaming -convert-vector-to-llvm="enable-arm-sme" | FileCheck %s -check-prefix=DISABLE-ZA
 // RUN: mlir-opt %s -convert-vector-to-llvm="enable-arm-sme" | FileCheck %s -check-prefix=NO-ARM-STREAMING
 
+// CHECK-LABEL: @declaration
+func.func private @declaration()
+
 // CHECK-LABEL: @arm_za
 func.func @arm_za() {
   // ENABLE-ZA: arm_sme.intr.za.enable
Index: mlir/lib/Dialect/ArmSME/Transforms/LegalizeForLLVMExport.cpp
===================================================================
--- mlir/lib/Dialect/ArmSME/Transforms/LegalizeForLLVMExport.cpp
+++ mlir/lib/Dialect/ArmSME/Transforms/LegalizeForLLVMExport.cpp
@@ -59,6 +59,8 @@
   //   2. the 'arm_za' function attribute is present and the first op in the
   //      function is an 'arm_sme::aarch64_sme_za_enable' intrinsic.
   target.addDynamicallyLegalOp<func::FuncOp>([&](func::FuncOp funcOp) {
+    if (funcOp.isDeclaration())
+      return true;
     auto firstOp = funcOp.getBody().front().begin();
     return !funcOp->hasAttr("arm_za") ||
            isa<arm_sme::aarch64_sme_za_enable>(firstOp);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153750.534858.patch
Type: text/x-patch
Size: 1331 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230627/894e5641/attachment.bin>


More information about the llvm-commits mailing list