Skip to content

Commit a7db7cd

Browse files
c-rhodesChenyang-L
authored andcommitted
[mlir][ArmSME] Fix crash on func decls in 'arm_za' legality checks
Reviewed By: dcaballe, Dinistro Differential Revision: https://reviews.llvm.org/D153750
1 parent af8f83c commit a7db7cd

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

mlir/lib/Dialect/ArmSME/Transforms/LegalizeForLLVMExport.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ void mlir::configureArmSMELegalizeForExportTarget(
5959
// 2. the 'arm_za' function attribute is present and the first op in the
6060
// function is an 'arm_sme::aarch64_sme_za_enable' intrinsic.
6161
target.addDynamicallyLegalOp<func::FuncOp>([&](func::FuncOp funcOp) {
62+
if (funcOp.isDeclaration())
63+
return true;
6264
auto firstOp = funcOp.getBody().front().begin();
6365
return !funcOp->hasAttr("arm_za") ||
6466
isa<arm_sme::aarch64_sme_za_enable>(firstOp);

mlir/test/Dialect/ArmSME/enable-arm-za.mlir

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// RUN: mlir-opt %s -enable-arm-streaming -convert-vector-to-llvm="enable-arm-sme" | FileCheck %s -check-prefix=DISABLE-ZA
33
// RUN: mlir-opt %s -convert-vector-to-llvm="enable-arm-sme" | FileCheck %s -check-prefix=NO-ARM-STREAMING
44

5+
// CHECK-LABEL: @declaration
6+
func.func private @declaration()
7+
58
// CHECK-LABEL: @arm_za
69
func.func @arm_za() {
710
// ENABLE-ZA: arm_sme.intr.za.enable

0 commit comments

Comments
 (0)