mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-02 00:37:09 +00:00
Invoke add-discriminator at -g0 -fsample-profile
Summary: -fsample-profile needs discriminator, which will not be added if built with -g0. This patch makes sure the discriminator is added for sample-profile at -g0. A followup patch will be send out to update clang tests. Reviewers: davidxl, dblaikie, echristo, dnovillo Subscribers: mehdi_amini, probinson, llvm-commits Differential Revision: https://reviews.llvm.org/D25132 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283565 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cf5c0d7439
commit
588a79510c
@ -419,7 +419,7 @@ DIE *DwarfCompileUnit::constructInlinedScopeDIE(LexicalScope *Scope) {
|
||||
addUInt(*ScopeDIE, dwarf::DW_AT_call_file, None,
|
||||
getOrCreateSourceID(IA->getFilename(), IA->getDirectory()));
|
||||
addUInt(*ScopeDIE, dwarf::DW_AT_call_line, None, IA->getLine());
|
||||
if (IA->getDiscriminator())
|
||||
if (IA->getDiscriminator() && DD->getDwarfVersion() >= 4)
|
||||
addUInt(*ScopeDIE, dwarf::DW_AT_GNU_discriminator, None,
|
||||
IA->getDiscriminator());
|
||||
|
||||
|
@ -1190,7 +1190,8 @@ void DwarfDebug::recordSourceLine(unsigned Line, unsigned Col, const MDNode *S,
|
||||
Fn = Scope->getFilename();
|
||||
Dir = Scope->getDirectory();
|
||||
if (auto *LBF = dyn_cast<DILexicalBlockFile>(Scope))
|
||||
Discriminator = LBF->getDiscriminator();
|
||||
if (DwarfVersion >= 4)
|
||||
Discriminator = LBF->getDiscriminator();
|
||||
|
||||
unsigned CUID = Asm->OutStreamer->getContext().getDwarfCompileUnitID();
|
||||
Src = static_cast<DwarfCompileUnit &>(*InfoHolder.getUnits()[CUID])
|
||||
|
@ -122,7 +122,8 @@ EmitDwarfLineTable(MCObjectStreamer *MCOS, MCSection *Section,
|
||||
MCOS->EmitIntValue(dwarf::DW_LNS_set_column, 1);
|
||||
MCOS->EmitULEB128IntValue(Column);
|
||||
}
|
||||
if (Discriminator != LineEntry.getDiscriminator()) {
|
||||
if (Discriminator != LineEntry.getDiscriminator() &&
|
||||
MCOS->getContext().getDwarfVersion() >= 4) {
|
||||
Discriminator = LineEntry.getDiscriminator();
|
||||
unsigned Size = getULEB128Size(Discriminator);
|
||||
MCOS->EmitIntValue(dwarf::DW_LNS_extended_op, 1);
|
||||
|
@ -159,10 +159,7 @@ static bool addDiscriminators(Function &F) {
|
||||
// If the function has debug information, but the user has disabled
|
||||
// discriminators, do nothing.
|
||||
// Simlarly, if the function has no debug info, do nothing.
|
||||
// Finally, if this module is built with dwarf versions earlier than 4,
|
||||
// do nothing (discriminator support is a DWARF 4 feature).
|
||||
if (NoDiscriminators || !F.getSubprogram() ||
|
||||
F.getParent()->getDwarfVersion() < 4)
|
||||
if (NoDiscriminators || !F.getSubprogram())
|
||||
return false;
|
||||
|
||||
bool Changed = false;
|
||||
|
Loading…
Reference in New Issue
Block a user