[llvm] [RemoveDIs] Print non-intrinsic debug info in textual IR output (PR #79281)

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 24 08:59:00 PST 2024


================
@@ -0,0 +1,80 @@
+;; Test that we can write in the new debug info format.
+; RUN: opt --passes=verify -S --write-experimental-debuginfo=false < %s \
+; RUN:   | FileCheck %s --check-prefixes=CHECK,OLDDBG --implicit-check-not=llvm.dbg
+; RUN: opt --passes=verify -S --write-experimental-debuginfo=true < %s \
+; RUN:   | FileCheck %s --check-prefixes=CHECK,NEWDBG --implicit-check-not=llvm.dbg
+
+;; Test also that the new flag is independent of the flag that enables use of
+;; these non-instruction debug info during LLVM passes.
+; RUN: opt --passes=verify -S --try-experimental-debuginfo-iterators --write-experimental-debuginfo=false < %s \
+; RUN:   | FileCheck %s --check-prefixes=CHECK,OLDDBG --implicit-check-not=llvm.dbg
+; RUN: opt --passes=verify -S --try-experimental-debuginfo-iterators --write-experimental-debuginfo=true < %s \
+; RUN:   | FileCheck %s --check-prefixes=CHECK,NEWDBG --implicit-check-not=llvm.dbg
+
+; CHECK: @f(i32 %[[VAL_A:[0-9a-zA-Z]+]])
+; CHECK-NEXT: entry:
+; OLDDBG-NEXT: call void @llvm.dbg.value(metadata i32 %[[VAL_A]], metadata ![[VAR_A:[0-9]+]], metadata !DIExpression()), !dbg ![[LOC_1:[0-9]+]]
+; NEWDBG-NEXT: {{^}}    #dbg_value { i32 %[[VAL_A]], ![[VAR_A:[0-9]+]], !DIExpression(), ![[LOC_1:[0-9]+]] }
----------------
dwblaikie wrote:

Not sure if it'd be a good thing, but you could do this with something like:
OLDDBG-NEXT: call void @llvm.dbg.value(metadata
NEWDBG-NEXT: #dbg_value {
CHECK-SAME: i32 %[[VAL_A]],
OLDDBG-SAME: metadata
CHECK-SAME: ![[VAR_A:[0-9+]],
OLDDBG-SAME: metadata
CHECK-SAME: !DIExpression()
OLDDBG-SAME: ), !dbg
NEWDBG-SAME: ,
CHECK-SAME: ![[LOC_1:[0-9]+]]
NEWDBG-SAME: }
```
Not sure if that'd make things easier or harder to read, though - maybe adding some extra whitespace so the common parts of th elines line up between the old and new would make it easier to eyeball that the common parts are common (that it's VAL_A, VAR_A, LOC_1, etc)?

https://github.com/llvm/llvm-project/pull/79281


More information about the llvm-commits mailing list