brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.7 KiB · 0f03d39 Raw
100 lines · plain
1; RUN: opt < %s  -aa-pipeline=tbaa,basic-aa -passes=loop-vectorize,dce,instcombine,simplifycfg -force-vector-interleave=1 -force-vector-width=4 -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s2; RUN: opt < %s  -aa-pipeline=basic-aa -passes=loop-vectorize,dce,instcombine,simplifycfg -force-vector-interleave=1 -force-vector-width=4 -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s --check-prefix=CHECK-NOTBAA3target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"4 5; TBAA partitions the accesses in this loop, so it can be vectorized without6; runtime checks.7define i32 @test1(ptr nocapture %a, ptr nocapture readonly %b) {8; CHECK-LABEL: @test19; CHECK: entry:10; CHECK-NEXT: br label %vector.body11; CHECK: vector.body:12 13; CHECK: load <4 x float>, ptr %{{.*}}, align 4, !tbaa14; CHECK: store <4 x i32> %{{.*}}, ptr %{{.*}}, align 4, !tbaa15 16; CHECK: ret i32 017 18; CHECK-NOTBAA-LABEL: @test119; CHECK-NOTBAA: entry:20; CHECK-NOTBAA: icmp ult i6421; CHECK-NOTBAA-NOT: icmp22; CHECK-NOTBAA: br i1 {{.+}}, label %for.body, label %vector.body23 24; CHECK-NOTBAA: load <4 x float>, ptr %{{.*}}, align 4, !tbaa25; CHECK-NOTBAA: store <4 x i32> %{{.*}}, ptr %{{.*}}, align 4, !tbaa26 27; CHECK-NOTBAA: ret i32 028 29entry:30  br label %for.body31 32for.body:                                         ; preds = %for.body, %entry33  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]34  %arrayidx = getelementptr inbounds float, ptr %b, i64 %indvars.iv35  %0 = load float, ptr %arrayidx, align 4, !tbaa !036  %conv = fptosi float %0 to i3237  %arrayidx2 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv38  store i32 %conv, ptr %arrayidx2, align 4, !tbaa !439  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 140  %exitcond = icmp eq i64 %indvars.iv.next, 160041  br i1 %exitcond, label %for.end, label %for.body42 43for.end:                                          ; preds = %for.body44  ret i32 045}46 47; This test is like the first, except here there is still one runtime check48; required. Without TBAA, however, two checks are required.49define i32 @test2(ptr nocapture readonly %a, ptr nocapture readonly %b, ptr nocapture %c) {50; CHECK-LABEL: @test251; CHECK: entry:52; CHECK: icmp ult i6453; CHECK-NOT: icmp54; CHECK: br i1 {{.+}}, label %for.body, label %vector.body55 56; CHECK: load <4 x float>, ptr %{{.*}}, align 4, !tbaa57; CHECK: store <4 x float> %{{.*}}, ptr %{{.*}}, align 4, !tbaa58 59; CHECK: ret i32 060 61; CHECK-NOTBAA-LABEL: @test262; CHECK-NOTBAA: entry:63; CHECK-NOTBAA: icmp ult i6464; CHECK-NOTBAA: icmp ult i6465; CHECK-NOTBAA-NOT: icmp66; CHECK-NOTBAA: br i1 {{.+}}, label %for.body, label %vector.body67 68; CHECK-NOTBAA: load <4 x float>, ptr %{{.*}}, align 4, !tbaa69; CHECK-NOTBAA: store <4 x float> %{{.*}}, ptr %{{.*}}, align 4, !tbaa70 71; CHECK-NOTBAA: ret i32 072 73entry:74  br label %for.body75 76for.body:                                         ; preds = %for.body, %entry77  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]78  %arrayidx = getelementptr inbounds float, ptr %b, i64 %indvars.iv79  %0 = load float, ptr %arrayidx, align 4, !tbaa !080  %arrayidx2 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv81  %1 = load i32, ptr %arrayidx2, align 4, !tbaa !482  %conv = sitofp i32 %1 to float83  %mul = fmul float %0, %conv84  %arrayidx4 = getelementptr inbounds float, ptr %c, i64 %indvars.iv85  store float %mul, ptr %arrayidx4, align 4, !tbaa !086  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 187  %exitcond = icmp eq i64 %indvars.iv.next, 160088  br i1 %exitcond, label %for.end, label %for.body89 90for.end:                                          ; preds = %for.body91  ret i32 092}93 94!0 = !{!1, !1, i64 0}95!1 = !{!"float", !2, i64 0}96!2 = !{!"omnipotent char", !3, i64 0}97!3 = !{!"Simple C/C++ TBAA"}98!4 = !{!5, !5, i64 0}99!5 = !{!"int", !2, i64 0}100