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: LAA: Found a loop in regression_test_loop_access_scalable_typesize
28 ; CHECK: LAA: Bad stride - Scalable object:
29 define void @regression_test_loop_access_scalable_typesize(ptr %input_ptr) {
33 %ind_ptr = phi ptr [ %next_ptr, %vector.body ], [ %input_ptr, %entry ]
34 %ind = phi i64 [ %next, %vector.body ], [ 0, %entry ]
35 %ld = load <vscale x 16 x i8>, ptr %ind_ptr, align 16
36 store <vscale x 16 x i8> zeroinitializer, ptr %ind_ptr, align 16
37 %next_ptr = getelementptr inbounds <vscale x 16 x i8>, ptr %ind_ptr, i64 1
38 %next = add i64 %ind, 1
39 %cond = icmp ult i64 %next, 1024
40 br i1 %cond, label %end, label %vector.body
45 ; CHECK-LABEL: LAA: Found a loop in regression_test_loop_access_scalable_typesize_nonscalable_object
46 ; CHECK: LAA: Bad stride - Scalable object:
47 define void @regression_test_loop_access_scalable_typesize_nonscalable_object(ptr %input_ptr) {
51 %ind_ptr = phi ptr [ %next_ptr, %vector.body ], [ %input_ptr, %entry ]
52 %ind = phi i64 [ %next, %vector.body ], [ 0, %entry ]
53 %ld = load <vscale x 16 x i8>, ptr %ind_ptr, align 16
54 store <vscale x 16 x i8> zeroinitializer, ptr %ind_ptr, align 16
55 %next_ptr = getelementptr inbounds i8, ptr %ind_ptr, i64 1
56 %next = add i64 %ind, 1
57 %cond = icmp ult i64 %next, 1024
58 br i1 %cond, label %end, label %vector.body