1 ; RUN: opt -passes=loop-load-elim -mtriple=aarch64 -mattr=+sve -S -debug < %s 2>&1 | FileCheck %s
4 ; Regression tests verifying "assumption that TypeSize is not scalable" and
5 ; "Invalid size request on a scalable vector." are not produced by
6 ; -load-loop-elim (this would cause the test to fail because opt would exit with
7 ; a non-zero exit status).
9 ; No output checked for this one, but causes a fatal error if the regression is present.
11 define void @regression_test_get_gep_induction_operand_typesize_warning(i64 %n, ptr %a) {
16 %0 = phi i64 [ 0, %entry ], [ %1, %loop.body ]
17 %idx = getelementptr <vscale x 4 x i32>, ptr %a, i64 %0
18 store <vscale x 4 x i32> zeroinitializer, ptr %idx
20 %2 = icmp eq i64 %1, %n
21 br i1 %2, label %loop.end, label %loop.body
27 ; CHECK-LABEL: 'regression_test_loop_access_scalable_typesize'
28 ; CHECK: LAA: Found an analyzable loop: vector.body
29 ; CHECK: LAA: Bad stride - Scalable object:
30 define void @regression_test_loop_access_scalable_typesize(ptr %input_ptr) {
34 %ind_ptr = phi ptr [ %next_ptr, %vector.body ], [ %input_ptr, %entry ]
35 %ind = phi i64 [ %next, %vector.body ], [ 0, %entry ]
36 %ld = load <vscale x 16 x i8>, ptr %ind_ptr, align 16
37 store <vscale x 16 x i8> zeroinitializer, ptr %ind_ptr, align 16
38 %next_ptr = getelementptr inbounds <vscale x 16 x i8>, ptr %ind_ptr, i64 1
39 %next = add i64 %ind, 1
40 %cond = icmp ult i64 %next, 1024
41 br i1 %cond, label %end, label %vector.body
46 ; CHECK-LABEL: 'regression_test_loop_access_scalable_typesize_nonscalable_object'
47 ; CHECK: LAA: Found an analyzable loop: vector.body
48 ; CHECK: LAA: Bad stride - Scalable object:
49 define void @regression_test_loop_access_scalable_typesize_nonscalable_object(ptr %input_ptr) {
53 %ind_ptr = phi ptr [ %next_ptr, %vector.body ], [ %input_ptr, %entry ]
54 %ind = phi i64 [ %next, %vector.body ], [ 0, %entry ]
55 %ld = load <vscale x 16 x i8>, ptr %ind_ptr, align 16
56 store <vscale x 16 x i8> zeroinitializer, ptr %ind_ptr, align 16
57 %next_ptr = getelementptr inbounds i8, ptr %ind_ptr, i64 1
58 %next = add i64 %ind, 1
59 %cond = icmp ult i64 %next, 1024
60 br i1 %cond, label %end, label %vector.body