Skip to content

Commit f76921a

Browse files
[GVN] Regenerate test checks to use UTC (NFC)
Tests have been regenerated to favour UTC-emitted lines. While this may not be strictly necessary – as the final migration to MemorySSA should boil down to a simple flip –, adopting UTC-based lines should overall make tests more robust as well as easier to diff (at least on the majority of the tests instances where the new lines have been added). Crash tests now feature check lines as well (notably, pr17852.ll, pr24397.ll and unreachable_block_infinite_loop.ll). Pre-2010 tests leveraging llvm-dis have not been updated.
1 parent ccae485 commit f76921a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1809
-665
lines changed

llvm/test/Transforms/GVN/2011-07-07-MatchIntrinsicExtract.ll

Lines changed: 61 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,120 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
12
; RUN: opt < %s -passes=gvn -S | FileCheck %s
2-
;
33

44
%0 = type { i64, i1 }
55

66
define i64 @test1(i64 %a, i64 %b) nounwind ssp {
7+
; CHECK-LABEL: define i64 @test1(
8+
; CHECK-SAME: i64 [[A:%.*]], i64 [[B:%.*]]) #[[ATTR0:[0-9]+]] {
9+
; CHECK-NEXT: [[ENTRY:.*:]]
10+
; CHECK-NEXT: [[TMP0:%.*]] = call { i64, i1 } @llvm.uadd.with.overflow.i64(i64 [[A]], i64 [[B]])
11+
; CHECK-NEXT: [[TMP1:%.*]] = extractvalue { i64, i1 } [[TMP0]], 0
12+
; CHECK-NEXT: [[TMP2:%.*]] = insertvalue [[TMP0]] poison, i64 [[TMP1]], 0
13+
; CHECK-NEXT: [[TMP3:%.*]] = extractvalue { i64, i1 } [[TMP0]], 1
14+
; CHECK-NEXT: [[TMP4:%.*]] = insertvalue [[TMP0]] [[TMP2]], i1 [[TMP3]], 1
15+
; CHECK-NEXT: ret i64 [[TMP1]]
16+
;
717
entry:
818
%uadd = tail call %0 @llvm.uadd.with.overflow.i64(i64 %a, i64 %b)
919
%uadd.0 = extractvalue %0 %uadd, 0
1020
%add1 = add i64 %a, %b
1121
ret i64 %add1
1222
}
1323

