[llvm] [CodeExtractor] Preserve the original DIExpression for extracted inputs. (PR #224360)
Oliver Hunt via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 27 15:12:00 PDT 2026
ojhunt wrote:
Repro with
`bin/opt -passes=hotcoldsplit -hotcoldsplit-threshold=-1 repro.ll | bin/llc -O2 -filetype=obj -o /dev/null`
```llvm
; repro.ll
target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32"
target triple = "arm64-apple-macosx11.0.0"
declare void @sink(i32) cold
define void @f(i32 %a, i32 %b, i1 %c) !dbg !6 {
entry:
%x = add i32 %a, 1, !dbg !11
%y = add i32 %b, 2, !dbg !11
#dbg_value(!DIArgList(i32 %x, i32 %y), !9, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus, DW_OP_stack_value), !11)
br i1 %c, label %cold, label %exit, !dbg !11
cold:
%s = add i32 %x, %y, !dbg !11
call void @sink(i32 %s), !dbg !11
call void @sink(i32 %x), !dbg !11
br label %exit, !dbg !11
exit:
ret void, !dbg !11
}
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!3, !4}
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)
!1 = !DIFile(filename: "repro.cpp", directory: "/tmp")
!3 = !{i32 2, !"Debug Info Version", i32 3}
!4 = !{i32 7, !"Dwarf Version", i32 4}
!6 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 1, type: !7, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !8)
!7 = !DISubroutineType(types: !8)
!8 = !{}
!9 = !DILocalVariable(name: "v", scope: !6, file: !1, line: 2, type: !10)
!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!11 = !DILocation(line: 2, column: 1, scope: !6)
```
https://github.com/llvm/llvm-project/pull/224360
More information about the llvm-commits
mailing list