brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.3 KiB · 4dde864 Raw
90 lines · plain
1; RUN: opt -passes=loop-load-elim -mtriple=aarch64 -mattr=+sve -S -debug < %s 2>&1 | FileCheck %s2; REQUIRES: asserts3 4; Regression tests verifying "assumption that TypeSize is not scalable" and5; "Invalid size request on a scalable vector." are not produced by6; -load-loop-elim (this would cause the test to fail because opt would exit with7; a non-zero exit status).8 9; No output checked for this one, but causes a fatal error if the regression is present.10 11define void @regression_test_get_gep_induction_operand_typesize_warning(i64 %n, ptr %a) {12entry:13  br label %loop.body14 15loop.body:16  %0 = phi i64 [ 0, %entry ], [ %1, %loop.body ]17  %idx = getelementptr <vscale x 4 x i32>, ptr %a, i64 %018  store <vscale x 4 x i32> zeroinitializer, ptr %idx19  %1 = add i64 %0, 120  %2 = icmp eq i64 %1, %n21  br i1 %2, label %loop.end, label %loop.body22 23loop.end:24  ret void25}26 27; CHECK-LABEL: 'regression_test_loop_access_scalable_typesize'28; CHECK: LAA: Found an analyzable loop: vector.body29; CHECK: LAA: Bad stride - Scalable object:30define void @regression_test_loop_access_scalable_typesize(ptr %input_ptr) {31entry:32  br label %vector.body33vector.body: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 1637  store <vscale x 16 x i8> zeroinitializer, ptr %ind_ptr, align 1638  %next_ptr = getelementptr inbounds <vscale x 16 x i8>, ptr %ind_ptr, i64 139  %next = add i64 %ind, 140  %cond = icmp ult i64 %next, 102441  br i1 %cond, label %end, label %vector.body42end:43  ret void44}45 46; CHECK-LABEL: 'regression_test_loop_access_scalable_typesize_nonscalable_object'47; CHECK: LAA: Found an analyzable loop: vector.body48; CHECK: LAA: Bad stride - Scalable object:49define void @regression_test_loop_access_scalable_typesize_nonscalable_object(ptr %input_ptr) {50entry:51  br label %vector.body52vector.body: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 1656  store <vscale x 16 x i8> zeroinitializer, ptr %ind_ptr, align 1657  %next_ptr = getelementptr inbounds i8, ptr %ind_ptr, i64 158  %next = add i64 %ind, 159  %cond = icmp ult i64 %next, 102460  br i1 %cond, label %end, label %vector.body61end:62  ret void63}64 65; CHECK-LABEL: 'regression_test_is_no_wrap_access_scalable_typesize'66; CHECK: LAA: Found an analyzable loop: loop67; CHECK: LAA: Bad stride - Scalable object: <vscale x 4 x i32>68define void @regression_test_is_no_wrap_access_scalable_typesize(ptr %ptr_a, i64 %n, ptr %ptr_b) {69entry:70  br label %loop71loop:72  %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]73  %2 = shl i64 %iv, 174  %3 = add i64 %2, %n75  %4 = trunc i64 %iv to i3276  %5 = insertelement <vscale x 4 x i32> zeroinitializer, i32 %4, i64 077  %6 = getelementptr i32, ptr %ptr_a, i64 %378  store <vscale x 4 x i32> %5, ptr %6, align 479  %.reass3 = or i32 %4, 180  %7 = insertelement <vscale x 4 x i32> zeroinitializer, i32 %.reass3, i64 081  %8 = shufflevector <vscale x 4 x i32> %7, <vscale x 4 x i32> zeroinitializer, <vscale x 4 x i32> zeroinitializer82  %9 = getelementptr i32, ptr %ptr_b, i64 %383  store <vscale x 4 x i32> %8, ptr %9, align 484  %iv.next = add i64 %iv, 185  %.not = icmp eq i64 %iv, 1686  br i1 %.not, label %end, label %loop87end:88  ret void89}90