4
4
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
5
5
target triple = "x86_64-unknown-linux-gnu"
6
6
7
+ ; FIXME: !llvm.access.group should be preserved, loop should be vectorized.
7
8
; End-to-end test for https://github.com/llvm/llvm-project/issues/115595.
8
9
define void @test (i32 noundef %nface , i32 noundef %ncell , ptr noalias noundef %face_cell , ptr noalias noundef %x , ptr noalias noundef %y ) #0 {
9
10
; CHECK-LABEL: define void @test(
@@ -14,16 +15,16 @@ define void @test(i32 noundef %nface, i32 noundef %ncell, ptr noalias noundef %f
14
15
; CHECK: [[FOR_BODY_PREHEADER]]:
15
16
; CHECK-NEXT: [[TMP0:%.*]] = zext nneg i32 [[NFACE]] to i64
16
17
; CHECK-NEXT: [[INVARIANT_GEP:%.*]] = getelementptr inbounds nuw i32, ptr [[FACE_CELL]], i64 [[TMP0]]
17
- ; CHECK-NEXT: [[MIN_ITERS_CHECK :%.*]] = icmp ult i32 [[NFACE]], 4
18
- ; CHECK-NEXT: br i1 [[MIN_ITERS_CHECK ]], label %[[FOR_BODY_PREHEADER14:.*]], label %[[VECTOR_PH:.*]]
18
+ ; CHECK-NEXT: [[TMP1 :%.*]] = icmp ult i32 [[NFACE]], 4
19
+ ; CHECK-NEXT: br i1 [[TMP1 ]], label %[[FOR_BODY_PREHEADER14:.*]], label %[[VECTOR_PH:.*]]
19
20
; CHECK: [[VECTOR_PH]]:
20
- ; CHECK-NEXT: [[N_VEC :%.*]] = and i64 [[TMP0]], 2147483644
21
+ ; CHECK-NEXT: [[UNROLL_ITER :%.*]] = and i64 [[TMP0]], 2147483644
21
22
; CHECK-NEXT: br label %[[VECTOR_BODY:.*]]
22
23
; CHECK: [[VECTOR_BODY]]:
23
- ; CHECK-NEXT: [[INDEX :%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]
24
- ; CHECK-NEXT: [[TMP1 :%.*]] = getelementptr inbounds nuw i32, ptr [[FACE_CELL]], i64 [[INDEX ]]
25
- ; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[TMP1 ]], align 4, !tbaa [[TBAA0:![0-9]+]], !llvm.access.group [[ACC_GRP4:![0-9]+]]
26
- ; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds nuw i32, ptr [[INVARIANT_GEP]], i64 [[INDEX ]]
24
+ ; CHECK-NEXT: [[INDVARS_IV_EPIL :%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]
25
+ ; CHECK-NEXT: [[TMP10 :%.*]] = getelementptr inbounds nuw i32, ptr [[FACE_CELL]], i64 [[INDVARS_IV_EPIL ]]
26
+ ; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[TMP10 ]], align 4, !tbaa [[TBAA0:![0-9]+]], !llvm.access.group [[ACC_GRP4:![0-9]+]]
27
+ ; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds nuw i32, ptr [[INVARIANT_GEP]], i64 [[INDVARS_IV_EPIL ]]
27
28
; CHECK-NEXT: [[WIDE_LOAD12:%.*]] = load <4 x i32>, ptr [[TMP2]], align 4, !tbaa [[TBAA0]], !llvm.access.group [[ACC_GRP4]]
28
29
; CHECK-NEXT: [[TMP3:%.*]] = sext <4 x i32> [[WIDE_LOAD]] to <4 x i64>
29
30
; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds double, ptr [[Y]], <4 x i64> [[TMP3]]
@@ -34,14 +35,14 @@ define void @test(i32 noundef %nface, i32 noundef %ncell, ptr noalias noundef %f
34
35
; CHECK-NEXT: [[TMP7:%.*]] = fcmp fast olt <4 x double> [[WIDE_MASKED_GATHER]], [[WIDE_MASKED_GATHER13]]
35
36
; CHECK-NEXT: [[TMP8:%.*]] = select <4 x i1> [[TMP7]], <4 x double> [[WIDE_MASKED_GATHER13]], <4 x double> [[WIDE_MASKED_GATHER]]
36
37
; CHECK-NEXT: tail call void @llvm.masked.scatter.v4f64.v4p0(<4 x double> [[TMP8]], <4 x ptr> [[TMP4]], i32 8, <4 x i1> splat (i1 true)), !tbaa [[TBAA5]], !llvm.access.group [[ACC_GRP4]]
37
- ; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX ]], 4
38
- ; CHECK-NEXT: [[TMP9:%.*]] = icmp eq i64 [[INDEX_NEXT]], [[N_VEC ]]
38
+ ; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDVARS_IV_EPIL ]], 4
39
+ ; CHECK-NEXT: [[TMP9:%.*]] = icmp eq i64 [[INDEX_NEXT]], [[UNROLL_ITER ]]
39
40
; CHECK-NEXT: br i1 [[TMP9]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP7:![0-9]+]]
40
41
; CHECK: [[MIDDLE_BLOCK]]:
41
- ; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i64 [[N_VEC ]], [[TMP0]]
42
+ ; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i64 [[UNROLL_ITER ]], [[TMP0]]
42
43
; CHECK-NEXT: br i1 [[CMP_N]], label %[[FOR_COND_CLEANUP]], label %[[FOR_BODY_PREHEADER14]]
43
44
; CHECK: [[FOR_BODY_PREHEADER14]]:
44
- ; CHECK-NEXT: [[INDVARS_IV_PH:%.*]] = phi i64 [ 0, %[[FOR_BODY_PREHEADER]] ], [ [[N_VEC ]], %[[MIDDLE_BLOCK]] ]
45
+ ; CHECK-NEXT: [[INDVARS_IV_PH:%.*]] = phi i64 [ 0, %[[FOR_BODY_PREHEADER]] ], [ [[UNROLL_ITER ]], %[[MIDDLE_BLOCK]] ]
45
46
; CHECK-NEXT: br label %[[FOR_BODY:.*]]
46
47
; CHECK: [[FOR_COND_CLEANUP]]:
47
48
; CHECK-NEXT: ret void
0 commit comments