Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GlobalISel] Don't emit lost debug location remarks when legalizing t…
…ail calls There were a bunch of lost debug location remarks that show up when legalizing tail calls on AArch64. This would happen because we drop the return in the block where we emit the tail call. So, we end up dropping the debug location, which makes the LostDebugLocObserver report a missing debug location. Although it's *true* that we lose these debug locations, this isn't a particularly useful remark. We expect to drop these debug locations when emitting tail calls. Suppressing remarks in this case is preferable, since the amount of noise could hide actual debug location related bugs. To do this, I just plumbed the LostDebugLocObserver through the relevant LegalizerHelper functions. This is the only case I can think of where we need the LostDebugLocObserver in the LegalizerHelper. So, rather than storing it in the LegalizerHelper proper and mucking around with the constructors, I figured it'd be cleanest to take the simplest path for now. This clears up ~20 noisy lost debug location remarks on CTMark in AArch64 at -Os. Differential Revision: https://reviews.llvm.org/D103128
- Loading branch information
Jessica Paquette
committed
May 27, 2021
1 parent
caae570
commit 324af79
Showing
4 changed files
with
66 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
llvm/test/CodeGen/AArch64/GlobalISel/debug-loc-legalize-tail-call.mir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# RUN: llc %s -mtriple=aarch64-unknown-unknown -run-pass=legalizer -verify-machineinstrs -pass-remarks-missed=gisel* -o - 2>&1 | FileCheck %s | ||
|
||
# When we create a tail call, we expect to drop the return's debug location. | ||
# Ensure that we don't get a missed remark for debug locations in this case. | ||
|
||
# CHECK-NOT: remark: file.ll:[[#]]:[[#]]: lost [[#]] debug locations during pass | ||
|
||
--- | | ||
define void @snork() !dbg !6 { unreachable } | ||
|
||
!llvm.module.flags = !{!0} | ||
!llvm.dbg.cu = !{!1} | ||
!llvm.debugify = !{!4, !5} | ||
|
||
!0 = !{i32 2, !"Debug Info Version", i32 3} | ||
!1 = distinct !DICompileUnit(language: DW_LANG_C, file: !2, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !3) | ||
!2 = !DIFile(filename: "file.ll", directory: "/") | ||
!3 = !{} | ||
!4 = !{i32 2} | ||
!5 = !{i32 1} | ||
!6 = distinct !DISubprogram(name: "snork", linkageName: "snork", scope: null, file: !2, line: 1, type: !7, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !1, retainedNodes: !8) | ||
!7 = !DISubroutineType(types: !3) | ||
!8 = !{!9} | ||
!9 = !DILocalVariable(name: "1", scope: !6, file: !2, line: 2, type: !10) | ||
!10 = !DIBasicType(name: "ty32", size: 32, encoding: DW_ATE_unsigned) | ||
!11 = !DILocation(line: 1, column: 1, scope: !6) | ||
!12 = !DILocation(line: 2, column: 1, scope: !6) | ||
|
||
... | ||
--- | ||
name: snork | ||
alignment: 4 | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
%0:_(p0) = G_IMPLICIT_DEF debug-location !DILocation(line: 0, scope: !6) | ||
%1:_(s8) = G_CONSTANT i8 0 | ||
%2:_(s64) = G_IMPLICIT_DEF debug-location !DILocation(line: 0, scope: !6) | ||
G_MEMSET %0(p0), %1(s8), %2(s64), 1, debug-location !11 :: (store 1) | ||
DBG_VALUE 0, 0, !9, !DIExpression(), debug-location !12 | ||
RET_ReallyLR debug-location !12 | ||
... |