1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py 2;; Pin this test to not use "RemoveDIs" non-intrinsic debug-info. We get the 3;; correct output in that mode, but it generates spurious test changes, so 4;; avoid that for the moment. 5; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size %s -S -o - --experimental-debuginfo-iterators=false | FileCheck %s --check-prefix=CHECK-SIZE 6; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=throughput %s -S -o - --experimental-debuginfo-iterators=false | FileCheck %s --check-prefix=CHECK-THROUGHPUT 7 8target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" 9 10define i32 @trivially_free() { 11; CHECK-SIZE-LABEL: 'trivially_free' 12; 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) 13; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.assume(i1 undef) 14; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.experimental.noalias.scope.decl(metadata !3) 15; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.sideeffect() 16; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.dbg.assign(metadata ptr undef, metadata !6, metadata !DIExpression(), metadata !8, metadata ptr undef, metadata !DIExpression()), !dbg !9 17; 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 !9 18; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.dbg.label(metadata !10), !dbg !9 19; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a1 = call ptr @llvm.invariant.start.p0(i64 1, ptr undef) 20; 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) 21; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a2 = call ptr @llvm.launder.invariant.group.p0(ptr undef) 22; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a3 = call ptr @llvm.strip.invariant.group.p0(ptr undef) 23; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a4 = call i1 @llvm.is.constant.i32(i32 undef) 24; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.lifetime.start.p0(i64 1, ptr undef) 25; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.lifetime.end.p0(i64 1, ptr undef) 26; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a5 = call i64 @llvm.objectsize.i64.p0(ptr undef, i1 true, i1 true, i1 true) 27; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a6 = call ptr @llvm.ptr.annotation.p0.p0(ptr undef, ptr undef, ptr undef, i32 undef, ptr undef) 28; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a7 = call i1 @llvm.allow.ubsan.check(i8 123) 29; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a8 = call i1 @llvm.allow.runtime.check(metadata !"test_check") 30; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.var.annotation.p0.p0(ptr undef, ptr undef, ptr undef, i32 undef, ptr undef) 31; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef 32; 33; CHECK-THROUGHPUT-LABEL: 'trivially_free' 34; 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) 35; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.assume(i1 undef) 36; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.experimental.noalias.scope.decl(metadata !3) 37; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.sideeffect() 38; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.dbg.assign(metadata ptr undef, metadata !6, metadata !DIExpression(), metadata !8, metadata ptr undef, metadata !DIExpression()), !dbg !9 39; 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 !9 40; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.dbg.label(metadata !10), !dbg !9 41; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a1 = call ptr @llvm.invariant.start.p0(i64 1, ptr undef) 42; 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) 43; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a2 = call ptr @llvm.launder.invariant.group.p0(ptr undef) 44; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a3 = call ptr @llvm.strip.invariant.group.p0(ptr undef) 45; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a4 = call i1 @llvm.is.constant.i32(i32 undef) 46; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.lifetime.start.p0(i64 1, ptr undef) 47; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.lifetime.end.p0(i64 1, ptr undef) 48; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a5 = call i64 @llvm.objectsize.i64.p0(ptr undef, i1 true, i1 true, i1 true) 49; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a6 = call ptr @llvm.ptr.annotation.p0.p0(ptr undef, ptr undef, ptr undef, i32 undef, ptr undef) 50; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a7 = call i1 @llvm.allow.ubsan.check(i8 123) 51; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a8 = call i1 @llvm.allow.runtime.check(metadata !"test_check") 52; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.var.annotation.p0.p0(ptr undef, ptr undef, ptr undef, i32 undef, ptr undef) 53; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef 54; 55 %a0 = call i32 @llvm.annotation.i32(i32 undef, ptr undef, ptr undef, i32 undef) 56 call void @llvm.assume(i1 undef) 57 call void @llvm.experimental.noalias.scope.decl(metadata !4) 58 call void @llvm.sideeffect() 59 call void @llvm.dbg.assign(metadata ptr undef, metadata !0, metadata !DIExpression(), metadata !10, metadata ptr undef, metadata !DIExpression()), !dbg !8 60 call void @llvm.dbg.declare(metadata ptr undef, metadata !0, metadata !DIExpression()), !dbg !8 61 call void @llvm.dbg.value(metadata i64 undef, i64 undef, metadata !DIExpression(), metadata !DIExpression()), !dbg !8 62 call void @llvm.dbg.label(metadata !2), !dbg !8 63 %a1 = call ptr @llvm.invariant.start.p0(i64 1, ptr undef) 64 call void @llvm.invariant.end.p0(ptr undef, i64 1, ptr undef) 65 %a2 = call ptr @llvm.launder.invariant.group.p0(ptr undef) 66 %a3 = call ptr @llvm.strip.invariant.group.p0(ptr undef) 67 %a4 = call i1 @llvm.is.constant.i32(i32 undef) 68 call void @llvm.lifetime.start.p0(i64 1, ptr undef) 69 call void @llvm.lifetime.end.p0(i64 1, ptr undef) 70 %a5 = call i64 @llvm.objectsize.i64.p0(ptr undef, i1 1, i1 1, i1 1) 71 %a6 = call ptr @llvm.ptr.annotation.p0(ptr undef, ptr undef, ptr undef, i32 undef, ptr undef) 72 %a7 = call i1 @llvm.allow.ubsan.check(i8 123) 73 %a8 = call i1 @llvm.allow.runtime.check(metadata !"test_check") 74 call void @llvm.var.annotation(ptr undef, ptr undef, ptr undef, i32 undef, ptr undef) 75 ret i32 undef 76} 77 78declare i32 @llvm.annotation.i32(i32, ptr, ptr, i32) 79declare void @llvm.assume(i1) 80declare void @llvm.experimental.noalias.scope.decl(metadata) 81declare void @llvm.sideeffect() 82declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata) 83declare void @llvm.dbg.declare(metadata, metadata, metadata) 84declare void @llvm.dbg.value(metadata, i64, metadata, metadata) 85declare void @llvm.dbg.label(metadata) 86declare ptr @llvm.invariant.start.p0(i64, ptr) 87declare void @llvm.invariant.end.p0(ptr, i64, ptr) 88declare ptr @llvm.launder.invariant.group.p0(ptr) 89declare ptr @llvm.strip.invariant.group.p0(ptr) 90declare i1 @llvm.is.constant.i32(i32) 91declare void @llvm.lifetime.start.p0(i64, ptr) 92declare void @llvm.lifetime.end.p0(i64, ptr) 93declare i64 @llvm.objectsize.i64.p0(ptr, i1, i1, i1) 94declare ptr @llvm.ptr.annotation.p0(ptr, ptr, ptr, i32, ptr) 95declare void @llvm.var.annotation(ptr, ptr, ptr, i32, ptr) 96 97!llvm.dbg.cu = !{!9} 98!llvm.module.flags = !{!7} 99 100!0 = !DILocalVariable(scope: !1) 101!1 = distinct !DISubprogram(name: "dummy", line: 79, isLocal: true, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, file: !3, unit: !9) 102!2 = !DILabel(scope: !1, name: "label", file: !3, line: 7) 103!3 = !DIFile(filename: "debug-label.c", directory: "./") 104!4 = !{ !5 } 105!5 = distinct !{ !5, !6, !"foo: var" } 106!6 = distinct !{ !6, !"foo" } 107!7 = !{i32 2, !"Debug Info Version", i32 3} 108!8 = !DILocation(line: 0, scope: !1) 109!9 = distinct !DICompileUnit(language: DW_LANG_C11, file: !3, producer: "clang") 110!10 = distinct !DIAssignID() 111