149 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --filter "br" --filter "^.*:"2; RUN: opt -passes="print<block-freq>,loop-vectorize" -force-vector-width=4 -force-vector-interleave=1 -S < %s | FileCheck %s3; RUN: opt -passes="print<block-freq>,loop-vectorize" -force-vector-width=4 -force-vector-interleave=4 -S < %s | FileCheck %s -check-prefix=CHECK-MASKED4; RUN: opt -passes="print<block-freq>,loop-vectorize" -force-vector-width=4 -force-vector-interleave=1 \5; RUN: -scalable-vectorization=on -force-target-supports-scalable-vectors -S < %s | FileCheck %s -check-prefix=CHECK-SCALABLE6 7target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"8 9@a = global [1024 x i32] zeroinitializer, align 1610@b = global [1024 x i32] zeroinitializer, align 1611 12; Check correctness of profile info for vectorization without epilog.13define void @_Z3foov() {14; CHECK-LABEL: @_Z3foov(15; CHECK: entry:16; CHECK: br label [[VECTOR_PH:%.*]]17; CHECK: vector.ph:18; CHECK: br label [[VECTOR_BODY:%.*]]19; CHECK: vector.body:20; CHECK: br i1 [[TMP4:%.*]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !prof [[PROF0:![0-9]+]], !llvm.loop [[LOOP1:![0-9]+]]21; CHECK: middle.block:22; CHECK: br label [[FOR_BODY:%.*]]23; CHECK: for.cond.cleanup:24;25; CHECK-MASKED-LABEL: @_Z3foov(26; CHECK-MASKED: entry:27; CHECK-MASKED: br label [[VECTOR_PH:%.*]]28; CHECK-MASKED: vector.ph:29; CHECK-MASKED: br label [[VECTOR_BODY:%.*]]30; CHECK-MASKED: vector.body:31; CHECK-MASKED: br i1 [[TMP16:%.*]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !prof [[PROF0:![0-9]+]], !llvm.loop [[LOOP1:![0-9]+]]32; CHECK-MASKED: middle.block:33; CHECK-MASKED: br label [[FOR_BODY:%.*]]34; CHECK-MASKED: for.cond.cleanup:35;36; CHECK-SCALABLE-LABEL: @_Z3foov(37; CHECK-SCALABLE: entry:38; CHECK-SCALABLE: br i1 [[MIN_ITERS_CHECK:%.*]], label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]], !prof [[PROF0:![0-9]+]]39; CHECK-SCALABLE: vector.ph:40; CHECK-SCALABLE: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[TMP9:%.*]], i64 041; CHECK-SCALABLE: [[BROADCAST_SPLAT:%.*]] = shufflevector <vscale x 4 x i32> [[BROADCAST_SPLATINSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer42; CHECK-SCALABLE: br label [[VECTOR_BODY:%.*]]43; CHECK-SCALABLE: vector.body:44; CHECK-SCALABLE: [[VEC_IND_NEXT:%.*]] = add <vscale x 4 x i32> [[VEC_IND:%.*]], [[BROADCAST_SPLAT]]45; CHECK-SCALABLE: br i1 [[TMP11:%.*]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !prof [[PROF1:![0-9]+]], !llvm.loop [[LOOP2:![0-9]+]]46; CHECK-SCALABLE: middle.block:47; CHECK-SCALABLE: br i1 [[CMP_N:%.*]], label [[FOR_COND_CLEANUP:%.*]], label [[SCALAR_PH]], !prof [[PROF6:![0-9]+]]48; CHECK-SCALABLE: scalar.ph:49; CHECK-SCALABLE: br label [[FOR_BODY:%.*]]50; CHECK-SCALABLE: for.cond.cleanup:51; CHECK-SCALABLE: for.body:52; CHECK-SCALABLE: br i1 [[EXITCOND:%.*]], label [[FOR_COND_CLEANUP]], label [[FOR_BODY]], !prof [[PROF7:![0-9]+]], !llvm.loop [[LOOP8:![0-9]+]]53;54entry:55 br label %for.body56 57for.cond.cleanup: ; preds = %for.body58 ret void59 60for.body: ; preds = %for.body, %entry61 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]62 %arrayidx = getelementptr inbounds [1024 x i32], ptr @b, i64 0, i64 %iv63 %0 = load i32, ptr %arrayidx, align 464 %1 = trunc i64 %iv to i3265 %mul = mul nsw i32 %0, %166 %arrayidx2 = getelementptr inbounds [1024 x i32], ptr @a, i64 0, i64 %iv67 %2 = load i32, ptr %arrayidx2, align 468 %add = add nsw i32 %2, %mul69 store i32 %add, ptr %arrayidx2, align 470 %iv.next = add nuw nsw i64 %iv, 171 %exitcond = icmp eq i64 %iv.next, 102472 br i1 %exitcond, label %for.cond.cleanup, label %for.body, !prof !073}74 75; Check correctness of profile info for vectorization with epilog.76define void @_Z3foo2v() {77; CHECK-LABEL: @_Z3foo2v(78; CHECK: entry:79; CHECK: br label [[VECTOR_PH:%.*]]80; CHECK: vector.ph:81; CHECK: br label [[VECTOR_BODY:%.*]]82; CHECK: vector.body:83; CHECK: br i1 [[TMP4:%.*]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !prof [[PROF0]], !llvm.loop [[LOOP5:![0-9]+]]84; CHECK: middle.block:85; CHECK: br label [[SCALAR_PH:%.*]]86; CHECK: scalar.ph:87; CHECK: br label [[FOR_BODY:%.*]]88; CHECK: for.cond.cleanup:89; CHECK: for.body:90; CHECK: br i1 [[EXITCOND:%.*]], label [[FOR_COND_CLEANUP:%.*]], label [[FOR_BODY]], !prof [[PROF6:![0-9]+]], !llvm.loop [[LOOP7:![0-9]+]]91;92; CHECK-MASKED-LABEL: @_Z3foo2v(93; CHECK-MASKED: entry:94; CHECK-MASKED: br label [[VECTOR_PH:%.*]]95; CHECK-MASKED: vector.ph:96; CHECK-MASKED: br label [[VECTOR_BODY:%.*]]97; CHECK-MASKED: vector.body:98; CHECK-MASKED: br i1 [[TMP16:%.*]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !prof [[PROF0]], !llvm.loop [[LOOP5:![0-9]+]]99; CHECK-MASKED: middle.block:100; CHECK-MASKED: br label [[SCALAR_PH:%.*]]101; CHECK-MASKED: scalar.ph:102; CHECK-MASKED: br label [[FOR_BODY:%.*]]103; CHECK-MASKED: for.cond.cleanup:104; CHECK-MASKED: for.body:105; CHECK-MASKED: br i1 [[EXITCOND:%.*]], label [[FOR_COND_CLEANUP:%.*]], label [[FOR_BODY]], !prof [[PROF6:![0-9]+]], !llvm.loop [[LOOP7:![0-9]+]]106;107; CHECK-SCALABLE-LABEL: @_Z3foo2v(108; CHECK-SCALABLE: entry:109; CHECK-SCALABLE: br i1 [[MIN_ITERS_CHECK:%.*]], label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]], !prof [[PROF0]]110; CHECK-SCALABLE: vector.ph:111; CHECK-SCALABLE: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[TMP9:%.*]], i64 0112; CHECK-SCALABLE: [[BROADCAST_SPLAT:%.*]] = shufflevector <vscale x 4 x i32> [[BROADCAST_SPLATINSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer113; CHECK-SCALABLE: br label [[VECTOR_BODY:%.*]]114; CHECK-SCALABLE: vector.body:115; CHECK-SCALABLE: [[VEC_IND_NEXT:%.*]] = add <vscale x 4 x i32> [[VEC_IND:%.*]], [[BROADCAST_SPLAT]]116; CHECK-SCALABLE: br i1 [[TMP11:%.*]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !prof [[PROF1]], !llvm.loop [[LOOP10:![0-9]+]]117; CHECK-SCALABLE: middle.block:118; CHECK-SCALABLE: br i1 [[CMP_N:%.*]], label [[FOR_COND_CLEANUP:%.*]], label [[SCALAR_PH]], !prof [[PROF6]]119; CHECK-SCALABLE: scalar.ph:120; CHECK-SCALABLE: br label [[FOR_BODY:%.*]]121; CHECK-SCALABLE: for.cond.cleanup:122; CHECK-SCALABLE: for.body:123; CHECK-SCALABLE: br i1 [[EXITCOND:%.*]], label [[FOR_COND_CLEANUP]], label [[FOR_BODY]], !prof [[PROF11:![0-9]+]], !llvm.loop [[LOOP12:![0-9]+]]124;125entry:126 br label %for.body127 128for.cond.cleanup: ; preds = %for.body129 ret void130 131for.body: ; preds = %for.body, %entry132 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]133 %arrayidx = getelementptr inbounds [1024 x i32], ptr @b, i64 0, i64 %iv134 %0 = load i32, ptr %arrayidx, align 4135 %1 = trunc i64 %iv to i32136 %mul = mul nsw i32 %0, %1137 %arrayidx2 = getelementptr inbounds [1024 x i32], ptr @a, i64 0, i64 %iv138 %2 = load i32, ptr %arrayidx2, align 4139 %add = add nsw i32 %2, %mul140 store i32 %add, ptr %arrayidx2, align 4141 %iv.next = add nuw nsw i64 %iv, 1142 %exitcond = icmp eq i64 %iv.next, 1027143 br i1 %exitcond, label %for.cond.cleanup, label %for.body, !prof !1144}145 146 147!0 = !{!"branch_weights", i32 1, i32 1023}148!1 = !{!"branch_weights", i32 1, i32 1026}149