86 lines · plain
1; RUN: llc %s -start-after=codegenprepare -stop-before=finalize-isel \2; RUN: -experimental-debug-variable-locations=true -o - \3; RUN: | FileCheck %s4 5; Test that the given input doesn't crash with instrruction referencing variable6; locations. The use of llvm.read_register allows the IR to access any register7; at any point, which is unfortunate, but a use case that needs to be supported.8;9; Just examine to see that we read something from $rsp.10; CHECK-LABEL: bb.1.if.then:11; CHECK: DBG_PHI $rsp, 112; CHECK: DBG_INSTR_REF {{.+}}, dbg-instr-ref(1, 0)13 14source_filename = "tlb-9e7172.c"15target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"16target triple = "x86_64-cros-linux-gnu"17 18@c = dso_local local_unnamed_addr global i32 0, align 4, !dbg !019 20; Function Attrs: noredzone nounwind null_pointer_is_valid optsize sspstrong21define dso_local void @switch_mm_irqs_off() local_unnamed_addr #0 !dbg !16 {22entry:23 %0 = load i32, ptr @c, align 4, !dbg !2424 %tobool.not = icmp eq i32 %0, 0, !dbg !2425 br i1 %tobool.not, label %if.end, label %if.then, !dbg !2526 27if.then: ; preds = %entry28 call void @llvm.dbg.value(metadata i64 0, metadata !20, metadata !DIExpression()), !dbg !2629 %1 = tail call i64 @llvm.read_register.i64(metadata !7), !dbg !2730 call void @llvm.dbg.value(metadata i64 %1, metadata !20, metadata !DIExpression()), !dbg !2631 %call = tail call i32 @b(i64 noundef %1) #4, !dbg !2832 ret void, !dbg !2933 34if.end: ; preds = %entry35 ret void, !dbg !2936}37 38; Function Attrs: nofree nounwind readonly39declare i64 @llvm.read_register.i64(metadata) #140 41; Function Attrs: noredzone null_pointer_is_valid optsize42declare !dbg !30 dso_local i32 @b(i64 noundef) local_unnamed_addr #243 44; Function Attrs: nofree nosync nounwind readnone speculatable willreturn45declare void @llvm.dbg.value(metadata, metadata, metadata) #346 47!llvm.dbg.cu = !{!2}48!llvm.named.register.rsp = !{!7}49!llvm.module.flags = !{!8, !9, !10, !11, !12, !13, !14}50!llvm.ident = !{!15}51 52!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())53!1 = distinct !DIGlobalVariable(name: "c", scope: !2, file: !5, line: 2, type: !6, isLocal: false, isDefinition: true)54!2 = distinct !DICompileUnit(language: DW_LANG_C89, file: !3, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, globals: !4, splitDebugInlining: false, debugInfoForProfiling: true, nameTableKind: None)55!3 = !DIFile(filename: "tlb.c", directory: ".")56!4 = !{!0}57!5 = !DIFile(filename: "tlb-9e7172.c", directory: ".")58!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)59!7 = !{!"rsp"}60!8 = !{i32 7, !"Dwarf Version", i32 4}61!9 = !{i32 2, !"Debug Info Version", i32 3}62!10 = !{i32 1, !"wchar_size", i32 2}63!11 = !{i32 1, !"Code Model", i32 2}64!12 = !{i32 7, !"frame-pointer", i32 2}65!13 = !{i32 1, !"override-stack-alignment", i32 8}66!14 = !{i32 4, !"SkipRaxSetup", i32 1}67!15 = !{!"clang version 15.0.0 (git@github.com:llvm/llvm-project ab49dce01f211fd80f76f449035d771f5e2720b9)"}68!16 = distinct !DISubprogram(name: "switch_mm_irqs_off", scope: !5, file: !5, line: 4, type: !17, scopeLine: 4, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !19)69!17 = !DISubroutineType(types: !18)70!18 = !{null}71!19 = !{!20}72!20 = !DILocalVariable(name: "d", scope: !21, file: !5, line: 6, type: !23)73!21 = distinct !DILexicalBlock(scope: !22, file: !5, line: 5, column: 10)74!22 = distinct !DILexicalBlock(scope: !16, file: !5, line: 5, column: 7)75!23 = !DIBasicType(name: "long", size: 64, encoding: DW_ATE_signed)76!24 = !DILocation(line: 5, column: 7, scope: !22)77!25 = !DILocation(line: 5, column: 7, scope: !16)78!26 = !DILocation(line: 0, scope: !21)79!27 = !DILocation(line: 6, column: 14, scope: !21)80!28 = !DILocation(line: 7, column: 5, scope: !21)81!29 = !DILocation(line: 9, column: 1, scope: !16)82!30 = !DISubprogram(name: "b", scope: !5, file: !5, line: 3, type: !31, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !33)83!31 = !DISubroutineType(types: !32)84!32 = !{!6, !23}85!33 = !{}86