1; RUN: llc %s -o - -stop-after=livedebugvalues -opt-bisect-limit=0 \ 2; RUN: | FileCheck %s 3; RUN: llc %s -o - -stop-after=livedebugvalues -opt-bisect-limit=10 \ 4; RUN: | FileCheck %s 5; RUN: llc %s -o - -stop-after=livedebugvalues -opt-bisect-limit=20 \ 6; RUN: | FileCheck %s 7; RUN: llc %s -o - -stop-after=livedebugvalues -opt-bisect-limit=30 \ 8; RUN: | FileCheck %s 9; RUN: llc %s -o - -stop-after=livedebugvalues -opt-bisect-limit=40 \ 10; RUN: | FileCheck %s 11; RUN: llc %s -o - -stop-after=livedebugvalues -opt-bisect-limit=100 \ 12; RUN: | FileCheck %s 13;; Test fast-isel for good measure too, 14; RUN: llc %s -o - -stop-after=livedebugvalues -fast-isel=true \ 15; RUN: | FileCheck %s 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 22 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. 29; 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 33; some point. 34 35; CHECK: DBG_INSTR_REF 36; CHECK: DBG_PHI 37 38; ModuleID = '/tmp/test.cpp' 39source_filename = "/tmp/test.cpp" 40target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 41target triple = "x86_64-unknown-linux-gnu" 42 43%class.Class = type { i8 } 44 45; Function Attrs: mustprogress uwtable 46define dso_local void @_Z4FuncP5Class(ptr noundef %c) local_unnamed_addr !dbg !7 { 47entry: 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 51 52land.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 58 59if.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 63 ret void, !dbg !25 64} 65 66declare !dbg !26 dso_local noundef zeroext i1 @_Z4Condv() local_unnamed_addr 67 68; Function Attrs: nobuiltin allocsize(0) 69declare dso_local noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr 70 71declare !dbg !30 dso_local void @_Z11DoSomethingR5Class(ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr 72 73; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn 74declare void @llvm.dbg.value(metadata, metadata, metadata) 75 76; Function Attrs: inaccessiblememonly nocallback nofree nosync nounwind willreturn 77declare void @llvm.assume(i1 noundef) 78 79!llvm.dbg.cu = !{!0} 80!llvm.module.flags = !{!2, !3, !4, !5} 81!llvm.ident = !{!6} 82 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} 89!6 = !{!"clang"} 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) 93!10 = !{null, !11} 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") 96!13 = !{} 97!14 = !{!15} 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) 111!28 = !{!29} 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) 115!32 = !{null, !33} 116!33 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !12, size: 64) 117