[PATCH] D118098: [InstrProf][correlation] Read DWARFv5 `OP_addrx` location
Ellis Hoag via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 25 11:03:34 PST 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9c2891a8eddb: [InstrProf][correlation] Read DWARFv5 `OP_addrx` location (authored by ellis).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D118098/new/
https://reviews.llvm.org/D118098
Files:
compiler-rt/test/profile/Linux/instrprof-debug-info-correlate.c
llvm/lib/ProfileData/InstrProfCorrelator.cpp
Index: llvm/lib/ProfileData/InstrProfCorrelator.cpp
===================================================================
--- llvm/lib/ProfileData/InstrProfCorrelator.cpp
+++ llvm/lib/ProfileData/InstrProfCorrelator.cpp
@@ -167,13 +167,19 @@
return {};
}
auto &DU = *Die.getDwarfUnit();
+ auto AddressSize = DU.getAddressByteSize();
for (auto &Location : *Locations) {
- auto AddressSize = DU.getAddressByteSize();
DataExtractor Data(Location.Expr, DICtx->isLittleEndian(), AddressSize);
DWARFExpression Expr(Data, AddressSize);
- for (auto &Op : Expr)
- if (Op.getCode() == dwarf::DW_OP_addr)
+ for (auto &Op : Expr) {
+ if (Op.getCode() == dwarf::DW_OP_addr) {
return Op.getRawOperand(0);
+ } else if (Op.getCode() == dwarf::DW_OP_addrx) {
+ uint64_t Index = Op.getRawOperand(0);
+ if (auto SA = DU.getAddrOffsetSectionItem(Index))
+ return SA->Address;
+ }
+ }
}
return {};
}
Index: compiler-rt/test/profile/Linux/instrprof-debug-info-correlate.c
===================================================================
--- compiler-rt/test/profile/Linux/instrprof-debug-info-correlate.c
+++ compiler-rt/test/profile/Linux/instrprof-debug-info-correlate.c
@@ -1,12 +1,18 @@
// REQUIRES: zlib
// Value profiling is currently not supported in lightweight mode.
-// RUN: %clang_pgogen -o %t -g -gdwarf-4 -mllvm --debug-info-correlate -mllvm --disable-vp=true %S/../Inputs/instrprof-debug-info-correlate-main.cpp %S/../Inputs/instrprof-debug-info-correlate-foo.cpp
-// RUN: env LLVM_PROFILE_FILE=%t.proflite %run %t
-// RUN: llvm-profdata merge -o %t.profdata --debug-info=%t %t.proflite
-
// RUN: %clang_pgogen -o %t.normal -mllvm --disable-vp=true %S/../Inputs/instrprof-debug-info-correlate-main.cpp %S/../Inputs/instrprof-debug-info-correlate-foo.cpp
// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t.normal
// RUN: llvm-profdata merge -o %t.normal.profdata %t.profraw
+// RUN: %clang_pgogen -o %t.d4 -g -gdwarf-4 -mllvm --debug-info-correlate -mllvm --disable-vp=true %S/../Inputs/instrprof-debug-info-correlate-main.cpp %S/../Inputs/instrprof-debug-info-correlate-foo.cpp
+// RUN: env LLVM_PROFILE_FILE=%t.d4.proflite %run %t.d4
+// RUN: llvm-profdata merge -o %t.d4.profdata --debug-info=%t.d4 %t.d4.proflite
+
+// RUN: diff %t.normal.profdata %t.d4.profdata
+
+// RUN: %clang_pgogen -o %t -g -mllvm --debug-info-correlate -mllvm --disable-vp=true %S/../Inputs/instrprof-debug-info-correlate-main.cpp %S/../Inputs/instrprof-debug-info-correlate-foo.cpp
+// RUN: env LLVM_PROFILE_FILE=%t.proflite %run %t
+// RUN: llvm-profdata merge -o %t.profdata --debug-info=%t %t.proflite
+
// RUN: diff %t.normal.profdata %t.profdata
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118098.402973.patch
Type: text/x-patch
Size: 2726 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220125/13d373db/attachment.bin>
More information about the llvm-commits
mailing list