From d71b1f738d55dce1236c624b240152a26f07d5f7 Mon Sep 17 00:00:00 2001 From: OCHyams Date: Tue, 14 Mar 2023 08:17:19 +0000 Subject: [PATCH] NFC Fix cost model checks in tests for debug intrinsics These tests don't have a "Debug Info Version" module flag causing the debug intrinsics to be dropped with a warning `warning: ignoring debug info with an invalid version (0)`. The test passes because there are no CHECK lines for these intrinsics. Fix the issue and auto-update the test checks. Reviewed By: jryans Differential Revision: https://reviews.llvm.org/D145573 --- llvm/test/Analysis/CostModel/X86/free-intrinsics.ll | 21 +++++++++++++++------ .../CostModel/free-intrinsics-datalayout.ll | 21 +++++++++++++++------ .../Analysis/CostModel/free-intrinsics-no_info.ll | 21 +++++++++++++++------ 3 files changed, 45 insertions(+), 18 deletions(-) diff --git a/llvm/test/Analysis/CostModel/X86/free-intrinsics.ll b/llvm/test/Analysis/CostModel/X86/free-intrinsics.ll index 4d31a7c..da5d075 100644 --- a/llvm/test/Analysis/CostModel/X86/free-intrinsics.ll +++ b/llvm/test/Analysis/CostModel/X86/free-intrinsics.ll @@ -6,8 +6,10 @@ define i32 @trivially_free() { ; CHECK-SIZE-LABEL: 'trivially_free' ; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a0 = call i32 @llvm.annotation.i32.p0(i32 undef, ptr undef, ptr undef, i32 undef) ; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.assume(i1 undef) -; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.experimental.noalias.scope.decl(metadata !0) +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.experimental.noalias.scope.decl(metadata !3) ; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.sideeffect() +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.dbg.declare(metadata ptr undef, metadata !6, metadata !DIExpression()), !dbg !8 +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.dbg.label(metadata !9), !dbg !8 ; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a1 = call ptr @llvm.invariant.start.p0(i64 1, ptr undef) ; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.invariant.end.p0(ptr undef, i64 1, ptr undef) ; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a2 = call ptr @llvm.launder.invariant.group.p0(ptr undef) @@ -23,8 +25,10 @@ define i32 @trivially_free() { ; CHECK-THROUGHPUT-LABEL: 'trivially_free' ; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a0 = call i32 @llvm.annotation.i32.p0(i32 undef, ptr undef, ptr undef, i32 undef) ; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.assume(i1 undef) -; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.experimental.noalias.scope.decl(metadata !0) +; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.experimental.noalias.scope.decl(metadata !3) ; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.sideeffect() +; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.dbg.declare(metadata ptr undef, metadata !6, metadata !DIExpression()), !dbg !8 +; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.dbg.label(metadata !9), !dbg !8 ; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a1 = call ptr @llvm.invariant.start.p0(i64 1, ptr undef) ; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.invariant.end.p0(ptr undef, i64 1, ptr undef) ; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a2 = call ptr @llvm.launder.invariant.group.p0(ptr undef) @@ -41,9 +45,9 @@ define i32 @trivially_free() { call void @llvm.assume(i1 undef) call void @llvm.experimental.noalias.scope.decl(metadata !4) call void @llvm.sideeffect() - call void @llvm.dbg.declare(metadata ptr undef, metadata !0, metadata !DIExpression()) - call void @llvm.dbg.value(metadata i64 undef, i64 undef, metadata !DIExpression(), metadata !DIExpression()) - call void @llvm.dbg.label(metadata !2) + call void @llvm.dbg.declare(metadata ptr undef, metadata !0, metadata !DIExpression()), !dbg !8 + call void @llvm.dbg.value(metadata i64 undef, i64 undef, metadata !DIExpression(), metadata !DIExpression()), !dbg !8 + call void @llvm.dbg.label(metadata !2), !dbg !8 %a1 = call ptr @llvm.invariant.start.p0(i64 1, ptr undef) call void @llvm.invariant.end.p0(ptr undef, i64 1, ptr undef) %a2 = call ptr @llvm.launder.invariant.group.p0(ptr undef) @@ -75,11 +79,16 @@ declare i64 @llvm.objectsize.i64.p0(ptr, i1, i1, i1) declare ptr @llvm.ptr.annotation.p0(ptr, ptr, ptr, i32, ptr) declare void @llvm.var.annotation(ptr, ptr, ptr, i32, ptr) +!llvm.dbg.cu = !{!9} +!llvm.module.flags = !{!7} !0 = !DILocalVariable(scope: !1) -!1 = distinct !DISubprogram(name: "dummy", line: 79, isLocal: true, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true) +!1 = distinct !DISubprogram(name: "dummy", line: 79, isLocal: true, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, file: !3, unit: !9) !2 = !DILabel(scope: !1, name: "label", file: !3, line: 7) !3 = !DIFile(filename: "debug-label.c", directory: "./") !4 = !{ !5 } !5 = distinct !{ !5, !6, !"foo: var" } !6 = distinct !{ !6, !"foo" } +!7 = !{i32 2, !"Debug Info Version", i32 3} +!8 = !DILocation(line: 0, scope: !1) +!9 = distinct !DICompileUnit(language: DW_LANG_C11, file: !3, producer: "clang") diff --git a/llvm/test/Analysis/CostModel/free-intrinsics-datalayout.ll b/llvm/test/Analysis/CostModel/free-intrinsics-datalayout.ll index 249b610..7374baf 100644 --- a/llvm/test/Analysis/CostModel/free-intrinsics-datalayout.ll +++ b/llvm/test/Analysis/CostModel/free-intrinsics-datalayout.ll @@ -8,8 +8,10 @@ define i32 @trivially_free() { ; CHECK-SIZE-LABEL: 'trivially_free' ; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a0 = call i32 @llvm.annotation.i32.p0(i32 undef, ptr undef, ptr undef, i32 undef) ; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.assume(i1 undef) -; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.experimental.noalias.scope.decl(metadata !0) +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.experimental.noalias.scope.decl(metadata !3) ; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.sideeffect() +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.dbg.declare(metadata ptr undef, metadata !6, metadata !DIExpression()), !dbg !8 +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.dbg.label(metadata !9), !dbg !8 ; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a1 = call ptr @llvm.invariant.start.p0(i64 1, ptr undef) ; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.invariant.end.p0(ptr undef, i64 1, ptr undef) ; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a2 = call ptr @llvm.launder.invariant.group.p0(ptr undef) @@ -25,8 +27,10 @@ define i32 @trivially_free() { ; CHECK-THROUGHPUT-LABEL: 'trivially_free' ; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a0 = call i32 @llvm.annotation.i32.p0(i32 undef, ptr undef, ptr undef, i32 undef) ; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.assume(i1 undef) -; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.experimental.noalias.scope.decl(metadata !0) +; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.experimental.noalias.scope.decl(metadata !3) ; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.sideeffect() +; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.dbg.declare(metadata ptr undef, metadata !6, metadata !DIExpression()), !dbg !8 +; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.dbg.label(metadata !9), !dbg !8 ; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a1 = call ptr @llvm.invariant.start.p0(i64 1, ptr undef) ; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.invariant.end.p0(ptr undef, i64 1, ptr undef) ; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a2 = call ptr @llvm.launder.invariant.group.p0(ptr undef) @@ -43,9 +47,9 @@ define i32 @trivially_free() { call void @llvm.assume(i1 undef) call void @llvm.experimental.noalias.scope.decl(metadata !4) call void @llvm.sideeffect() - call void @llvm.dbg.declare(metadata ptr undef, metadata !0, metadata !DIExpression()) - call void @llvm.dbg.value(metadata i64 undef, i64 undef, metadata !DIExpression(), metadata !DIExpression()) - call void @llvm.dbg.label(metadata !2) + call void @llvm.dbg.declare(metadata ptr undef, metadata !0, metadata !DIExpression()), !dbg !8 + call void @llvm.dbg.value(metadata i64 undef, i64 undef, metadata !DIExpression(), metadata !DIExpression()), !dbg !8 + call void @llvm.dbg.label(metadata !2), !dbg !8 %a1 = call ptr @llvm.invariant.start.p0(i64 1, ptr undef) call void @llvm.invariant.end.p0(ptr undef, i64 1, ptr undef) %a2 = call ptr @llvm.launder.invariant.group.p0(ptr undef) @@ -77,11 +81,16 @@ declare i64 @llvm.objectsize.i64.p0(ptr, i1, i1, i1) declare ptr @llvm.ptr.annotation.p0(ptr, ptr, ptr, i32, ptr) declare void @llvm.var.annotation(ptr, ptr, ptr, i32, ptr) +!llvm.dbg.cu = !{!9} +!llvm.module.flags = !{!7} !0 = !DILocalVariable(scope: !1) -!1 = distinct !DISubprogram(name: "dummy", line: 79, isLocal: true, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true) +!1 = distinct !DISubprogram(name: "dummy", line: 79, isLocal: true, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, file: !3, unit: !9) !2 = !DILabel(scope: !1, name: "label", file: !3, line: 7) !3 = !DIFile(filename: "debug-label.c", directory: "./") !4 = !{ !5 } !5 = distinct !{ !5, !6, !"foo: var" } !6 = distinct !{ !6, !"foo" } +!7 = !{i32 2, !"Debug Info Version", i32 3} +!8 = !DILocation(line: 0, scope: !1) +!9 = distinct !DICompileUnit(language: DW_LANG_C11, file: !3, producer: "clang") diff --git a/llvm/test/Analysis/CostModel/free-intrinsics-no_info.ll b/llvm/test/Analysis/CostModel/free-intrinsics-no_info.ll index 715b124..5fb3a76 100644 --- a/llvm/test/Analysis/CostModel/free-intrinsics-no_info.ll +++ b/llvm/test/Analysis/CostModel/free-intrinsics-no_info.ll @@ -6,8 +6,10 @@ define i32 @trivially_free() { ; CHECK-SIZE-LABEL: 'trivially_free' ; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a0 = call i32 @llvm.annotation.i32.p0(i32 undef, ptr undef, ptr undef, i32 undef) ; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.assume(i1 undef) -; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.experimental.noalias.scope.decl(metadata !0) +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.experimental.noalias.scope.decl(metadata !3) ; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.sideeffect() +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.dbg.declare(metadata ptr undef, metadata !6, metadata !DIExpression()), !dbg !8 +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.dbg.label(metadata !9), !dbg !8 ; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a1 = call ptr @llvm.invariant.start.p0(i64 1, ptr undef) ; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.invariant.end.p0(ptr undef, i64 1, ptr undef) ; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a2 = call ptr @llvm.launder.invariant.group.p0(ptr undef) @@ -23,8 +25,10 @@ define i32 @trivially_free() { ; CHECK-THROUGHPUT-LABEL: 'trivially_free' ; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a0 = call i32 @llvm.annotation.i32.p0(i32 undef, ptr undef, ptr undef, i32 undef) ; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.assume(i1 undef) -; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.experimental.noalias.scope.decl(metadata !0) +; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.experimental.noalias.scope.decl(metadata !3) ; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.sideeffect() +; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.dbg.declare(metadata ptr undef, metadata !6, metadata !DIExpression()), !dbg !8 +; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.dbg.label(metadata !9), !dbg !8 ; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a1 = call ptr @llvm.invariant.start.p0(i64 1, ptr undef) ; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.invariant.end.p0(ptr undef, i64 1, ptr undef) ; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a2 = call ptr @llvm.launder.invariant.group.p0(ptr undef) @@ -41,9 +45,9 @@ define i32 @trivially_free() { call void @llvm.assume(i1 undef) call void @llvm.experimental.noalias.scope.decl(metadata !4) call void @llvm.sideeffect() - call void @llvm.dbg.declare(metadata ptr undef, metadata !0, metadata !DIExpression()) - call void @llvm.dbg.value(metadata i64 undef, i64 undef, metadata !DIExpression(), metadata !DIExpression()) - call void @llvm.dbg.label(metadata !2) + call void @llvm.dbg.declare(metadata ptr undef, metadata !0, metadata !DIExpression()), !dbg !8 + call void @llvm.dbg.value(metadata i64 undef, i64 undef, metadata !DIExpression(), metadata !DIExpression()), !dbg !8 + call void @llvm.dbg.label(metadata !2), !dbg !8 %a1 = call ptr @llvm.invariant.start.p0(i64 1, ptr undef) call void @llvm.invariant.end.p0(ptr undef, i64 1, ptr undef) %a2 = call ptr @llvm.launder.invariant.group.p0(ptr undef) @@ -75,11 +79,16 @@ declare i64 @llvm.objectsize.i64.p0(ptr, i1, i1, i1) declare ptr @llvm.ptr.annotation.p0(ptr, ptr, ptr, i32, ptr) declare void @llvm.var.annotation(ptr, ptr, ptr, i32, ptr) +!llvm.dbg.cu = !{!9} +!llvm.module.flags = !{!7} !0 = !DILocalVariable(scope: !1) -!1 = distinct !DISubprogram(name: "dummy", line: 79, isLocal: true, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true) +!1 = distinct !DISubprogram(name: "dummy", line: 79, isLocal: true, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, file: !3, unit: !9) !2 = !DILabel(scope: !1, name: "label", file: !3, line: 7) !3 = !DIFile(filename: "debug-label.c", directory: "./") !4 = !{ !5 } !5 = distinct !{ !5, !6, !"foo: var" } !6 = distinct !{ !6, !"foo" } +!7 = !{i32 2, !"Debug Info Version", i32 3} +!8 = !DILocation(line: 0, scope: !1) +!9 = distinct !DICompileUnit(language: DW_LANG_C11, file: !3, producer: "clang") -- 2.7.4