14-
; CHECK-LABEL: @test1(
15-
; CHECK-NOT: add1
16-
; CHECK: ret
17-
1824
define i64 @test2(i64 %a, i64 %b) nounwind ssp {
25+
; CHECK-LABEL: define i64 @test2(
26+
; CHECK-SAME: i64 [[A:%.*]], i64 [[B:%.*]]) #[[ATTR0]] {
27+
; CHECK-NEXT: [[ENTRY:.*:]]
28+
; CHECK-NEXT: [[TMP0:%.*]] = call { i64, i1 } @llvm.usub.with.overflow.i64(i64 [[A]], i64 [[B]])
29+
; CHECK-NEXT: [[TMP1:%.*]] = extractvalue { i64, i1 } [[TMP0]], 0
30+
; CHECK-NEXT: [[TMP2:%.*]] = insertvalue [[TMP0]] poison, i64 [[TMP1]], 0
31+
; CHECK-NEXT: [[TMP3:%.*]] = extractvalue { i64, i1 } [[TMP0]], 1
32+
; CHECK-NEXT: [[TMP4:%.*]] = insertvalue [[TMP0]] [[TMP2]], i1 [[TMP3]], 1
33+
; CHECK-NEXT: ret i64 [[TMP1]]
34+
;
1935
entry:
2036
%usub = tail call %0 @llvm.usub.with.overflow.i64(i64 %a, i64 %b)
2137
%usub.0 = extractvalue %0 %usub, 0
2238
%sub1 = sub i64 %a, %b
2339
ret i64 %sub1
2440
}
2541

26-
; CHECK-LABEL: @test2(
27-
; CHECK-NOT: sub1
28-
; CHECK: ret
29-
3042
define i64 @test3(i64 %a, i64 %b) nounwind ssp {
43+
; CHECK-LABEL: define i64 @test3(
44+
; CHECK-SAME: i64 [[A:%.*]], i64 [[B:%.*]]) #[[ATTR0]] {
45+
; CHECK-NEXT: [[ENTRY:.*:]]
46+
; CHECK-NEXT: [[TMP0:%.*]] = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 [[A]], i64 [[B]])
47+
; CHECK-NEXT: [[TMP1:%.*]] = extractvalue { i64, i1 } [[TMP0]], 0
48+
; CHECK-NEXT: [[TMP2:%.*]] = insertvalue [[TMP0]] poison, i64 [[TMP1]], 0
49+
; CHECK-NEXT: [[TMP3:%.*]] = extractvalue { i64, i1 } [[TMP0]], 1
50+
; CHECK-NEXT: [[TMP4:%.*]] = insertvalue [[TMP0]] [[TMP2]], i1 [[TMP3]], 1
51+
; CHECK-NEXT: ret i64 [[TMP1]]
52+
;
3153
entry:
3254
%umul = tail call %0 @llvm.umul.with.overflow.i64(i64 %a, i64 %b)
3355
%umul.0 = extractvalue %0 %umul, 0
3456
%mul1 = mul i64 %a, %b
3557
ret i64 %mul1
3658
}
3759

38-
; CHECK-LABEL: @test3(
39-
; CHECK-NOT: mul1
40-
; CHECK: ret
41-
4260
define i64 @test4(i64 %a, i64 %b) nounwind ssp {
61+
; CHECK-LABEL: define i64 @test4(
62+
; CHECK-SAME: i64 [[A:%.*]], i64 [[B:%.*]]) #[[ATTR0]] {
63+
; CHECK-NEXT: [[ENTRY:.*:]]
64+
; CHECK-NEXT: [[TMP0:%.*]] = call { i64, i1 } @llvm.sadd.with.overflow.i64(i64 [[A]], i64 [[B]])
65+
; CHECK-NEXT: [[TMP1:%.*]] = extractvalue { i64, i1 } [[TMP0]], 0
66+
; CHECK-NEXT: [[TMP2:%.*]] = insertvalue [[TMP0]] poison, i64 [[TMP1]], 0
67+
; CHECK-NEXT: [[TMP3:%.*]] = extractvalue { i64, i1 } [[TMP0]], 1
68+
; CHECK-NEXT: [[TMP4:%.*]] = insertvalue [[TMP0]] [[TMP2]], i1 [[TMP3]], 1
69+
; CHECK-NEXT: ret i64 [[TMP1]]
70+
;
4371
entry:
4472
%sadd = tail call %0 @llvm.sadd.with.overflow.i64(i64 %a, i64 %b)
4573
%sadd.0 = extractvalue %0 %sadd, 0
4674
%add1 = add i64 %a, %b
4775
ret i64 %add1
4876
}
4977

50-
; CHECK-LABEL: @test4(
51-
; CHECK-NOT: add1
52-
; CHECK: ret
53-
5478
define i64 @test5(i64 %a, i64 %b) nounwind ssp {
79+
; CHECK-LABEL: define i64 @test5(
80+
; CHECK-SAME: i64 [[A:%.*]], i64 [[B:%.*]]) #[[ATTR0]] {
81+
; CHECK-NEXT: [[ENTRY:.*:]]
82+
; CHECK-NEXT: [[TMP0:%.*]] = call { i64, i1 } @llvm.ssub.with.overflow.i64(i64 [[A]], i64 [[B]])
83+
; CHECK-NEXT: [[TMP1:%.*]] = extractvalue { i64, i1 } [[TMP0]], 0
84+
; CHECK-NEXT: [[TMP2:%.*]] = insertvalue [[TMP0]] poison, i64 [[TMP1]], 0
85+
; CHECK-NEXT: [[TMP3:%.*]] = extractvalue { i64, i1 } [[TMP0]], 1
86+
; CHECK-NEXT: [[TMP4:%.*]] = insertvalue [[TMP0]] [[TMP2]], i1 [[TMP3]], 1
87+
; CHECK-NEXT: ret i64 [[TMP1]]
88+
;
5589
entry:
5690
%ssub = tail call %0 @llvm.ssub.with.overflow.i64(i64 %a, i64 %b)
5791
%ssub.0 = extractvalue %0 %ssub, 0
5892
%sub1 = sub i64 %a, %b
5993
ret i64 %sub1
6094
}
6195

62-
; CHECK-LABEL: @test5(
63-
; CHECK-NOT: sub1
64-
; CHECK: ret
65-
6696
define i64 @test6(i64 %a, i64 %b) nounwind ssp {
97+
; CHECK-LABEL: define i64 @test6(
98+
; CHECK-SAME: i64 [[A:%.*]], i64 [[B:%.*]]) #[[ATTR0]] {
99+
; CHECK-NEXT: [[ENTRY:.*:]]
100+
; CHECK-NEXT: [[TMP0:%.*]] = call { i64, i1 } @llvm.smul.with.overflow.i64(i64 [[A]], i64 [[B]])
101+
; CHECK-NEXT: [[TMP1:%.*]] = extractvalue { i64, i1 } [[TMP0]], 0
102+
; CHECK-NEXT: [[TMP2:%.*]] = insertvalue [[TMP0]] poison, i64 [[TMP1]], 0
103+
; CHECK-NEXT: [[TMP3:%.*]] = extractvalue { i64, i1 } [[TMP0]], 1
104+
; CHECK-NEXT: [[TMP4:%.*]] = insertvalue [[TMP0]] [[TMP2]], i1 [[TMP3]], 1
105+
; CHECK-NEXT: ret i64 [[TMP1]]
106+
;
67107
entry:
68108
%smul = tail call %0 @llvm.smul.with.overflow.i64(i64 %a, i64 %b)
69109
%smul.0 = extractvalue %0 %smul, 0
70110
%mul1 = mul i64 %a, %b
71111
ret i64 %mul1
72112
}
73113

74-
; CHECK-LABEL: @test6(
75-
; CHECK-NOT: mul1
76-
; CHECK: ret
77-
78114
declare void @exit(i32) noreturn
79115
declare %0 @llvm.uadd.with.overflow.i64(i64, i64) nounwind readnone
80116
declare %0 @llvm.usub.with.overflow.i64(i64, i64) nounwind readnone
81117
declare %0 @llvm.umul.with.overflow.i64(i64, i64) nounwind readnone
82118
declare %0 @llvm.sadd.with.overflow.i64(i64, i64) nounwind readnone
83119
declare %0 @llvm.ssub.with.overflow.i64(i64, i64) nounwind readnone
84120
declare %0 @llvm.smul.with.overflow.i64(i64, i64) nounwind readnone
85-

llvm/test/Transforms/GVN/2011-09-07-TypeIdFor.ll

Lines changed: 53 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
12
; RUN: opt < %s -passes=gvn -S | FileCheck %s
3+
24
%struct.__fundamental_type_info_pseudo = type { %struct.__type_info_pseudo }
35
%struct.__type_info_pseudo = type { ptr, ptr }
46

@@ -18,26 +20,70 @@ declare void @__cxa_end_catch()
1820
declare i32 @__gxx_personality_v0(i32, i64, ptr, ptr)
1921

2022
define void @_Z3foov() uwtable personality ptr @__gxx_personality_v0 {
23+
; CHECK-LABEL: define void @_Z3foov(
24+
; CHECK-SAME: ) #[[ATTR1:[0-9]+]] personality ptr @__gxx_personality_v0 {
25+
; CHECK-NEXT: [[ENTRY:.*:]]
26+
; CHECK-NEXT: invoke void @_Z4barv()
27+
; CHECK-NEXT: to label %[[RETURN:.*]] unwind label %[[LPAD:.*]]
28+
; CHECK: [[LPAD]]:
29+
; CHECK-NEXT: [[TMP0:%.*]] = landingpad { ptr, i32 }
30+
; CHECK-NEXT: catch ptr @_ZTIi
31+
; CHECK-NEXT: catch ptr @_ZTIb
32+
; CHECK-NEXT: catch ptr @_ZTIi
33+
; CHECK-NEXT: catch ptr @_ZTIb
34+
; CHECK-NEXT: [[EXC_PTR2_I:%.*]] = extractvalue { ptr, i32 } [[TMP0]], 0
35+
; CHECK-NEXT: [[FILTER3_I:%.*]] = extractvalue { ptr, i32 } [[TMP0]], 1
36+
; CHECK-NEXT: [[TYPEID_I:%.*]] = tail call i32 @llvm.eh.typeid.for.p0(ptr @_ZTIi)
37+
; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i32 [[FILTER3_I]], [[TYPEID_I]]
38+
; CHECK-NEXT: br i1 [[TMP1]], label %[[PPAD:.*]], label %[[NEXT:.*]]
39+
; CHECK: [[NEXT]]:
40+
; CHECK-NEXT: [[TYPEID1_I:%.*]] = tail call i32 @llvm.eh.typeid.for.p0(ptr @_ZTIb)
41+
; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[FILTER3_I]], [[TYPEID1_I]]
42+
; CHECK-NEXT: br i1 [[TMP2]], label %[[PPAD2:.*]], label %[[NEXT2:.*]]
43+
; CHECK: [[PPAD]]:
44+
; CHECK-NEXT: [[TMP3:%.*]] = tail call ptr @__cxa_begin_catch(ptr [[EXC_PTR2_I]]) #[[ATTR0:[0-9]+]]
45+
; CHECK-NEXT: tail call void @__cxa_end_catch() #[[ATTR0]]
46+
; CHECK-NEXT: br label %[[RETURN]]
47+
; CHECK: [[PPAD2]]:
48+
; CHECK-NEXT: [[D_2073_5_I:%.*]] = tail call ptr @__cxa_begin_catch(ptr [[EXC_PTR2_I]]) #[[ATTR0]]
49+
; CHECK-NEXT: tail call void @__cxa_end_catch() #[[ATTR0]]
50+
; CHECK-NEXT: br label %[[RETURN]]
51+
; CHECK: [[NEXT2]]:
52+
; CHECK-NEXT: call void @_Z7cleanupv()
53+
; CHECK-NEXT: br i1 false, label %[[PPAD3:.*]], label %[[NEXT3:.*]]
54+
; CHECK: [[NEXT3]]:
55+
; CHECK-NEXT: br i1 false, label %[[PPAD4:.*]], label %[[UNWIND:.*]]
56+
; CHECK: [[UNWIND]]:
57+
; CHECK-NEXT: resume { ptr, i32 } [[TMP0]]
58+
; CHECK: [[PPAD3]]:
59+
; CHECK-NEXT: [[TMP4:%.*]] = tail call ptr @__cxa_begin_catch(ptr [[EXC_PTR2_I]]) #[[ATTR0]]
60+
; CHECK-NEXT: tail call void @__cxa_end_catch() #[[ATTR0]]
61+
; CHECK-NEXT: br label %[[RETURN]]
62+
; CHECK: [[PPAD4]]:
63+
; CHECK-NEXT: [[D_2080_5:%.*]] = tail call ptr @__cxa_begin_catch(ptr [[EXC_PTR2_I]]) #[[ATTR0]]
64+
; CHECK-NEXT: tail call void @__cxa_end_catch() #[[ATTR0]]
65+
; CHECK-NEXT: br label %[[RETURN]]
66+
; CHECK: [[RETURN]]:
67+
; CHECK-NEXT: ret void
68+
;
2169
entry:
2270
invoke void @_Z4barv()
23-
to label %return unwind label %lpad
71+
to label %return unwind label %lpad
2472

2573
lpad: ; preds = %entry
2674
%0 = landingpad { ptr, i32 }
27-
catch ptr @_ZTIi
28-
catch ptr @_ZTIb
29-
catch ptr @_ZTIi
30-
catch ptr @_ZTIb
75+
catch ptr @_ZTIi
76+
catch ptr @_ZTIb
77+
catch ptr @_ZTIi
78+
catch ptr @_ZTIb
3179
%exc_ptr2.i = extractvalue { ptr, i32 } %0, 0
3280
%filter3.i = extractvalue { ptr, i32 } %0, 1
3381
%typeid.i = tail call i32 @llvm.eh.typeid.for(ptr @_ZTIi)
34-
; CHECK: call i32 @llvm.eh.typeid.for
3582
%1 = icmp eq i32 %filter3.i, %typeid.i
3683
br i1 %1, label %ppad, label %next
3784

3885
next: ; preds = %lpad
3986
%typeid1.i = tail call i32 @llvm.eh.typeid.for(ptr @_ZTIb)
40-
; CHECK: call i32 @llvm.eh.typeid.for
4187
%2 = icmp eq i32 %filter3.i, %typeid1.i
4288
br i1 %2, label %ppad2, label %next2
4389

@@ -54,7 +100,6 @@ ppad2: ; preds = %next
54100
next2: ; preds = %next
55101
call void @_Z7cleanupv()
56102
%typeid = tail call i32 @llvm.eh.typeid.for(ptr @_ZTIi)
57-
; CHECK-NOT: call i32 @llvm.eh.typeid.for
58103
%4 = icmp eq i32 %filter3.i, %typeid
59104
br i1 %4, label %ppad3, label %next3
60105

llvm/test/Transforms/GVN/2012-05-22-PreCrash.ll

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,35 @@
1-
; RUN: opt < %s -passes=gvn
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
2+
; RUN: opt < %s -passes=gvn -S | FileCheck %s
3+
24
; PR12858
35

46
define void @fn5(i16 signext %p1, i8 signext %p2, i1 %arg) nounwind uwtable {
7+
; CHECK-LABEL: define void @fn5(
8+
; CHECK-SAME: i16 signext [[P1:%.*]], i8 signext [[P2:%.*]], i1 [[ARG:%.*]]) #[[ATTR0:[0-9]+]] {
9+
; CHECK-NEXT: [[ENTRY:.*:]]
10+
; CHECK-NEXT: br i1 [[ARG]], label %[[IF_ELSE:.*]], label %[[IF_THEN:.*]]
11+
; CHECK: [[IF_THEN]]:
12+
; CHECK-NEXT: [[DOTPRE:%.*]] = sext i16 [[P1]] to i32
13+
; CHECK-NEXT: br label %[[IF_END:.*]]
14+
; CHECK: [[IF_ELSE]]:
15+
; CHECK-NEXT: [[CONV:%.*]] = sext i16 [[P1]] to i32
16+
; CHECK-NEXT: br label %[[IF_END]]
17+
; CHECK: [[IF_END]]:
18+
; CHECK-NEXT: [[CONV1_PRE_PHI:%.*]] = phi i32 [ [[CONV]], %[[IF_ELSE]] ], [ [[DOTPRE]], %[[IF_THEN]] ]
19+
; CHECK-NEXT: br i1 [[ARG]], label %[[IF_THEN3:.*]], label %[[IF_ELSE4:.*]]
20+
; CHECK: [[IF_THEN3]]:
21+
; CHECK-NEXT: [[DOTPRE1:%.*]] = sext i8 [[P2]] to i32
22+
; CHECK-NEXT: br label %[[IF_END12:.*]]
23+
; CHECK: [[IF_ELSE4]]:
24+
; CHECK-NEXT: [[CONV7:%.*]] = sext i8 [[P2]] to i32
25+
; CHECK-NEXT: [[CMP8:%.*]] = icmp eq i32 [[CONV1_PRE_PHI]], [[CONV7]]
26+
; CHECK-NEXT: br i1 [[CMP8]], label %[[IF_THEN10:.*]], label %[[IF_END12]]
27+
; CHECK: [[IF_THEN10]]:
28+
; CHECK-NEXT: br label %[[IF_END12]]
29+
; CHECK: [[IF_END12]]:
30+
; CHECK-NEXT: [[CONV13_PRE_PHI:%.*]] = phi i32 [ [[CONV7]], %[[IF_THEN10]] ], [ [[CONV7]], %[[IF_ELSE4]] ], [ [[DOTPRE1]], %[[IF_THEN3]] ]
31+
; CHECK-NEXT: ret void
32+
;
533
entry:
634
br i1 %arg, label %if.else, label %if.then
735

llvm/test/Transforms/GVN/2016-08-30-MaskedScatterGather-inseltpoison.ll

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,34 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
12
; RUN: opt < %s -passes=gvn -S | FileCheck %s
23

34
declare void @llvm.masked.scatter.v2i32.v2p0(<2 x i32> , <2 x ptr> , i32 , <2 x i1> )
45
declare <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr>, i32, <2 x i1>, <2 x i32>)
56

67
; This test ensures that masked scatter and gather operations, which take vectors of pointers,
78
; do not have pointer aliasing ignored when being processed.
8-
; No scatter/gather calls should end up eliminated
9-
; CHECK: llvm.masked.gather
10-
; CHECK: llvm.masked.gather
11-
; CHECK: llvm.masked.scatter
12-
; CHECK: llvm.masked.gather
13-
; CHECK: llvm.masked.scatter
14-
; CHECK: llvm.masked.gather
9+
; No scatter/gather calls should end up eliminated.
10+
1511
define spir_kernel void @test(<2 x ptr> %in1, <2 x ptr> %in2, ptr %out) {
12+
; CHECK-LABEL: define spir_kernel void @test(
13+
; CHECK-SAME: <2 x ptr> [[IN1:%.*]], <2 x ptr> [[IN2:%.*]], ptr [[OUT:%.*]]) {
14+
; CHECK-NEXT: [[ENTRY:.*:]]
15+
; CHECK-NEXT: [[TMP_0:%.*]] = alloca i32, align 4
16+
; CHECK-NEXT: [[TMP_1:%.*]] = alloca i32, align 4
17+
; CHECK-NEXT: [[TMP_I:%.*]] = insertelement <2 x ptr> poison, ptr [[TMP_0]], i32 0
18+
; CHECK-NEXT: [[TMP:%.*]] = insertelement <2 x ptr> [[TMP_I]], ptr [[TMP_1]], i32 1
19+
; CHECK-NEXT: [[IN1_V:%.*]] = call <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr> [[IN1]], i32 1, <2 x i1> splat (i1 true), <2 x i32> undef)
20+
; CHECK-NEXT: [[IN2_V:%.*]] = call <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr> [[IN2]], i32 1, <2 x i1> splat (i1 true), <2 x i32> undef)
21+
; CHECK-NEXT: call void @llvm.masked.scatter.v2i32.v2p0(<2 x i32> [[IN1_V]], <2 x ptr> [[TMP]], i32 1, <2 x i1> splat (i1 true))
22+
; CHECK-NEXT: [[TMP_V_0:%.*]] = call <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr> [[TMP]], i32 1, <2 x i1> splat (i1 true), <2 x i32> undef)
23+
; CHECK-NEXT: call void @llvm.masked.scatter.v2i32.v2p0(<2 x i32> [[IN2_V]], <2 x ptr> [[TMP]], i32 1, <2 x i1> splat (i1 true))
24+
; CHECK-NEXT: [[TMP_V_1:%.*]] = call <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr> [[TMP]], i32 1, <2 x i1> splat (i1 true), <2 x i32> undef)
25+
; CHECK-NEXT: [[TMP_V_1_0:%.*]] = extractelement <2 x i32> [[TMP_V_1]], i32 0
26+
; CHECK-NEXT: [[TMP_V_1_1:%.*]] = extractelement <2 x i32> [[TMP_V_1]], i32 1
27+
; CHECK-NEXT: store i32 [[TMP_V_1_0]], ptr [[OUT]], align 4
28+
; CHECK-NEXT: [[OUT_1:%.*]] = getelementptr i32, ptr [[OUT]], i32 1
29+
; CHECK-NEXT: store i32 [[TMP_V_1_1]], ptr [[OUT_1]], align 4
30+
; CHECK-NEXT: ret void
31+
;
1632
entry:
1733
; Just some temporary storage
1834
%tmp.0 = alloca i32

llvm/test/Transforms/GVN/2016-08-30-MaskedScatterGather.ll

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,34 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
12
; RUN: opt < %s -passes=gvn -S | FileCheck %s
23

34
declare void @llvm.masked.scatter.v2i32.v2p0(<2 x i32> , <2 x ptr> , i32 , <2 x i1> )
45
declare <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr>, i32, <2 x i1>, <2 x i32>)
56

67
; This test ensures that masked scatter and gather operations, which take vectors of pointers,
78
; do not have pointer aliasing ignored when being processed.
8-
; No scatter/gather calls should end up eliminated
9-
; CHECK: llvm.masked.gather
10-
; CHECK: llvm.masked.gather
11-
; CHECK: llvm.masked.scatter
12-
; CHECK: llvm.masked.gather
13-
; CHECK: llvm.masked.scatter
14-
; CHECK: llvm.masked.gather
9+
; No scatter/gather calls should end up eliminated.
10+
1511
define spir_kernel void @test(<2 x ptr> %in1, <2 x ptr> %in2, ptr %out) {
12+
; CHECK-LABEL: define spir_kernel void @test(
13+
; CHECK-SAME: <2 x ptr> [[IN1:%.*]], <2 x ptr> [[IN2:%.*]], ptr [[OUT:%.*]]) {
14+
; CHECK-NEXT: [[ENTRY:.*:]]
15+
; CHECK-NEXT: [[TMP_0:%.*]] = alloca i32, align 4
16+
; CHECK-NEXT: [[TMP_1:%.*]] = alloca i32, align 4
17+
; CHECK-NEXT: [[TMP_I:%.*]] = insertelement <2 x ptr> undef, ptr [[TMP_0]], i32 0
18+
; CHECK-NEXT: [[TMP:%.*]] = insertelement <2 x ptr> [[TMP_I]], ptr [[TMP_1]], i32 1
19+
; CHECK-NEXT: [[IN1_V:%.*]] = call <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr> [[IN1]], i32 1, <2 x i1> splat (i1 true), <2 x i32> undef)
20+
; CHECK-NEXT: [[IN2_V:%.*]] = call <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr> [[IN2]], i32 1, <2 x i1> splat (i1 true), <2 x i32> undef)
21+
; CHECK-NEXT: call void @llvm.masked.scatter.v2i32.v2p0(<2 x i32> [[IN1_V]], <2 x ptr> [[TMP]], i32 1, <2 x i1> splat (i1 true))
22+
; CHECK-NEXT: [[TMP_V_0:%.*]] = call <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr> [[TMP]], i32 1, <2 x i1> splat (i1 true), <2 x i32> undef)
23+
; CHECK-NEXT: call void @llvm.masked.scatter.v2i32.v2p0(<2 x i32> [[IN2_V]], <2 x ptr> [[TMP]], i32 1, <2 x i1> splat (i1 true))
24+
; CHECK-NEXT: [[TMP_V_1:%.*]] = call <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr> [[TMP]], i32 1, <2 x i1> splat (i1 true), <2 x i32> undef)
25+
; CHECK-NEXT: [[TMP_V_1_0:%.*]] = extractelement <2 x i32> [[TMP_V_1]], i32 0
26+
; CHECK-NEXT: [[TMP_V_1_1:%.*]] = extractelement <2 x i32> [[TMP_V_1]], i32 1
27+
; CHECK-NEXT: store i32 [[TMP_V_1_0]], ptr [[OUT]], align 4
28+
; CHECK-NEXT: [[OUT_1:%.*]] = getelementptr i32, ptr [[OUT]], i32 1
29+
; CHECK-NEXT: store i32 [[TMP_V_1_1]], ptr [[OUT_1]], align 4
30+
; CHECK-NEXT: ret void
31+
;
1632
entry:
1733
; Just some temporary storage
1834
%tmp.0 = alloca i32

0 commit comments

Comments
 (0)