[llvm] r322905 - [CodeView] Add line numbers for inlined call sites

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 22 07:19:59 PST 2018


D'oh, I fat-fingered that one. It's actually merged in r323121
together with another patch.

We can tease them apart if we need to roll it back, but for now I'll let it be.

On Mon, Jan 22, 2018 at 3:17 PM, Hans Wennborg <hans at chromium.org> wrote:
> Merged to 6.0 in r323117.
>
> On Thu, Jan 18, 2018 at 11:55 PM, Reid Kleckner via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
>> Author: rnk
>> Date: Thu Jan 18 14:55:43 2018
>> New Revision: 322905
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=322905&view=rev
>> Log:
>> [CodeView] Add line numbers for inlined call sites
>>
>> We did this for inline call site line tables, but we hadn't done it for
>> regular function line tables yet. This patch copies that logic from
>> encodeInlineLineTable.
>>
>> Modified:
>>     llvm/trunk/lib/MC/MCCodeView.cpp
>>     llvm/trunk/test/MC/COFF/cv-inline-linetable.s
>>
>> Modified: llvm/trunk/lib/MC/MCCodeView.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCCodeView.cpp?rev=322905&r1=322904&r2=322905&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/MC/MCCodeView.cpp (original)
>> +++ llvm/trunk/lib/MC/MCCodeView.cpp Thu Jan 18 14:55:43 2018
>> @@ -268,11 +268,35 @@ std::vector<MCCVLineEntry>
>>  CodeViewContext::getFunctionLineEntries(unsigned FuncId) {
>>    std::vector<MCCVLineEntry> FilteredLines;
>>    auto I = MCCVLineStartStop.find(FuncId);
>> -  if (I != MCCVLineStartStop.end())
>> +  if (I != MCCVLineStartStop.end()) {
>> +    MCCVFunctionInfo *SiteInfo = getCVFunctionInfo(FuncId);
>>      for (size_t Idx = I->second.first, End = I->second.second; Idx != End;
>> -         ++Idx)
>> -      if (MCCVLines[Idx].getFunctionId() == FuncId)
>> +         ++Idx) {
>> +      unsigned LocationFuncId = MCCVLines[Idx].getFunctionId();
>> +      if (LocationFuncId == FuncId) {
>> +        // This was a .cv_loc directly for FuncId, so record it.
>>          FilteredLines.push_back(MCCVLines[Idx]);
>> +      } else {
>> +        // Check if the current location is inlined in this function. If it is,
>> +        // synthesize a statement .cv_loc at the original inlined call site.
>> +        auto I = SiteInfo->InlinedAtMap.find(LocationFuncId);
>> +        if (I != SiteInfo->InlinedAtMap.end()) {
>> +          MCCVFunctionInfo::LineInfo &IA = I->second;
>> +          // Only add the location if it differs from the previous location.
>> +          // Large inlined calls will have many .cv_loc entries and we only need
>> +          // one line table entry in the parent function.
>> +          if (FilteredLines.empty() ||
>> +              FilteredLines.back().getFileNum() != IA.File ||
>> +              FilteredLines.back().getLine() != IA.Line ||
>> +              FilteredLines.back().getColumn() != IA.Col) {
>> +            FilteredLines.push_back(MCCVLineEntry(
>> +                MCCVLines[Idx].getLabel(),
>> +                MCCVLoc(FuncId, IA.File, IA.Line, IA.Col, false, false)));
>> +          }
>> +        }
>> +      }
>> +    }
>> +  }
>>    return FilteredLines;
>>  }
>>
>>
>> Modified: llvm/trunk/test/MC/COFF/cv-inline-linetable.s
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/cv-inline-linetable.s?rev=322905&r1=322904&r2=322905&view=diff
>> ==============================================================================
>> --- llvm/trunk/test/MC/COFF/cv-inline-linetable.s (original)
>> +++ llvm/trunk/test/MC/COFF/cv-inline-linetable.s Thu Jan 18 14:55:43 2018
>> @@ -135,3 +135,29 @@ Ltmp1:
>>         .cv_filechecksums               # File index to string table offset subsection
>>         .cv_stringtable                 # String table
>>
>> +# CHECK-LABEL:  FunctionLineTable [
>> +# CHECK:    LinkageName: ?baz@@YAXXZ
>> +# CHECK:    Flags: 0x1
>> +# CHECK:    CodeSize: 0x3D
>> +# CHECK:    FilenameSegment [
>> +# CHECK:      Filename: D:\src\llvm\build\t.cpp (0x0)
>> +# CHECK:      +0x0 [
>> +# CHECK:        LineNumberStart: 13
>> +# CHECK:      ]
>> +# CHECK:      +0x1 [
>> +# CHECK:        LineNumberStart: 14
>> +# CHECK:      ]
>> +# CHECK:      +0x8 [
>> +# CHECK:        LineNumberStart: 15
>> +# CHECK:      ]
>> +#      There shouldn't be any other line number entries because all the other
>> +#      .cv_locs are on line 15 where the top-level inline call site is.
>> +# CHECK-NOT: LineNumberStart
>> +# CHECK:      +0x34 [
>> +# CHECK:        LineNumberStart: 16
>> +# CHECK:      ]
>> +# CHECK:      +0x3B [
>> +# CHECK:        LineNumberStart: 17
>> +# CHECK:      ]
>> +# CHECK:    ]
>> +# CHECK:  ]
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list