[PATCH] D104584: [SampleFDO] Make FSDiscriminator flag part of function parameters
Rong Xu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 21 14:38:38 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8c68eb83065c: [SampleFDO] Make FSDiscriminator flag part of function parameters (authored by xur).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104584/new/
https://reviews.llvm.org/D104584
Files:
llvm/include/llvm/IR/DebugInfoMetadata.h
llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h
llvm/tools/llvm-profgen/ProfiledBinary.cpp
Index: llvm/tools/llvm-profgen/ProfiledBinary.cpp
===================================================================
--- llvm/tools/llvm-profgen/ProfiledBinary.cpp
+++ llvm/tools/llvm-profgen/ProfiledBinary.cpp
@@ -440,7 +440,8 @@
FunctionName = FunctionSamples::getCanonicalFnName(FunctionName);
LineLocation Line(CallerFrame.Line - CallerFrame.StartLine,
DILocation::getBaseDiscriminatorFromDiscriminator(
- CallerFrame.Discriminator));
+ CallerFrame.Discriminator,
+ /* IsFSDiscriminator */ false));
FrameLocation Callsite(FunctionName.str(), Line);
CallStack.push_back(Callsite);
}
Index: llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h
===================================================================
--- llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h
+++ llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h
@@ -279,7 +279,12 @@
const DILocation *DIL = DLoc;
uint32_t LineOffset = FunctionSamples::getOffset(DIL);
- uint32_t Discriminator = DIL->getBaseDiscriminator();
+ uint32_t Discriminator;
+ if (EnableFSDiscriminator)
+ Discriminator = DIL->getDiscriminator();
+ else
+ Discriminator = DIL->getBaseDiscriminator();
+
ErrorOr<uint64_t> R = FS->findSamplesAt(LineOffset, Discriminator);
if (R) {
bool FirstMark =
@@ -298,11 +303,9 @@
return Remark;
});
}
- LLVM_DEBUG(dbgs() << " " << DLoc.getLine() << "."
- << DIL->getBaseDiscriminator() << ":" << Inst
- << " (line offset: " << LineOffset << "."
- << DIL->getBaseDiscriminator() << " - weight: " << R.get()
- << ")\n");
+ LLVM_DEBUG(dbgs() << " " << DLoc.getLine() << "." << Discriminator << ":"
+ << Inst << " (line offset: " << LineOffset << "."
+ << Discriminator << " - weight: " << R.get() << ")\n");
}
return R;
}
Index: llvm/include/llvm/IR/DebugInfoMetadata.h
===================================================================
--- llvm/include/llvm/IR/DebugInfoMetadata.h
+++ llvm/include/llvm/IR/DebugInfoMetadata.h
@@ -1744,8 +1744,10 @@
static unsigned getBaseDiscriminatorBits() { return getBaseFSBitEnd(); }
/// Returns the base discriminator for a given encoded discriminator \p D.
- static unsigned getBaseDiscriminatorFromDiscriminator(unsigned D) {
- if (EnableFSDiscriminator)
+ static unsigned
+ getBaseDiscriminatorFromDiscriminator(unsigned D,
+ bool IsFSDiscriminator = false) {
+ if (IsFSDiscriminator)
return getMaskedDiscriminator(D, getBaseDiscriminatorBits());
return getUnsignedFromPrefixEncoding(D);
}
@@ -2198,7 +2200,8 @@
}
unsigned DILocation::getBaseDiscriminator() const {
- return getBaseDiscriminatorFromDiscriminator(getDiscriminator());
+ return getBaseDiscriminatorFromDiscriminator(getDiscriminator(),
+ EnableFSDiscriminator);
}
unsigned DILocation::getDuplicationFactor() const {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104584.353496.patch
Type: text/x-patch
Size: 3183 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210621/958ac73f/attachment.bin>
More information about the llvm-commits
mailing list