[llvm] [AArch64][SVE] - Fix crash Possible incorrect use of EVT::getVectorNumElements(). (PR #218733)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 28 02:41:49 PDT 2026


================
@@ -0,0 +1,57 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
+; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s | FileCheck %s
+
+
+define void @blend_heat_16bit(ptr %0, ptr %1, ptr %2, i64 %3) {
+; CHECK-LABEL: blend_heat_16bit:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    mov w8, wzr
+; CHECK-NEXT:    mov w9, #1 // =0x1
+; CHECK-NEXT:    b .LBB0_2
+; CHECK:       .LBB0_1:
+; CHECK-NEXT:    strh w10, [x2]
+; CHECK-NEXT:    add w8, w8, #1
+; CHECK:       .LBB0_2:
+; CHECK-NEXT:    cmp x3, w8, sxtw
+; CHECK-NEXT:    b.le .LBB0_5
+; CHECK:       // %bb.3:
+; CHECK-NEXT:    ldrh w10, [x0]
+; CHECK-NEXT:    cbz w10, .LBB0_1
+; CHECK:       // %bb.4:
+; CHECK-NEXT:    ldrh w10, [x1]
+; CHECK-NEXT:    subs w10, w9, w10
+; CHECK-NEXT:    csel w10, wzr, w10, lo
+; CHECK-NEXT:    add w10, w10, #1
+; CHECK-NEXT:    b .LBB0_1
+; CHECK:       .LBB0_5:
+; CHECK-NEXT:    ret
+  br label %5
+
+5:                                                ; preds = %17, %4
+  %.0 = phi i32 [ 0, %4 ], [ %19, %17 ]
+  %6 = sext i32 %.0 to i64
+  %7 = icmp sgt i64 %3, %6
+  br i1 %7, label %9, label %8
+
+8:                                                ; preds = %5
+  ret void
+
+9:                                                ; preds = %5
+  %10 = load i16, ptr %0, align 2
+  %11 = icmp eq i16 %10, 0
+  br i1 %11, label %17, label %12
+
+12:                                               ; preds = %9
+  %13 = load i16, ptr %1, align 2
+  %14 = zext i16 %13 to i32
+  %spec.select = call i32 @llvm.usub.sat.i32(i32 1, i32 %14)
----------------
lukel97 wrote:

I see but that test case crashes when run with`-O3 --target=aarch64-linux-gnu -mcpu=c1-ultra -fno-vectorize`. The codegen tests won't run any of the middle end vectorizers etc., you need to extract the LLVM IR before codegen

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


More information about the llvm-commits mailing list