brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.9 KiB · 0063755 Raw
151 lines · plain
1; RUN: opt -passes=loop-vectorize -force-vector-width=2 -S %s | FileCheck %s2 3; Tests with alias sets that contain points with uncomputable bounds because4; they include %offset.1, which is loaded in each loop iteration.5 6; Alias set with uncomputable bounds contains a single load. We do not need7; runtime checks for that group and it should not block vectorization.8define void @test1_uncomputable_bounds_single_load(ptr noalias %ptr.1, ptr noalias %ptr.2, ptr noalias %ptr.3, i64 %N, i64 %X) {9; CHECK-LABEL: define void @test1_uncomputable_bounds_single_load10; CHECK:       vector.body11; CHECK:         ret void12 13entry:14  %cond = icmp sgt i64 %N, 015  br i1 %cond, label %ph, label %exit16 17ph:18  br label %loop19 20loop:21  %iv = phi i64 [ 0, %ph ], [ %iv.next, %loop ]22  %gep.1 = getelementptr inbounds i32, ptr %ptr.3, i64 %iv23  %offset.1 = load i32, ptr %gep.1, align 424  %gep.2 = getelementptr inbounds i32, ptr %ptr.2, i32 %offset.125  %lv = load i32, ptr %gep.2, align 426  %gep.3 = getelementptr inbounds i32, ptr %ptr.1, i64 %iv27  store i32 %lv , ptr %gep.3, align 428  %offset.2 = add nsw i64 %iv, %X29  %gep.4 = getelementptr inbounds i32, ptr %ptr.1, i64 %offset.230  store i32 %lv, ptr %gep.4, align 431  %iv.next = add nuw nsw i64 %iv, 132  %exitcond = icmp eq i64 %iv.next, %N33  br i1 %exitcond, label %loop.exit, label %loop34 35loop.exit:36  br label %exit37 38exit:39  ret void40}41 42; Alias set with uncomputable bounds contains a single store. We do not need43; runtime checks for that group and it should not block vectorization.44define void @test2_uncomputable_bounds_single_store(ptr noalias %ptr.1, ptr noalias %ptr.2, ptr noalias %ptr.3, i64 %N, i64 %X) {45; CHECK-LABEL: define void @test2_uncomputable_bounds_single_store46; CHECK:       vector.body47; CHECK:         ret void48 49entry:50  %cond = icmp sgt i64 %N, 051  br i1 %cond, label %ph, label %exit52 53ph:54  br label %loop55 56loop:57  %iv = phi i64 [ 0, %ph ], [ %iv.next, %loop ]58  %gep.1 = getelementptr inbounds i32, ptr %ptr.3, i64 %iv59  %offset.1 = load i32, ptr %gep.1, align 460  %gep.2 = getelementptr inbounds i32, ptr %ptr.2, i32 %offset.161  store i32 20, ptr %gep.2, align 462  %gep.3 = getelementptr inbounds i32, ptr %ptr.1, i64 %iv63  store i32 0 , ptr %gep.3, align 464  %offset.2 = add nsw i64 %iv, %X65  %gep.4 = getelementptr inbounds i32, ptr %ptr.1, i64 %offset.266  store i32 10, ptr %gep.4, align 467  %iv.next = add nuw nsw i64 %iv, 168  %exitcond = icmp eq i64 %iv.next, %N69  br i1 %exitcond, label %loop.exit, label %loop70 71loop.exit:72  br label %exit73 74exit:75  ret void76}77 78; Alias set with uncomputable bounds contains a load and a store. This blocks79; vectorization, as we cannot generate runtime-checks for the set.80define void @test3_uncomputable_bounds_load_store(ptr noalias %ptr.1, ptr noalias %ptr.2, ptr noalias %ptr.3, i64 %N, i64 %X) {81; CHECK-LABEL: define void @test3_uncomputable_bounds_load_store82; CHECK-NOT: vector.body83 84entry:85  %cond = icmp sgt i64 %N, 086  br i1 %cond, label %ph, label %exit87 88ph:89  br label %loop90 91loop:92  %iv = phi i64 [ 0, %ph ], [ %iv.next, %loop ]93  %gep.1 = getelementptr inbounds i32, ptr %ptr.3, i64 %iv94  %offset.1 = load i32, ptr %gep.1, align 495  %gep.2 = getelementptr inbounds i32, ptr %ptr.2, i32 %offset.196  store i32 20, ptr %gep.2, align 497  %gep.22 = getelementptr inbounds i32, ptr %ptr.2, i64 %iv98  %lv = load i32, ptr %gep.22, align 499  %gep.3 = getelementptr inbounds i32, ptr %ptr.1, i64 %iv100  store i32 %lv , ptr %gep.3, align 4101  %offset.2 = add nsw i64 %iv, %X102  %gep.4 = getelementptr inbounds i32, ptr %ptr.1, i64 %offset.2103  store i32 %lv, ptr %gep.4, align 4104  %iv.next = add nuw nsw i64 %iv, 1105  %exitcond = icmp eq i64 %iv.next, %N106  br i1 %exitcond, label %loop.exit, label %loop107 108loop.exit:109  br label %exit110 111exit:112  ret void113}114 115; Alias set with uncomputable bounds contains a load and a store. This blocks116; vectorization, as we cannot generate runtime-checks for the set.117define void @test4_uncomputable_bounds_store_store(ptr noalias %ptr.1, ptr noalias %ptr.2, ptr noalias %ptr.3, i64 %N, i64 %X) {118; CHECK-LABEL: define void @test4_uncomputable_bounds_store_store119; CHECK-NOT: vector.body120 121entry:122  %cond = icmp sgt i64 %N, 0123  br i1 %cond, label %ph, label %exit124 125ph:126  br label %loop127 128loop:129  %iv = phi i64 [ 0, %ph ], [ %iv.next, %loop ]130  %gep.1 = getelementptr inbounds i32, ptr %ptr.3, i64 %iv131  %offset.1 = load i32, ptr %gep.1, align 4132  %gep.2 = getelementptr inbounds i32, ptr %ptr.2, i32 %offset.1133  store i32 20, ptr %gep.2, align 4134  %gep.22 = getelementptr inbounds i32, ptr %ptr.2, i64 %iv135  store i32 30, ptr %gep.22, align 4136  %gep.3 = getelementptr inbounds i32, ptr %ptr.1, i64 %iv137  store i32 0 , ptr %gep.3, align 4138  %offset.2 = add nsw i64 %iv, %X139  %gep.4 = getelementptr inbounds i32, ptr %ptr.1, i64 %offset.2140  store i32 10, ptr %gep.4, align 4141  %iv.next = add nuw nsw i64 %iv, 1142  %exitcond = icmp eq i64 %iv.next, %N143  br i1 %exitcond, label %loop.exit, label %loop144 145loop.exit:146  br label %exit147 148exit:149  ret void150}151