1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py 2; RUN: opt -analyze -cost-model -cost-kind=code-size %s -S -o - | FileCheck %s --check-prefix=CHECK-SIZE 3; RUN: opt -analyze -cost-model -cost-kind=throughput %s -S -o - | FileCheck %s --check-prefix=CHECK-THROUGHPUT 4 5define i32 @trivially_free() { 6; CHECK-SIZE-LABEL: 'trivially_free' 7; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a0 = call i32 @llvm.annotation.i32(i32 undef, i8* undef, i8* undef, i32 undef) 8; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.assume(i1 undef) 9; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.sideeffect() 10; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a1 = call {}* @llvm.invariant.start.p0i8(i64 1, i8* undef) 11; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.invariant.end.p0i8({}* undef, i64 1, i8* undef) 12; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a2 = call i8* @llvm.launder.invariant.group.p0i8(i8* undef) 13; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a3 = call i8* @llvm.strip.invariant.group.p0i8(i8* undef) 14; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a4 = call i1 @llvm.is.constant.i32(i32 undef) 15; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.lifetime.start.p0i8(i64 1, i8* undef) 16; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.lifetime.end.p0i8(i64 1, i8* undef) 17; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a5 = call i64 @llvm.objectsize.i64.p0i8(i8* undef, i1 true, i1 true, i1 true) 18; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a6 = call i8* @llvm.ptr.annotation.p0i8(i8* undef, i8* undef, i8* undef, i32 undef, i8* undef) 19; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.var.annotation(i8* undef, i8* undef, i8* undef, i32 undef, i8* undef) 20; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef 21; 22; CHECK-THROUGHPUT-LABEL: 'trivially_free' 23; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a0 = call i32 @llvm.annotation.i32(i32 undef, i8* undef, i8* undef, i32 undef) 24; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.assume(i1 undef) 25; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.sideeffect() 26; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a1 = call {}* @llvm.invariant.start.p0i8(i64 1, i8* undef) 27; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.invariant.end.p0i8({}* undef, i64 1, i8* undef) 28; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a2 = call i8* @llvm.launder.invariant.group.p0i8(i8* undef) 29; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a3 = call i8* @llvm.strip.invariant.group.p0i8(i8* undef) 30; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a4 = call i1 @llvm.is.constant.i32(i32 undef) 31; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.lifetime.start.p0i8(i64 1, i8* undef) 32; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.lifetime.end.p0i8(i64 1, i8* undef) 33; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a5 = call i64 @llvm.objectsize.i64.p0i8(i8* undef, i1 true, i1 true, i1 true) 34; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %a6 = call i8* @llvm.ptr.annotation.p0i8(i8* undef, i8* undef, i8* undef, i32 undef, i8* undef) 35; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.var.annotation(i8* undef, i8* undef, i8* undef, i32 undef, i8* undef) 36; CHECK-THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef 37; 38 %a0 = call i32 @llvm.annotation.i32(i32 undef, i8* undef, i8* undef, i32 undef) 39 call void @llvm.assume(i1 undef) 40 call void @llvm.sideeffect() 41 call void @llvm.dbg.declare(metadata i8** undef, metadata !0, metadata !DIExpression()) 42 call void @llvm.dbg.value(metadata i64 undef, i64 undef, metadata !DIExpression(), metadata !DIExpression()) 43 call void @llvm.dbg.label(metadata !2) 44 %a1 = call {}* @llvm.invariant.start.p0i8(i64 1, i8* undef) 45 call void @llvm.invariant.end.p0i8({}* undef, i64 1, i8* undef) 46 %a2 = call i8* @llvm.launder.invariant.group.p0i8(i8* undef) 47 %a3 = call i8* @llvm.strip.invariant.group.p0i8(i8* undef) 48 %a4 = call i1 @llvm.is.constant.i32(i32 undef) 49 call void @llvm.lifetime.start.p0i8(i64 1, i8* undef) 50 call void @llvm.lifetime.end.p0i8(i64 1, i8* undef) 51 %a5 = call i64 @llvm.objectsize.i64.p0i8(i8* undef, i1 1, i1 1, i1 1) 52 %a6 = call i8* @llvm.ptr.annotation.p0i8(i8* undef, i8* undef, i8* undef, i32 undef, i8* undef) 53 call void @llvm.var.annotation(i8* undef, i8* undef, i8* undef, i32 undef, i8* undef) 54 ret i32 undef 55} 56 57declare i32 @llvm.annotation.i32(i32, i8*, i8*, i32) 58declare void @llvm.assume(i1) 59declare void @llvm.sideeffect() 60declare void @llvm.dbg.declare(metadata, metadata, metadata) 61declare void @llvm.dbg.value(metadata, i64, metadata, metadata) 62declare void @llvm.dbg.label(metadata) 63declare {}* @llvm.invariant.start.p0i8(i64, i8*) 64declare void @llvm.invariant.end.p0i8({}*, i64, i8*) 65declare i8* @llvm.launder.invariant.group.p0i8(i8*) 66declare i8* @llvm.strip.invariant.group.p0i8(i8*) 67declare i1 @llvm.is.constant.i32(i32) 68declare void @llvm.lifetime.start.p0i8(i64, i8*) 69declare void @llvm.lifetime.end.p0i8(i64, i8*) 70declare i64 @llvm.objectsize.i64.p0i8(i8*, i1, i1, i1) 71declare i8* @llvm.ptr.annotation.p0i8(i8*, i8*, i8*, i32, i8*) 72declare void @llvm.var.annotation(i8*, i8*, i8*, i32, i8*) 73 74 75!0 = !DILocalVariable(scope: !1) 76!1 = distinct !DISubprogram(name: "dummy", line: 79, isLocal: true, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true) 77!2 = !DILabel(scope: !1, name: "label", file: !3, line: 7) 78!3 = !DIFile(filename: "debug-label.c", directory: "./") 79