Skip to content

Commit 9ff36df

Browse files
committed
[PGO][InstrProf][test] Convert to opaque pointers and fix some stale tests
1 parent 6cbfffb commit 9ff36df

File tree

82 files changed

+1070
-1166
lines changed

Some content is hidden

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

82 files changed

+1070
-1166
lines changed

llvm/test/Instrumentation/InstrProfiling/always_inline.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ entry:
2020
ret i32 %call
2121
}
2222

23-
declare void @llvm.instrprof.increment(i8*, i64, i32, i32) #0
23+
declare void @llvm.instrprof.increment(ptr, i64, i32, i32) #0
2424

2525
define available_externally i32 @foo() #1 {
2626
entry:
27-
call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 0, i32 1, i32 0)
27+
call void @llvm.instrprof.increment(ptr @__profn_foo, i64 0, i32 1, i32 0)
2828
ret i32 0
2929
}
3030

llvm/test/Instrumentation/InstrProfiling/atomic-updates.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ target triple = "x86_64-apple-macosx10.10.0"
55
@__profn_foo = private constant [3 x i8] c"foo"
66

77
; CHECK-LABEL: define void @foo
8-
; CHECK-NEXT: atomicrmw add i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_foo, i32 0, i32 0), i64 1 monotonic
8+
; CHECK-NEXT: atomicrmw add ptr @__profc_foo, i64 1 monotonic
99
define void @foo() {
10-
call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 0, i32 1, i32 0)
10+
call void @llvm.instrprof.increment(ptr @__profn_foo, i64 0, i32 1, i32 0)
1111
ret void
1212
}
1313

14-
declare void @llvm.instrprof.increment(i8*, i64, i32, i32)
14+
declare void @llvm.instrprof.increment(ptr, i64, i32, i32)

llvm/test/Instrumentation/InstrProfiling/comdat.ll

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
; RUN: split-file %s %t
99
; RUN: cat %t/main.ll %t/disable.ll > %t0.ll
1010
; RUN: cat %t/main.ll %t/enable.ll > %t1.ll
11-
; RUN: opt < %t0.ll -mtriple=x86_64-linux -passes=instrprof -S | FileCheck %s --check-prefixes=ELF
12-
; RUN: opt < %t1.ll -mtriple=x86_64-linux -passes=instrprof -S | FileCheck %s --check-prefixes=ELF
13-
; RUN: opt < %t0.ll -mtriple=x86_64-windows -passes=instrprof -S | FileCheck %s --check-prefixes=COFF
14-
; RUN: opt < %t1.ll -mtriple=x86_64-windows -passes=instrprof -S | FileCheck %s --check-prefixes=COFF
11+
; RUN: opt < %t0.ll -mtriple=x86_64-linux -passes=instrprof -S | FileCheck %s --check-prefixes=ELF,ELF0
12+
; RUN: opt < %t1.ll -mtriple=x86_64-linux -passes=instrprof -S | FileCheck %s --check-prefixes=ELF,ELF1
13+
; RUN: opt < %t0.ll -mtriple=x86_64-windows -passes=instrprof -S | FileCheck %s --check-prefixes=COFF,COFF0
14+
; RUN: opt < %t1.ll -mtriple=x86_64-windows -passes=instrprof -S | FileCheck %s --check-prefixes=COFF,COFF1
1515

1616
;--- main.ll
17-
declare void @llvm.instrprof.increment(i8*, i64, i32, i32)
17+
declare void @llvm.instrprof.increment(ptr, i64, i32, i32)
1818

1919
$foo_inline = comdat any
2020
$foo_extern = comdat any
@@ -34,7 +34,7 @@ $foo_extern = comdat any
3434
; COFF1: @__profc_foo_inline = linkonce_odr hidden global {{.*}}, section ".lprfc$M", comdat, align 8
3535
; COFF1: @__profd_foo_inline = linkonce_odr hidden global {{.*}}, section ".lprfd$M", comdat, align 8
3636
define weak_odr void @foo_inline() comdat {
37-
call void @llvm.instrprof.increment(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @__profn_foo_inline, i32 0, i32 0), i64 0, i32 1, i32 0)
37+
call void @llvm.instrprof.increment(ptr @__profn_foo_inline, i64 0, i32 1, i32 0)
3838
ret void
3939
}
4040

@@ -45,13 +45,13 @@ define weak_odr void @foo_inline() comdat {
4545
; COFF0: @__profd_foo_extern = private global{{.*}}, section ".lprfd$M", comdat($__profc_foo_extern), align 8
4646
; COFF1: @__profd_foo_extern = linkonce_odr hidden global{{.*}}, section ".lprfd$M", comdat, align 8
4747
define available_externally void @foo_extern() {
48-
call void @llvm.instrprof.increment(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @__profn_foo_extern, i32 0, i32 0), i64 0, i32 1, i32 0)
48+
call void @llvm.instrprof.increment(ptr @__profn_foo_extern, i64 0, i32 1, i32 0)
4949
ret void
5050
}
5151

