[PGO] Add omitted test cases.

llvm-svn: 298115
This commit is contained in:
Rong Xu 2017-03-17 20:05:13 +00:00
parent 4230101def
commit 661ffe104e
2 changed files with 158 additions and 0 deletions

View File

@ -0,0 +1,35 @@
; RUN: opt < %s -pgo-instr-gen -instrprof -S | FileCheck %s
; RUN: opt <%s -passes=pgo-instr-gen,instrprof -S | FileCheck %s
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
define void @foo(i8* %dst, i8* %src, i32* %a, i32 %n) {
entry:
br label %for.cond
for.cond:
%i.0 = phi i32 [ 0, %entry ], [ %add, %for.cond1 ]
%cmp = icmp slt i32 %i.0, %n
br i1 %cmp, label %for.cond1, label %for.end6
for.cond1:
%j.0 = phi i32 [ %inc, %for.body3 ], [ 0, %for.cond ]
%idx.ext = sext i32 %i.0 to i64
%add.ptr = getelementptr inbounds i32, i32* %a, i64 %idx.ext
%0 = load i32, i32* %add.ptr, align 4
%cmp2 = icmp slt i32 %j.0, %0
%add = add nsw i32 %i.0, 1
br i1 %cmp2, label %for.body3, label %for.cond
for.body3:
%conv = sext i32 %add to i64
; CHECK: call void @__llvm_profile_instrument_range(i64 %conv, i8* bitcast ({ i64, i64, i64*, i8*, i8*, i32, [2 x i16] }* @__profd_foo to i8*), i32 0, i64 0, i64 8, i64 8192)
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %conv, i32 1, i1 false)
%inc = add nsw i32 %j.0, 1
br label %for.cond1
for.end6:
ret void
}
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i32, i1)

View File

@ -0,0 +1,123 @@
# RUN: llvm-profdata show -memop-sizes -ic-targets -function=foo %s | FileCheck %s --check-prefixes=MEMOP,MEMOP_SUM,ICALL,ICALL_SUM
# RUN: llvm-profdata show -memop-sizes -ic-targets -counts -text -function=foo %s | FileCheck %s --check-prefixes=TEXT,MEMOP_TEXT,ICALL_TEXT
# RUN: llvm-profdata merge -o %t.profdata %s
# RUN: llvm-profdata show -memop-sizes -ic-targets -function=foo %t.profdata | FileCheck %s --check-prefixes=MEMOP,MEMOP_SUM,ICALL,ICALL_SUM
# RUN: llvm-profdata merge -o %t.proftext -text %s
# RUN: llvm-profdata show -memop-sizes -ic-targets -function=foo %t.proftext| FileCheck %s --check-prefixes=MEMOP,MEMOP_SUM,ICALL,ICALL_SUM
# IR level Instrumentation Flag
:ir
ic1
# Func Hash:
10
# Num Counters:
2
# Counter Values:
999000
359800
ic2
# Func Hash:
10
# Num Counters:
2
# Counter Values:
1001000
360200
foo
# Func Hash:
35277121310
# Num Counters:
3
# Counter Values:
20
556
1
# Num Value Kinds:
2
# Value Kind IPVK_IndirectCallTarget
0
# NumSites
3
# Values for each site
0
2
ic2:1000
ic1:100
1
ic2:20000
#ICALL: Indirect Target Results:
#ICALL-NEXT: [ 1, ic2, 1000 ]
#ICALL-NEXT: [ 1, ic1, 100 ]
#ICALL-NEXT: [ 2, ic2, 20000 ]
# ValueKind = IPVK_MemOPSize:
1
# NumValueSites:
1
9
1:99
2:88
3:77
9:72
4:66
5:55
6:44
7:33
8:22
#MEMOP: Memory Instrinsic Size Results:
#MEMOP-NEXT: [ 0, 1, 99 ]
#MEMOP-NEXT: [ 0, 2, 88 ]
#MEMOP-NEXT: [ 0, 3, 77 ]
#MEMOP-NEXT: [ 0, 9, 72 ]
#MEMOP-NEXT: [ 0, 4, 66 ]
#MEMOP-NEXT: [ 0, 5, 55 ]
#MEMOP-NEXT: [ 0, 6, 44 ]
#MEMOP-NEXT: [ 0, 7, 33 ]
#MEMOP-NEXT: [ 0, 8, 22 ]
#ICALL_SUM: Statistics for indirect call sites profile:
#ICALL_SUM: Total number of sites: 3
#ICALL_SUM: Total number of sites with values: 2
#ICALL_SUM: Total number of profiled values: 3
#ICALL_SUM: Value sites histogram:
#ICALL_SUM: NumTargets, SiteCount
#ICALL_SUM: 1, 1
#ICALL_SUM: 2, 1
#MEMOP_SUM: Statistics for memory intrinsic calls sizes profile:
#MEMOP_SUM: Total number of sites: 1
#MEMOP_SUM: Total number of sites with values: 1
#MEMOP_SUM: Total number of profiled values: 9
#MEMOP_SUM: Value sites histogram:
#MEMOP_SUM: NumTargets, SiteCount
#MEMOP_SUM: 9, 1
#TEXT: # Num Value Kinds:
#TEXT: 2
#ICALL_TEXT: # ValueKind = IPVK_IndirectCallTarget:
#ICALL_TEXT: 0
#ICALL_TEXT: # NumValueSites:
#ICALL_TEXT: 3
#ICALL_TEXT: 0
#ICALL_TEXT: 2
#ICALL_TEXT: ic2:1000
#ICALL_TEXT: ic1:100
#ICALL_TEXT: 1
#ICALL_TEXT: ic2:20000
#MEMOP_TEXT: # ValueKind = IPVK_MemOPSize:
#MEMOP_TEXT: 1
#MEMOP_TEXT: # NumValueSites:
#MEMOP_TEXT: 1
#MEMOP_TEXT: 9
#MEMOP_TEXT: 1:99
#MEMOP_TEXT: 2:88
#MEMOP_TEXT: 3:77
#MEMOP_TEXT: 9:72
#MEMOP_TEXT: 4:66
#MEMOP_TEXT: 5:55
#MEMOP_TEXT: 6:44
#MEMOP_TEXT: 7:33
#MEMOP_TEXT: 8:22