[PATCH] D110740: Do not emit prologue_end for line 0 locs if there is a non-zero loc present

Shubham Sandeep Rastogi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 1 11:54:38 PDT 2021


rastogishubham marked 4 inline comments as done.
rastogishubham added inline comments.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:2097
+        // save off line 0 .loc location and return that if no non-zero location
+        // is found
+        if (MI.getDebugLoc().getLine())
----------------
aprantl wrote:
> Maybe we should also explain the rationale behind this:
> ```
> // Scan forward to try to find a non-zero line number. The prologue_end marks the first breakpoint in the function after the frame setup, and a compiler-generated line 0 location is not a meaningful breakpoint. If none is found, return the first location after the frame setup.
> ```
Completely agree, thanks for that comments


================
Comment at: llvm/test/CodeGen/X86/line-zero-prologue-end.ll:4
+; CHECK-NEXT: .file{{.+}}
+; CHECK-NEXT: .loc 1 2 0
+; CHECK-NEXT: .cfi_startproc
----------------
probinson wrote:
> Should this have prologue_end on it?
This should *not* have a prologue_end on it, I will add a regex check for the end of the line to make sure prologue_end doesn't show up


================
Comment at: llvm/test/CodeGen/X86/line-zero-prologue-end.ll:7
+; CHECK-NEXT: ## %bb.{{[0-9]+}}:
+; CHECK-NEXT: .loc 1 0 5 is_stmt{{.*}}
+ at x = common global i32 0, align 4
----------------
probinson wrote:
> Should this check that prologue_end is *not* on it?
This also should not have a prologue_end on it, I will add a regex check for it too.


================
Comment at: llvm/test/CodeGen/X86/line-zero-prologue-end.ll:25
+!12 = !DILocation(line: 0, column: 5, scope: !9)
+!14 = !DILocation(line: 2, column: 1, scope: !9)
----------------
probinson wrote:
> Please make !9 and !14 use different line numbers, to make it more obvious which one is the source for the .loc directive.
Sure, I will just change it to line 3


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110740/new/

https://reviews.llvm.org/D110740



More information about the llvm-commits mailing list