xref: /llvm-project/llvm/test/Transforms/JumpThreading/preserving-debugloc-bitcast.ll (revision 3773191fc4e088fb06592e0404296f6051b1d4f7)
1; RUN: opt < %s -S -passes=jump-threading | FileCheck %s
2
3; Test that JumpThreading's `simplifyPartiallyRedundantLoad` propagates
4; the debug location to the `bitcast` from the LoadInst it replaces (`%b`).
5
6declare void @f1(...)
7
8define void @test8(ptr %0, ptr %1, ptr %2) !dbg !5 {
9; CHECK: @test8
10; CHECK:    [[TMP4:%.*]] = bitcast float [[A:%.*]] to i32, !dbg [[DBG9:![0-9]+]]
11; CHECK: [[DBG9]] = !DILocation(line: 2,
12;
13  %a = load float, ptr %0, align 4, !dbg !8
14  %b = load i32, ptr %0, align 4, !dbg !9
15  store float %a, ptr %1, align 4, !dbg !10
16  %c = icmp eq i32 %b, 8, !dbg !11
17  br i1 %c, label %ret1, label %ret2, !dbg !12
18
19ret1:                                             ; preds = %3
20  ret void, !dbg !13
21
22ret2:                                             ; preds = %3
23  %xxx = tail call i32 (...) @f1() #0, !dbg !14
24  ret void, !dbg !15
25}
26
27!llvm.dbg.cu = !{!0}
28!llvm.debugify = !{!2, !3}
29!llvm.module.flags = !{!4}
30
31!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)
32!1 = !DIFile(filename: "test.ll", directory: "/")
33!2 = !{i32 8}
34!3 = !{i32 0}
35!4 = !{i32 2, !"Debug Info Version", i32 3}
36!5 = distinct !DISubprogram(name: "test8", linkageName: "test8", scope: null, file: !1, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0)
37!6 = !DISubroutineType(types: !7)
38!7 = !{}
39!8 = !DILocation(line: 1, column: 1, scope: !5)
40!9 = !DILocation(line: 2, column: 1, scope: !5)
41!10 = !DILocation(line: 3, column: 1, scope: !5)
42!11 = !DILocation(line: 4, column: 1, scope: !5)
43!12 = !DILocation(line: 5, column: 1, scope: !5)
44!13 = !DILocation(line: 6, column: 1, scope: !5)
45!14 = !DILocation(line: 7, column: 1, scope: !5)
46!15 = !DILocation(line: 8, column: 1, scope: !5)
47