76 lines · plain
1; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -passes=load-store-vectorizer %s -S -o - | FileCheck %s2; RUN: opt -passes=load-store-vectorizer %s -S -o - | FileCheck %s3; RUN: opt -aa-pipeline=basic-aa -passes='function(load-store-vectorizer)' %s -S -o - | FileCheck %s4 5target triple = "x86_64--"6 7%union = type { { [4 x [4 x [4 x [16 x float]]]], [4 x [4 x [4 x [16 x float]]]], [10 x [10 x [4 x float]]] } }8 9@global_pointer = external unnamed_addr global { %union, [2000 x i8] }, align 410 11; Function Attrs: convergent nounwind12define void @test(i32 %base) #0 {13; CHECK-LABEL: @test(14; CHECK-NOT: load i3215; CHECK: load <2 x i32>16; CHECK-NOT: load i3217entry:18 %mul331 = and i32 %base, -419 %add350.4 = add i32 4, %mul33120 %idx351.4 = zext i32 %add350.4 to i6421 %arrayidx352.4 = getelementptr inbounds { %union, [2000 x i8] }, ptr @global_pointer, i64 0, i32 0, i32 0, i32 1, i64 0, i64 0, i64 0, i64 %idx351.422 %add350.5 = add i32 5, %mul33123 %idx351.5 = zext i32 %add350.5 to i6424 %arrayidx352.5 = getelementptr inbounds { %union, [2000 x i8] }, ptr @global_pointer, i64 0, i32 0, i32 0, i32 1, i64 0, i64 0, i64 0, i64 %idx351.525 %cnd = icmp ult i32 %base, 100026 br i1 %cnd, label %loads, label %exit27 28loads:29 ; If and only if the loads are in a different BB from the GEPs codegenprepare30 ; would try to turn the GEPs into math, which makes LoadStoreVectorizer's job31 ; harder32 %tmp297.4 = load i32, ptr %arrayidx352.4, align 4, !tbaa !033 %tmp297.5 = load i32, ptr %arrayidx352.5, align 4, !tbaa !034 br label %exit35 36exit:37 ret void38}39 40; Function Attrs: convergent nounwind41define void @test.codegenprepared(i32 %base) #0 {42; CHECK-LABEL: @test.codegenprepared(43; CHECK-NOT: load i3244; CHECK: load <2 x i32>45; CHECK-NOT: load i3246entry:47 %mul331 = and i32 %base, -448 %add350.4 = add i32 4, %mul33149 %idx351.4 = zext i32 %add350.4 to i6450 %add350.5 = add i32 5, %mul33151 %idx351.5 = zext i32 %add350.5 to i6452 %cnd = icmp ult i32 %base, 100053 br i1 %cnd, label %loads, label %exit54 55loads: ; preds = %entry56 %sunkaddr = mul i64 %idx351.4, 457 %sunkaddr1 = getelementptr inbounds i8, ptr @global_pointer, i64 %sunkaddr58 %sunkaddr2 = getelementptr inbounds i8, ptr %sunkaddr1, i64 409659 %tmp297.4 = load i32, ptr %sunkaddr2, align 4, !tbaa !060 %sunkaddr3 = mul i64 %idx351.5, 461 %sunkaddr4 = getelementptr inbounds i8, ptr @global_pointer, i64 %sunkaddr362 %sunkaddr5 = getelementptr inbounds i8, ptr %sunkaddr4, i64 409663 %tmp297.5 = load i32, ptr %sunkaddr5, align 4, !tbaa !064 br label %exit65 66exit: ; preds = %loads, %entry67 ret void68}69 70attributes #0 = { convergent nounwind }71 72!0 = !{!1, !1, i64 0}73!1 = !{!"float", !2, i64 0}74!2 = !{!"omnipotent char", !3, i64 0}75!3 = !{!"Simple C++ TBAA"}76