1 ; RUN: llc %s -o - -stop-after=livedebugvalues -opt-bisect-limit=0 \
3 ; RUN: llc %s -o - -stop-after=livedebugvalues -opt-bisect-limit=10 \
5 ; RUN: llc %s -o - -stop-after=livedebugvalues -opt-bisect-limit=20 \
7 ; RUN: llc %s -o - -stop-after=livedebugvalues -opt-bisect-limit=30 \
9 ; RUN: llc %s -o - -stop-after=livedebugvalues -opt-bisect-limit=40 \
11 ; RUN: llc %s -o - -stop-after=livedebugvalues -opt-bisect-limit=100 \
13 ;; Test fast-isel for good measure too,
14 ; RUN: llc %s -o - -stop-after=livedebugvalues -fast-isel=true \
16 ; RUN: llc %s -o - -stop-after=livedebugvalues -fast-isel=true \
17 ; RUN: -opt-bisect-limit=0 | FileCheck %s
18 ; RUN: llc %s -o - -stop-after=livedebugvalues -fast-isel=true \
19 ; RUN: -opt-bisect-limit=10 | FileCheck %s
20 ; RUN: llc %s -o - -stop-after=livedebugvalues -fast-isel=true \
21 ; RUN: -opt-bisect-limit=100 | FileCheck %s
23 ; The function below should be optimised with the "default" optimisation level.
24 ; However, opt-bisect-limit causes SelectionDAG to change the target settings
25 ; for the duration of SelectionDAG. This can lead to variable locations created
26 ; in one mode, but the rest of the debug-info analyses expecting the other.
27 ; Test that opt-bisect-limit can be used without any assertions firing, and
28 ; that instruction referencing instructions are seen each time.
30 ; The selection of bisect positions above are not picked meaningfully, the
31 ; pass order and positioning will change over time. The most important part
32 ; is that the bisect limit sits between SelectionDAG and debug-info passes at
35 ; CHECK: DBG_INSTR_REF
38 ; ModuleID = '/tmp/test.cpp'
39 source_filename = "/tmp/test.cpp"
40 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
41 target triple = "x86_64-unknown-linux-gnu"
43 %class.Class = type { i8 }
45 ; Function Attrs: mustprogress uwtable
46 define dso_local void @_Z4FuncP5Class(ptr noundef %c) local_unnamed_addr !dbg !7 {
48 call void @llvm.dbg.value(metadata ptr %c, metadata !15, metadata !DIExpression()), !dbg !16
49 %tobool.not = icmp eq ptr %c, null, !dbg !17
50 br i1 %tobool.not, label %land.lhs.true, label %if.end, !dbg !19
52 land.lhs.true: ; preds = %entry
53 %call = call noundef zeroext i1 @_Z4Condv(), !dbg !20
54 call void @llvm.assume(i1 %call), !dbg !21
55 %call1 = call noalias noundef nonnull dereferenceable(1) ptr @_Znwm(i64 noundef 1), !dbg !22, !heapallocsite !12
56 call void @llvm.dbg.value(metadata ptr %call1, metadata !15, metadata !DIExpression()), !dbg !16
57 br label %if.end, !dbg !23
59 if.end: ; preds = %land.lhs.true, %entry
60 %c.addr.0 = phi ptr [ %c, %entry ], [ %call1, %land.lhs.true ]
61 call void @llvm.dbg.value(metadata ptr %c.addr.0, metadata !15, metadata !DIExpression()), !dbg !16
62 call void @_Z11DoSomethingR5Class(ptr noundef nonnull align 1 dereferenceable(1) %c.addr.0), !dbg !24
66 declare !dbg !26 dso_local noundef zeroext i1 @_Z4Condv() local_unnamed_addr
68 ; Function Attrs: nobuiltin allocsize(0)
69 declare dso_local noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr
71 declare !dbg !30 dso_local void @_Z11DoSomethingR5Class(ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr
73 ; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn
74 declare void @llvm.dbg.value(metadata, metadata, metadata)
76 ; Function Attrs: inaccessiblememonly nocallback nofree nosync nounwind willreturn
77 declare void @llvm.assume(i1 noundef)
80 !llvm.module.flags = !{!2, !3, !4, !5}
83 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
84 !1 = !DIFile(filename: "/tmp/test.cpp", directory: ".")
85 !2 = !{i32 7, !"Dwarf Version", i32 5}
86 !3 = !{i32 2, !"Debug Info Version", i32 3}
87 !4 = !{i32 1, !"wchar_size", i32 4}
88 !5 = !{i32 7, !"uwtable", i32 2}
90 !7 = distinct !DISubprogram(name: "Func", linkageName: "_Z4FuncP5Class", scope: !8, file: !8, line: 6, type: !9, scopeLine: 6, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !14)
91 !8 = !DIFile(filename: "/tmp/test.cpp", directory: "")
92 !9 = !DISubroutineType(types: !10)
94 !11 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !12, size: 64)
95 !12 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "Class", file: !8, line: 3, size: 8, flags: DIFlagTypePassByValue, elements: !13, identifier: "_ZTS5Class")
98 !15 = !DILocalVariable(name: "c", arg: 1, scope: !7, file: !8, line: 6, type: !11)
99 !16 = !DILocation(line: 0, scope: !7)
100 !17 = !DILocation(line: 7, column: 10, scope: !18)
101 !18 = distinct !DILexicalBlock(scope: !7, file: !8, line: 7, column: 9)
102 !19 = !DILocation(line: 7, column: 12, scope: !18)
103 !20 = !DILocation(line: 7, column: 15, scope: !18)
104 !21 = !DILocation(line: 7, column: 9, scope: !7)
105 !22 = !DILocation(line: 8, column: 13, scope: !18)
106 !23 = !DILocation(line: 8, column: 9, scope: !18)
107 !24 = !DILocation(line: 10, column: 5, scope: !7)
108 !25 = !DILocation(line: 11, column: 1, scope: !7)
109 !26 = !DISubprogram(name: "Cond", linkageName: "_Z4Condv", scope: !8, file: !8, line: 5, type: !27, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !13)
110 !27 = !DISubroutineType(types: !28)
112 !29 = !DIBasicType(name: "bool", size: 8, encoding: DW_ATE_boolean)
113 !30 = !DISubprogram(name: "DoSomething", linkageName: "_Z11DoSomethingR5Class", scope: !8, file: !8, line: 4, type: !31, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !13)
114 !31 = !DISubroutineType(types: !32)
116 !33 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !12, size: 64)