52-
; ELF: @llvm.compiler.used = appending global {{.*}} @__profd_foo_inline {{.*}} @__profd_foo_extern
53-
; COFF0: @llvm.compiler.used = appending global {{.*}} @__llvm_profile_runtime_user {{.*}} @__profd_foo_inline {{.*}} @__profd_foo_extern
54-
; COFF1: @llvm.used = appending global {{.*}} @__llvm_profile_runtime_user {{.*}} @__profd_foo_inline {{.*}} @__profd_foo_extern
52+
; ELF: @llvm.compiler.used = appending global [2 x ptr] [ptr @__profd_foo_inline, ptr @__profd_foo_extern]
53+
; COFF0: @llvm.compiler.used = appending global [3 x ptr] [ptr @__llvm_profile_runtime_user, ptr @__profd_foo_inline, ptr @__profd_foo_extern]
54+
; COFF1: @llvm.used = appending global [4 x ptr] [ptr @__llvm_profile_runtime_user, ptr @__profd_foo_inline, ptr @__profd_foo_extern, ptr @__llvm_prf_nm]
5555

5656
;--- disable.ll
5757
!llvm.module.flags = !{!0}

llvm/test/Instrumentation/InstrProfiling/coverage.ll

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ target triple = "aarch64-unknown-linux-gnu"
88
; CHECK: @__profc_bar = private global [1 x i8] c"\FF", section "__llvm_prf_cnts", comdat, align 1
99

1010
define void @_Z3foov() {
11-
call void @llvm.instrprof.cover(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 12345678, i32 1, i32 0)
12-
; CHECK: store i8 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @__profc_foo, i32 0, i32 0), align 1
11+
call void @llvm.instrprof.cover(ptr @__profn_foo, i64 12345678, i32 1, i32 0)
12+
; CHECK: store i8 0, ptr @__profc_foo, align 1
1313
ret void
1414
}
1515

16-
%class.A = type { i32 (...)** }
17-
define dso_local void @_Z3barv(%class.A* nocapture nonnull align 8 %0) unnamed_addr #0 align 2 {
18-
call void @llvm.instrprof.cover(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_bar, i32 0, i32 0), i64 87654321, i32 1, i32 0)
19-
; CHECK: store i8 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @__profc_bar, i32 0, i32 0), align 1
16+
%class.A = type { ptr }
17+
define dso_local void @_Z3barv(ptr nocapture nonnull align 8 %0) unnamed_addr #0 align 2 {
18+
call void @llvm.instrprof.cover(ptr @__profn_bar, i64 87654321, i32 1, i32 0)
19+
; CHECK: store i8 0, ptr @__profc_bar, align 1
2020
ret void
2121
}
2222

23-
declare void @llvm.instrprof.cover(i8*, i64, i32, i32)
23+
declare void @llvm.instrprof.cover(ptr, i64, i32, i32)

llvm/test/Instrumentation/InstrProfiling/debug-info-correlate-coverage.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
; CHECK: @__profc_foo
55

66
define void @_Z3foov() !dbg !12 {
7-
call void @llvm.instrprof.cover(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 12345678, i32 1, i32 0)
8-
; CHECK: store i8 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @__profc_foo
7+
call void @llvm.instrprof.cover(ptr @__profn_foo, i64 12345678, i32 1, i32 0)
8+
; CHECK: store i8 0, ptr @__profc_foo, align 1
99
ret void
1010
}
1111

12-
declare void @llvm.instrprof.cover(i8*, i64, i32, i32)
12+
declare void @llvm.instrprof.cover(ptr, i64, i32, i32)
1313

1414
!llvm.dbg.cu = !{!0}
1515
!llvm.module.flags = !{!2, !3, !4, !5, !6, !7, !8, !9, !10}

llvm/test/Instrumentation/InstrProfiling/debug-info-correlate.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
; CHECK: ![[COUNTERS]] = !{!"Num Counters", i32 2}
2020

2121
define void @_Z3foov() !dbg !12 {
22-
call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 12345678, i32 2, i32 0)
22+
call void @llvm.instrprof.increment(ptr @__profn_foo, i64 12345678, i32 2, i32 0)
2323
ret void
2424
}
2525

26-
declare void @llvm.instrprof.increment(i8*, i64, i32, i32)
26+
declare void @llvm.instrprof.increment(ptr, i64, i32, i32)
2727

2828
!llvm.dbg.cu = !{!0}
2929
!llvm.module.flags = !{!2, !3, !4, !5, !6, !7, !8, !9, !10}

llvm/test/Instrumentation/InstrProfiling/early-exit.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
target triple = "x86_64-apple-macosx10.10.0"
44

