1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2 ; RUN: opt -mattr=+v -passes=loop-vectorize -S %s | FileCheck %s
4 target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128"
5 target triple = "riscv64-unknown-unknown-elf"
7 define void @vf_will_not_generate_any_vector_insts(ptr %src, ptr %dst) {
8 ; CHECK-LABEL: define void @vf_will_not_generate_any_vector_insts(
9 ; CHECK-SAME: ptr [[SRC:%.*]], ptr [[DST:%.*]]) #[[ATTR0:[0-9]+]] {
10 ; CHECK-NEXT: [[ENTRY:.*]]:
11 ; CHECK-NEXT: br i1 false, label %[[SCALAR_PH:.*]], label %[[VECTOR_MEMCHECK:.*]]
12 ; CHECK: [[VECTOR_MEMCHECK]]:
13 ; CHECK-NEXT: [[SCEVGEP:%.*]] = getelementptr i8, ptr [[DST]], i64 4
14 ; CHECK-NEXT: [[SCEVGEP1:%.*]] = getelementptr i8, ptr [[SRC]], i64 4
15 ; CHECK-NEXT: [[BOUND0:%.*]] = icmp ult ptr [[DST]], [[SCEVGEP1]]
16 ; CHECK-NEXT: [[BOUND1:%.*]] = icmp ult ptr [[SRC]], [[SCEVGEP]]
17 ; CHECK-NEXT: [[FOUND_CONFLICT:%.*]] = and i1 [[BOUND0]], [[BOUND1]]
18 ; CHECK-NEXT: br i1 [[FOUND_CONFLICT]], label %[[SCALAR_PH]], label %[[VECTOR_PH:.*]]
19 ; CHECK: [[VECTOR_PH]]:
20 ; CHECK-NEXT: [[BROADCAST_SPLATINSERT2:%.*]] = insertelement <2 x ptr> poison, ptr [[DST]], i64 0
21 ; CHECK-NEXT: [[BROADCAST_SPLAT3:%.*]] = shufflevector <2 x ptr> [[BROADCAST_SPLATINSERT2]], <2 x ptr> poison, <2 x i32> zeroinitializer
22 ; CHECK-NEXT: br label %[[VECTOR_BODY:.*]]
23 ; CHECK: [[VECTOR_BODY]]:
24 ; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]
25 ; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[SRC]], align 4, !alias.scope [[META0:![0-9]+]]
26 ; CHECK-NEXT: [[BROADCAST_SPLATINSERT4:%.*]] = insertelement <2 x i32> poison, i32 [[TMP0]], i64 0
27 ; CHECK-NEXT: [[BROADCAST_SPLAT5:%.*]] = shufflevector <2 x i32> [[BROADCAST_SPLATINSERT4]], <2 x i32> poison, <2 x i32> zeroinitializer
28 ; CHECK-NEXT: call void @llvm.masked.scatter.v2i32.v2p0(<2 x i32> [[BROADCAST_SPLAT5]], <2 x ptr> [[BROADCAST_SPLAT3]], i32 4, <2 x i1> <i1 true, i1 true>), !alias.scope [[META3:![0-9]+]], !noalias [[META0]]
29 ; CHECK-NEXT: call void @llvm.masked.scatter.v2i32.v2p0(<2 x i32> [[BROADCAST_SPLAT5]], <2 x ptr> [[BROADCAST_SPLAT3]], i32 4, <2 x i1> <i1 true, i1 true>), !alias.scope [[META3]], !noalias [[META0]]
30 ; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4
31 ; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i64 [[INDEX_NEXT]], 100
32 ; CHECK-NEXT: br i1 [[TMP1]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP5:![0-9]+]]
33 ; CHECK: [[MIDDLE_BLOCK]]:
34 ; CHECK-NEXT: br i1 true, label %[[EXIT:.*]], label %[[SCALAR_PH]]
35 ; CHECK: [[SCALAR_PH]]:
36 ; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 100, %[[MIDDLE_BLOCK]] ], [ 0, %[[ENTRY]] ], [ 0, %[[VECTOR_MEMCHECK]] ]
37 ; CHECK-NEXT: br label %[[LOOP:.*]]
39 ; CHECK-NEXT: [[TMP2:%.*]] = phi i64 [ [[BC_RESUME_VAL]], %[[SCALAR_PH]] ], [ [[TMP3:%.*]], %[[LOOP]] ]
40 ; CHECK-NEXT: [[DOTPRE:%.*]] = load i32, ptr [[SRC]], align 4
41 ; CHECK-NEXT: store i32 [[DOTPRE]], ptr [[DST]], align 4
42 ; CHECK-NEXT: [[TMP3]] = add nuw i64 [[TMP2]], 1
43 ; CHECK-NEXT: [[EC:%.*]] = icmp eq i64 [[TMP3]], 100
44 ; CHECK-NEXT: br i1 [[EC]], label %[[EXIT]], label %[[LOOP]], !llvm.loop [[LOOP8:![0-9]+]]
46 ; CHECK-NEXT: ret void
52 %0 = phi i64 [ 0, %entry ], [ %1, %loop ]
53 %.pre = load i32, ptr %src, align 4
54 store i32 %.pre, ptr %dst, align 4
55 %1 = add nuw i64 %0, 1
56 %ec = icmp eq i64 %1, 100
57 br i1 %ec, label %exit, label %loop
63 ; CHECK: [[META0]] = !{[[META1:![0-9]+]]}
64 ; CHECK: [[META1]] = distinct !{[[META1]], [[META2:![0-9]+]]}
65 ; CHECK: [[META2]] = distinct !{[[META2]], !"LVerDomain"}
66 ; CHECK: [[META3]] = !{[[META4:![0-9]+]]}
67 ; CHECK: [[META4]] = distinct !{[[META4]], [[META2]]}
68 ; CHECK: [[LOOP5]] = distinct !{[[LOOP5]], [[META6:![0-9]+]], [[META7:![0-9]+]]}
69 ; CHECK: [[META6]] = !{!"llvm.loop.isvectorized", i32 1}
70 ; CHECK: [[META7]] = !{!"llvm.loop.unroll.runtime.disable"}
71 ; CHECK: [[LOOP8]] = distinct !{[[LOOP8]], [[META6]]}