diff --git a/llvm/test/DebugInfo/no-dicompileunit.ll b/llvm/test/DebugInfo/no-dicompileunit.ll new file mode 100644 --- /dev/null +++ b/llvm/test/DebugInfo/no-dicompileunit.ll @@ -0,0 +1,64 @@ +; RUN: opt -S -strip-debug -disable-debug-info-type-map < %s | FileCheck %s + +; CHECK: define {{.*}}@main +; CHECK-NOT: DICompileUnit + +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +; Function Attrs: noinline nounwind optnone uwtable +define dso_local i32 @main() #0 !dbg !10 { +entry: + %retval = alloca i32, align 4 + %i = alloca i32, align 4 + store i32 0, ptr %retval, align 4 + store i32 0, ptr %i, align 4, !dbg !13 + br label %for.cond, !dbg !13 + +for.cond: ; preds = %for.inc, %entry + %0 = load i32, ptr %i, align 4, !dbg !13 + %cmp = icmp slt i32 %0, 1, !dbg !13 + br i1 %cmp, label %for.body, label %for.end, !dbg !13 + +for.body: ; preds = %for.cond + br label %for.inc, !dbg !14 + +for.inc: ; preds = %for.body + %1 = load i32, ptr %i, align 4, !dbg !13 + %inc = add nsw i32 %1, 1, !dbg !13 + store i32 %inc, ptr %i, align 4, !dbg !13 + br label %for.cond, !dbg !13, !llvm.loop !15 + +for.end: ; preds = %for.cond + ret i32 0, !dbg !22 +} + +attributes #0 = { noinline nounwind optnone uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!2, !3, !4, !5, !6, !7, !8} +!llvm.ident = !{!9} + +!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 16.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: LineTablesOnly, splitDebugInlining: false, nameTableKind: None) +!1 = !DIFile(filename: "foo.c", directory: "/") +!2 = !{i32 7, !"Dwarf Version", i32 5} +!3 = !{i32 2, !"Debug Info Version", i32 3} +!4 = !{i32 1, !"wchar_size", i32 4} +!5 = !{i32 8, !"PIC Level", i32 2} +!6 = !{i32 7, !"PIE Level", i32 2} +!7 = !{i32 7, !"uwtable", i32 2} +!8 = !{i32 7, !"frame-pointer", i32 2} +!9 = !{!"clang version 16.0.0"} +!10 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 1, type: !11, scopeLine: 2, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !12) +!11 = !DISubroutineType(types: !12) +!12 = !{} +!13 = !DILocation(line: 5, scope: !10) +!14 = !DILocation(line: 7, scope: !10) +!15 = distinct !{!15, !13, !14, !16, !17, !18} +!16 = !{!"llvm.loop.mustprogress"} +!17 = !{!"llvm.loop.vectorize.enable", i1 true} +!18 = !{!"llvm.loop.vectorize.followup_all", !19} +!19 = distinct !{!19, !13, !14, !16, !20, !21} +!20 = !{!"llvm.loop.isvectorized"} +!21 = !{!"llvm.loop.unroll.count", i32 1} +!22 = !DILocation(line: 8, scope: !10)