5-
declare void @llvm.instrprof.increment(i8*, i64, i32, i32)
5+
declare void @llvm.instrprof.increment(ptr, i64, i32, i32)
66

7-
declare void @llvm.instrprof.increment.step(i8*, i64, i32, i32, i64)
7+
declare void @llvm.instrprof.increment.step(ptr, i64, i32, i32, i64)
88

99
; CHECK: @__profc_foo = private global [1 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8
1010
@__profn_foo = private constant [3 x i8] c"foo"
1111

1212
define void @foo() {
13-
call void @llvm.instrprof.increment.step(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 0, i32 1, i32 0, i64 0)
13+
call void @llvm.instrprof.increment.step(ptr @__profn_foo, i64 0, i32 1, i32 0, i64 0)
1414
ret void
1515
}

llvm/test/Instrumentation/InstrProfiling/icall-comdat.ll

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,30 @@
1515
@__profn_foo = private constant [3 x i8] c"foo"
1616
@__profn_bar = private constant [3 x i8] c"bar"
1717

18-
define i32 @foo(i32 ()* ) {
19-
call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 12884901887, i32 1, i32 0)
20-
%2 = ptrtoint i32 ()* %0 to i64
21-
call void @llvm.instrprof.value.profile(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 12884901887, i64 %2, i32 0, i32 0)
18+
define i32 @foo(ptr ) {
19+
call void @llvm.instrprof.increment(ptr @__profn_foo, i64 12884901887, i32 1, i32 0)
20+
%2 = ptrtoint ptr %0 to i64
21+
call void @llvm.instrprof.value.profile(ptr @__profn_foo, i64 12884901887, i64 %2, i32 0, i32 0)
2222
%3 = tail call i32 %0()
2323
ret i32 %3
2424
}
2525

2626
$bar = comdat any
2727

28-
define i32 @bar(i32 ()* ) comdat {
28+
define i32 @bar(ptr ) comdat {
2929
entry:
30-
call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_bar, i32 0, i32 0), i64 12884901887, i32 1, i32 0)
31-
%1 = ptrtoint i32 ()* %0 to i64
32-
call void @llvm.instrprof.value.profile(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_bar, i32 0, i32 0), i64 12884901887, i64 %1, i32 0, i32 0)
30+
call void @llvm.instrprof.increment(ptr @__profn_bar, i64 12884901887, i32 1, i32 0)
31+
%1 = ptrtoint ptr %0 to i64
32+
call void @llvm.instrprof.value.profile(ptr @__profn_bar, i64 12884901887, i64 %1, i32 0, i32 0)
3333
%2 = tail call i32 %0()
3434
ret i32 %2
3535
}
3636

3737
; Function Attrs: nounwind
38-
declare void @llvm.instrprof.increment(i8*, i64, i32, i32) #0
38+
declare void @llvm.instrprof.increment(ptr, i64, i32, i32) #0
3939

4040
; Function Attrs: nounwind
41-
declare void @llvm.instrprof.value.profile(i8*, i64, i64, i32, i32) #0
41+
declare void @llvm.instrprof.value.profile(ptr, i64, i64, i32, i32) #0
4242

4343
attributes #0 = { nounwind }
4444

@@ -55,10 +55,10 @@ attributes #0 = { nounwind }
5555
; STATIC-SAME: @__llvm_prf_vnodes
5656
; STATIC-SAME: @__llvm_prf_nm
5757

58-
; STATIC: call void @__llvm_profile_instrument_target(i64 %3, i8* bitcast ({ i64, i64, i64, i8*, i8*, i32, [2 x i16] }* @__profd_foo to i8*), i32 0)
59-
; STATIC-EXT: call void @__llvm_profile_instrument_target(i64 %3, i8* bitcast ({ i64, i64, i64, i8*, i8*, i32, [2 x i16] }* @__profd_foo to i8*), i32 zeroext 0)
60-
; STATIC-SEXT: call void @__llvm_profile_instrument_target(i64 %3, i8* bitcast ({ i64, i64, i64, i8*, i8*, i32, [2 x i16] }* @__profd_foo to i8*), i32 signext 0)
58+
; STATIC: call void @__llvm_profile_instrument_target(i64 %3, ptr @__profd_foo, i32 0)
59+
; STATIC-EXT: call void @__llvm_profile_instrument_target(i64 %3, ptr @__profd_foo, i32 zeroext 0)
60+
; STATIC-SEXT: call void @__llvm_profile_instrument_target(i64 %3, ptr @__profd_foo, i32 signext 0)
6161

