xref: /llvm-project/llvm/test/Transforms/LoopRotate/delete-dbg-values.ll (revision 094572701dce4aaf36f4521d6cf750420d39f206)
1; RUN: opt --passes=loop-rotate -o - -S %s | FileCheck %s --implicit-check-not=dbg.value
2; RUN: opt --passes=loop-rotate -o - -S %s --try-experimental-debuginfo-iterators | FileCheck %s --implicit-check-not=dbg.value
3;
4;; Test some fine-grained behaviour of loop-rotate's de-duplication of
5;; dbg.values. The intrinsic on the first branch should be seen and
6;; prevent the rotation of the dbg.value for "sink" into the entry block.
7;; However the other dbg.value, for "source", should not be seen, and we'll
8;; get a duplicate.
9;
10target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
11target triple = "x86_64-unknown-linux-gnu"
12
13
14; CHECK-LABEL: define void @_ZNK4llvm5APInt4sextEj(ptr
15; CHECK-LABEL: entry:
16; CHECK:       #dbg_value(i32 0, ![[SRC:[0-9]+]],
17; CHECK-NEXT:  load
18; CHECK-NEXT:  #dbg_value(i32 0, ![[SINK:[0-9]+]],
19; CHECK-NEXT:  #dbg_value(i32 0, ![[SRC]],
20; CHECK-LABEL: for.body:
21; CHECK:       #dbg_value(i32 0, ![[SINK]],
22; CHECK-NEXT:  #dbg_value(i32 0, ![[SRC]],
23
24declare void @llvm.dbg.value(metadata, metadata, metadata)
25
26define void @_ZNK4llvm5APInt4sextEj(ptr %agg.result) !dbg !5 {
27entry:
28  tail call void @llvm.dbg.value(metadata i32 0, metadata !4, metadata !DIExpression()), !dbg !10
29  %.pre = load i32, ptr %agg.result, align 8
30  tail call void @llvm.dbg.value(metadata i32 0, metadata !11, metadata !DIExpression()), !dbg !10
31  br label %for.cond
32
33for.cond:                                         ; preds = %for.body, %entry
34  %i.0 = phi i32 [ 0, %entry ], [ 1, %for.body ]
35  tail call void @llvm.dbg.value(metadata i32 0, metadata !11, metadata !DIExpression()), !dbg !10
36  tail call void @llvm.dbg.value(metadata i32 0, metadata !4, metadata !DIExpression()), !dbg !10
37  %cmp12.not = icmp eq i32 %i.0, %.pre, !dbg !10
38  br i1 %cmp12.not, label %for.end, label %for.body
39
40for.body:                                         ; preds = %for.cond
41  store i64 0, ptr %agg.result, align 8
42  br label %for.cond
43
44for.end:                                          ; preds = %for.cond
45  ret void
46}
47
48!llvm.dbg.cu = !{!0}
49!llvm.module.flags = !{!3}
50
51!0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2, globals: !2, splitDebugInlining: false, nameTableKind: None)
52!1 = !DIFile(filename: "foo", directory: "bar")
53!2 = !{}
54!3 = !{i32 2, !"Debug Info Version", i32 3}
55!4 = !DILocalVariable(name: "source", scope: !5, file: !6, line: 170, type: !8)
56!5 = distinct !DISubprogram(name: "ConvertUTF16toUTF32", scope: !6, file: !6, line: 166, type: !7, scopeLine: 168, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
57!6 = !DIFile(filename: "fooo", directory: ".")
58!7 = !DISubroutineType(types: !2)
59!8 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !9, size: 64)
60!9 = !DIBasicType(name: "unsigned short", size: 16, encoding: DW_ATE_unsigned)
61!10 = !DILocation(line: 0, scope: !5)
62!11 = !DILocalVariable(name: "sink", scope: !5, file: !6, line: 170, type: !8)
63