Skip to content

Commit

Permalink
fix line number
Browse files Browse the repository at this point in the history
  • Loading branch information
minglotus-6 committed Jul 18, 2024
1 parent 73d6985 commit 85dccaf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions compiler-rt/test/profile/Linux/instrprof-vtable-value-prof.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// REQUIRES: lld-available
// REQUIRES: lld, lld-available

// Building the instrumented binary will fail because lld doesn't support
// big-endian ELF for PPC (aka ABI 1).
Expand Down Expand Up @@ -142,12 +142,12 @@
// RUN: | FileCheck %s --check-prefixes=REMARK,IR --implicit-check-not="!VP"

// For the indirect call site `ptr->func`
// REMARK: instrprof-vtable-value-prof.cpp:214:19: Promote indirect call to _ZN12_GLOBAL__N_18Derived24funcEii with count 150 out of 200, sink 1 instruction(s) and compare 1 vtable(s): {_ZTVN12_GLOBAL__N_18Derived2E}
// REMARK: instrprof-vtable-value-prof.cpp:214:19: Promote indirect call to _ZN8Derived14funcEii with count 50 out of 50, sink 1 instruction(s) and compare 1 vtable(s): {_ZTV8Derived1}
// REMARK: instrprof-vtable-value-prof.cpp:221:19: Promote indirect call to _ZN12_GLOBAL__N_18Derived24funcEii with count 150 out of 200, sink 1 instruction(s) and compare 1 vtable(s): {_ZTVN12_GLOBAL__N_18Derived2E}
// REMARK: instrprof-vtable-value-prof.cpp:221:19: Promote indirect call to _ZN8Derived14funcEii with count 50 out of 50, sink 1 instruction(s) and compare 1 vtable(s): {_ZTV8Derived1}
//
// For the indirect call site `delete ptr`
// REMARK: instrprof-vtable-value-prof.cpp:216:5: Promote indirect call to _ZN12_GLOBAL__N_18Derived2D0Ev with count 750 out of 1000, sink 2 instruction(s) and compare 1 vtable(s): {_ZTVN12_GLOBAL__N_18Derived2E}
// REMARK: instrprof-vtable-value-prof.cpp:216:5: Promote indirect call to _ZN8Derived1D0Ev with count 250 out of 250, sink 2 instruction(s) and compare 1 vtable(s): {_ZTV8Derived1}
// REMARK: instrprof-vtable-value-prof.cpp:223:5: Promote indirect call to _ZN12_GLOBAL__N_18Derived2D0Ev with count 750 out of 1000, sink 2 instruction(s) and compare 1 vtable(s): {_ZTVN12_GLOBAL__N_18Derived2E}
// REMARK: instrprof-vtable-value-prof.cpp:223:5: Promote indirect call to _ZN8Derived1D0Ev with count 250 out of 250, sink 2 instruction(s) and compare 1 vtable(s): {_ZTV8Derived1}

// The IR matchers for indirect callsite `ptr->func`.
// IR-LABEL: @main
Expand Down
8 changes: 4 additions & 4 deletions llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1760,11 +1760,11 @@ void PGOUseFunc::annotateValueSites(uint32_t Kind) {
unsigned NumValueSites = ProfileRecord.getNumValueSites(Kind);
// FuncPGOInstrumentation ctor finds value sites for each kind. It runs on the
// common path of pgo-instr-gen and pgo-instr-use, and vtable kind path
// is gated by `-enable-vtable-value-profiling`. Give pgo-instr-use pass a
// second chance to find out vtable value sites when vtable profiles are
// present and `-enable-vtable-profile-use` is not explicitly off.
// is gated by `-enable-vtable-value-profiling`. If vtable profiles are
// present, not explicitly discarded and vtable sites remain empty, try to
// find the sites again.
if (NumValueSites > 0 && Kind == IPVK_VTableTarget &&
NumValueSites != FuncInfo.ValueSites[IPVK_VTableTarget].size() &&
FuncInfo.ValueSites[Kind].empty() &&
!(EnableVTableProfileUse.getNumOccurrences() &&
EnableVTableProfileUse == false))
FuncInfo.ValueSites[IPVK_VTableTarget] = VPC.get(IPVK_VTableTarget);
Expand Down

0 comments on commit 85dccaf

Please sign in to comment.