62-
; STATIC: declare void @__llvm_profile_instrument_target(i64, i8*, i32)
63-
; STATIC-EXT: declare void @__llvm_profile_instrument_target(i64, i8*, i32 zeroext)
64-
; STATIC-SEXT: declare void @__llvm_profile_instrument_target(i64, i8*, i32 signext)
62+
; STATIC: declare void @__llvm_profile_instrument_target(i64, ptr, i32)
63+
; STATIC-EXT: declare void @__llvm_profile_instrument_target(i64, ptr, i32 zeroext)
64+
; STATIC-SEXT: declare void @__llvm_profile_instrument_target(i64, ptr, i32 signext)

llvm/test/Instrumentation/InstrProfiling/icall-nocomdat.ll

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77
@__profn_foo = private constant [3 x i8] c"foo"
88
@__profn_bar = private constant [3 x i8] c"bar"
99

10-
define i32 @foo(i32 ()* ) {
11-
call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 12884901887, i32 1, i32 0)
12-
%2 = ptrtoint i32 ()* %0 to i64
13-
call void @llvm.instrprof.value.profile(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 12884901887, i64 %2, i32 0, i32 0)
10+
define i32 @foo(ptr ) {
11+
call void @llvm.instrprof.increment(ptr @__profn_foo, i64 12884901887, i32 1, i32 0)
12+
%2 = ptrtoint ptr %0 to i64
13+
call void @llvm.instrprof.value.profile(ptr @__profn_foo, i64 12884901887, i64 %2, i32 0, i32 0)
1414
%3 = tail call i32 %0()
1515
ret i32 %3
1616
}
1717

1818
; Function Attrs: nounwind
19-
declare void @llvm.instrprof.increment(i8*, i64, i32, i32) #0
19+
declare void @llvm.instrprof.increment(ptr, i64, i32, i32) #0
2020

2121
; Function Attrs: nounwind
22-
declare void @llvm.instrprof.value.profile(i8*, i64, i64, i32, i32) #0
22+
declare void @llvm.instrprof.value.profile(ptr, i64, i64, i32, i32) #0
2323

2424
attributes #0 = { nounwind }
2525

@@ -35,10 +35,10 @@ attributes #0 = { nounwind }
3535
; STATIC-SAME: @__llvm_prf_vnodes
3636
; STATIC-SAME: @__llvm_prf_nm
3737

38-
; STATIC: call void @__llvm_profile_instrument_target(i64 %3, i8* bitcast ({ i64, i64, i64, i8*, i8*, i32, [2 x i16] }* @__profd_foo to i8*), i32 0)
39-
; STATIC-EXT: call void @__llvm_profile_instrument_target(i64 %3, i8* bitcast ({ i64, i64, i64, i8*, i8*, i32, [2 x i16] }* @__profd_foo to i8*), i32 zeroext 0)
40-
; STATIC-SEXT: call void @__llvm_profile_instrument_target(i64 %3, i8* bitcast ({ i64, i64, i64, i8*, i8*, i32, [2 x i16] }* @__profd_foo to i8*), i32 signext 0)
38+
; STATIC: call void @__llvm_profile_instrument_target(i64 %3, ptr @__profd_foo, i32 0)
39+
; STATIC-EXT: call void @__llvm_profile_instrument_target(i64 %3, ptr @__profd_foo, i32 zeroext 0)
40+
; STATIC-SEXT: call void @__llvm_profile_instrument_target(i64 %3, ptr @__profd_foo, i32 signext 0)
4141

42-
; STATIC: declare void @__llvm_profile_instrument_target(i64, i8*, i32)
43-
; STATIC-EXT: declare void @__llvm_profile_instrument_target(i64, i8*, i32 zeroext)
44-
; STATIC-SEXT: declare void @__llvm_profile_instrument_target(i64, i8*, i32 signext)
42+
; STATIC: declare void @__llvm_profile_instrument_target(i64, ptr, i32)
43+
; STATIC-EXT: declare void @__llvm_profile_instrument_target(i64, ptr, i32 zeroext)
44+
; STATIC-SEXT: declare void @__llvm_profile_instrument_target(i64, ptr, i32 signext)

llvm/test/Instrumentation/InstrProfiling/noruntime.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
; RUN: opt < %s -passes=instrprof -S | FileCheck %s
44
; CHECK-NOT: define {{.*}} @__llvm_profile_runtime_user()
5-
; CHECK-NOT: load i32, i32* @__llvm_profile_runtime
5+
; CHECK-NOT: load i32, ptr @__llvm_profile_runtime
66

77
@__llvm_profile_runtime = global i32 0, align 4
88

99
@__profn_foo = private constant [3 x i8] c"foo"
1010

1111
define void @foo() {
12-
call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 0, i32 1, i32 0)
12+
call void @llvm.instrprof.increment(ptr @__profn_foo, i64 0, i32 1, i32 0)
1313
ret void
1414
}
1515

16-
declare void @llvm.instrprof.increment(i8*, i64, i32, i32)
16+
declare void @llvm.instrprof.increment(ptr, i64, i32, i32)

0 commit comments

Comments
 (0)