[all-commits] [llvm/llvm-project] 75184f: [DebugInfo] Fix handling '# line "file"' for DWARFv5
Igor Kudrin via All-commits
all-commits at lists.llvm.org
Thu Jan 20 22:53:01 PST 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 75184f14aecd8147a02189a843789a4eb5e5b571
https://github.com/llvm/llvm-project/commit/75184f14aecd8147a02189a843789a4eb5e5b571
Author: Igor Kudrin <ikudrin at accesssoftek.com>
Date: 2022-01-21 (Fri, 21 Jan 2022)
Changed paths:
M llvm/lib/MC/MCDwarf.cpp
M llvm/test/MC/ELF/debug-hash-file.s
Log Message:
-----------
[DebugInfo] Fix handling '# line "file"' for DWARFv5
`CppHashInfo.Filename` is a `StringRef` that references a part of the
source file and it is not null-terminated at the end of the file name.
`AsmParser::parseAndMatchAndEmitTargetInstruction()` passes it to
`getStreamer().emitDwarfFileDirective()`, and it eventually comes to
`isRootFile()`. The comparison fails because `FileName.data()` is not
properly terminated.
In addition, the old code might cause a significant speed degradation
for long source files. The `operator!=()` for `std::string` and
`const char *` can be implemented in a way that it finds the length of
the second argument first, which slows the comparison for long data.
`parseAndMatchAndEmitTargetInstruction()` calls
`emitDwarfFileDirective()` every time if `CppHashInfo.Filename` is not
empty. As a result, the longer the source file is, the slower the
compilation wend, and for a very long file, it might take hours instead
of a couple of seconds normally.
Differential Revision: https://reviews.llvm.org/D117785
Commit: 86b08ed6bb16a96e921445299858f3cabd6f9e45
https://github.com/llvm/llvm-project/commit/86b08ed6bb16a96e921445299858f3cabd6f9e45
Author: Igor Kudrin <ikudrin at accesssoftek.com>
Date: 2022-01-21 (Fri, 21 Jan 2022)
Changed paths:
M llvm/lib/MC/MCDwarf.cpp
Log Message:
-----------
[DebugInfo][NFC] Do not call 'isRootFile' for DWARF Version < 5
A quicker comparison should be done first.
Differential Revision: https://reviews.llvm.org/D117786
Compare: https://github.com/llvm/llvm-project/compare/8def89b5dc82...86b08ed6bb16
More information about the All-commits
mailing list