<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/94050>94050</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[DebugInfo] branch-folder drops debug info in tail merging even if tail merging doesn't change IR
</td>
</tr>
<tr>
<th>Labels</th>
<td>
debuginfo
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
aeubanks
</td>
</tr>
</table>
<pre>
```
$ cat /tmp/a.ll
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-grtev4-linux-gnu"
define i32 @main(i1 %0) {
entry:
br i1 %0, label %1, label %2
1: ; preds = %entry
store i64 1, ptr null, align 1
br label %3, !dbg !3
2: ; preds = %entry
store i64 0, ptr null, align 1
br label %3
3: ; preds = %2, %1
ret i32 0
}
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!2}
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly, nameTableKind: None)
!1 = !DIFile(filename: "foo.c", directory: "/tmp", checksumkind: CSK_MD5, checksum: "2d07c91bb9d9c2fa4eee31a1aeed20e3")
!2 = !{i32 2, !"Debug Info Version", i32 3}
!3 = !DILocation(line: 17, column: 3, scope: !4)
!4 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 6, type: !5, scopeLine: 6, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0)
!5 = !DISubroutineType(types: !6)
!6 = !{}
$ build/rel/bin/llc -o /tmp/b.s /tmp/a.ll -enable-tail-merge=1 -stop-after=branch-folder
$ build/rel/bin/llc -o /tmp/a.s /tmp/a.ll -enable-tail-merge=0 -stop-after=branch-folder
$ diff /tmp/a.s /tmp/b.s
98c98
< JMP_1 %bb.8, debug-location !21
---
> JMP_1 %bb.8
```
reduced from a ubsan backtrace missing line info
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVltv4ygU_jXkBTkyx3ZiP-ShE29W3elctN3LY4XNscMWgwW4mu6vX4GdW2dWmkYRgcO5fOdKuHOy14g7UnwgRb3ikz8au-M4NVw_u1VjxOuObNLlm9YkvSOQ05Z7SuDgh5HAga-Vmq88tz16Krjnir-ayVOS1ZQAYDKQ7A6TEbYpye4yiEs4sttj2G3yuCTyvGFQkuyOQZl0ZbrsdCRtTuKbPHkMbAA3ULyVo8ITjG_l5mmTJ731-JInSurpW9Lr6Sw0rwI7qZHKDCjJ04FLTaCUjBIoUgIVJdsPMyNqb19JtohR2lh6ZttTxRtU4cRuTjemgveUZB_oaFG4BWYx612UOm8sUrnJadQzekv1pFTYcyV7TdmV-bOVLNwTYKLpw092bRTeYzR9l9ErK1mw8s7Pd6BgdqM4m7PoY2JOtbitr20SYEq9DGvR9Ot2WpSwkC9g6YV34RqMmBSuO8V7d8sL3-tNI4eQzkvdhuJn9f3eDKNU-KeWnkCpuO4n3mPwu_776eHu869P-6dRTW5eWB6c6aSKHATYnE9rxNSinWkQv3sq3ZfRy0H-iyJceDthINtJezngX2idNDrcxPTgIF0gfJQ6sj9IjX_wRqH7otVr4NB8mCknls9GI4Hq7B47BaC-PwSEUAagQWwB1hmzbhd0QlpsvYm1P4OeJ0G8bI_YPrtpeF4s7R8_Pn2qi-urRQxEum0r1jSVqFroeI6IGeOMIwpIMYsKLxDhKkehBJbaYASgxmbq6b3uDD3FZoljBjS7Tnx28fPBtNxH1lJJHf1k2wjTqGmI0Y1d5FoznlKWXwPKf1ASj1MzWtNbPhAor8I3TxF4q4_9qCROaDbh4F_PzMVZ-uGaI9ZvLLr7g-L9V2u8CVKCku1-Id4ptedKuRpda2WDIqoaDxfRx6_hUIfRJ0NUFuGZfClG2NMplPuMKL0OR3EJ7ePUWDP5UIYBPpQBj1uENtdCm-vGe9t0OW0mqQ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