xref: /llvm-project/llvm/test/Analysis/CostModel/X86/free-intrinsics.ll (revision 66d4fe97d8d46195672117797b663c21cf576f33)
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 -mtriple=x86_64-- -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 -mtriple=x86_64-- -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
8define i32 @trivially_free() {
9; CHECK-SIZE-LABEL: 'trivially_free'
10; 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)
11; CHECK-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.assume(i1 undef)
12; CHECK-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.experimental.noalias.scope.decl(metadata !3)
13; CHECK-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.sideeffect()
14; 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
15; 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
16; CHECK-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.dbg.label(metadata !10), !dbg !9
17; CHECK-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %a1 = call ptr @llvm.invariant.start.p0(i64 1, ptr undef)
18; 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)
19; CHECK-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %a2 = call ptr @llvm.launder.invariant.group.p0(ptr undef)
20; CHECK-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %a3 = call ptr @llvm.strip.invariant.group.p0(ptr undef)
21; CHECK-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %a4 = call i1 @llvm.is.constant.i32(i32 undef)
22; CHECK-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.lifetime.start.p0(i64 1, ptr undef)
23; CHECK-SIZE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.lifetime.end.p0(i64 1, ptr undef)
24; 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)
25; 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)
26; 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)
27; CHECK-SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 undef
28;
29; CHECK-THROUGHPUT-LABEL: 'trivially_free'
30; 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)
31; CHECK-THROUGHPUT-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.assume(i1 undef)
32; CHECK-THROUGHPUT-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.experimental.noalias.scope.decl(metadata !3)
33; CHECK-THROUGHPUT-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.sideeffect()
34; 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
35; 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
36; CHECK-THROUGHPUT-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.dbg.label(metadata !10), !dbg !9
37; CHECK-THROUGHPUT-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %a1 = call ptr @llvm.invariant.start.p0(i64 1, ptr undef)
38; 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)
39; CHECK-THROUGHPUT-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %a2 = call ptr @llvm.launder.invariant.group.p0(ptr undef)
40; CHECK-THROUGHPUT-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %a3 = call ptr @llvm.strip.invariant.group.p0(ptr undef)
41; CHECK-THROUGHPUT-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %a4 = call i1 @llvm.is.constant.i32(i32 undef)
42; CHECK-THROUGHPUT-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.lifetime.start.p0(i64 1, ptr undef)
43; CHECK-THROUGHPUT-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: call void @llvm.lifetime.end.p0(i64 1, ptr undef)
44; 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)
45; 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)
46; 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)
47; CHECK-THROUGHPUT-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
48;
49  %a0 = call i32 @llvm.annotation.i32(i32 undef, ptr undef, ptr undef, i32 undef)
50  call void @llvm.assume(i1 undef)
51  call void @llvm.experimental.noalias.scope.decl(metadata !4)
52  call void @llvm.sideeffect()
53  call void @llvm.dbg.assign(metadata ptr undef, metadata !0, metadata !DIExpression(), metadata !10, metadata ptr undef, metadata !DIExpression()), !dbg !8
54  call void @llvm.dbg.declare(metadata ptr undef, metadata !0, metadata !DIExpression()), !dbg !8
55  call void @llvm.dbg.value(metadata i64 undef, i64 undef, metadata !DIExpression(), metadata !DIExpression()), !dbg !8
56  call void @llvm.dbg.label(metadata !2), !dbg !8
57  %a1 = call ptr @llvm.invariant.start.p0(i64 1, ptr undef)
58  call void @llvm.invariant.end.p0(ptr undef, i64 1, ptr undef)
59  %a2 = call ptr @llvm.launder.invariant.group.p0(ptr undef)
60  %a3 = call ptr @llvm.strip.invariant.group.p0(ptr undef)
61  %a4 = call i1 @llvm.is.constant.i32(i32 undef)
62  call void @llvm.lifetime.start.p0(i64 1, ptr undef)
63  call void @llvm.lifetime.end.p0(i64 1, ptr undef)
64  %a5 = call i64 @llvm.objectsize.i64.p0(ptr undef, i1 1, i1 1, i1 1)
65  %a6 = call ptr @llvm.ptr.annotation.p0(ptr undef, ptr undef, ptr undef, i32 undef, ptr undef)
66  call void @llvm.var.annotation(ptr undef, ptr undef, ptr undef, i32 undef, ptr undef)
67  ret i32 undef
68}
69
70declare i32 @llvm.annotation.i32(i32, ptr, ptr, i32)
71declare void @llvm.assume(i1)
72declare void @llvm.experimental.noalias.scope.decl(metadata)
73declare void @llvm.sideeffect()
74declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata)
75declare void @llvm.dbg.declare(metadata, metadata, metadata)
76declare void @llvm.dbg.value(metadata, i64, metadata, metadata)
77declare void @llvm.dbg.label(metadata)
78declare ptr @llvm.invariant.start.p0(i64, ptr)
79declare void @llvm.invariant.end.p0(ptr, i64, ptr)
80declare ptr @llvm.launder.invariant.group.p0(ptr)
81declare ptr @llvm.strip.invariant.group.p0(ptr)
82declare i1 @llvm.is.constant.i32(i32)
83declare void @llvm.lifetime.start.p0(i64, ptr)
84declare void @llvm.lifetime.end.p0(i64, ptr)
85declare i64 @llvm.objectsize.i64.p0(ptr, i1, i1, i1)
86declare ptr @llvm.ptr.annotation.p0(ptr, ptr, ptr, i32, ptr)
87declare void @llvm.var.annotation(ptr, ptr, ptr, i32, ptr)
88
89!llvm.dbg.cu = !{!9}
90!llvm.module.flags = !{!7}
91
92!0 = !DILocalVariable(scope: !1)
93!1 = distinct !DISubprogram(name: "dummy", line: 79, isLocal: true, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, file: !3, unit: !9)
94!2 = !DILabel(scope: !1, name: "label", file: !3, line: 7)
95!3 = !DIFile(filename: "debug-label.c", directory: "./")
96!4 = !{ !5 }
97!5 = distinct !{ !5, !6, !"foo: var" }
98!6 = distinct !{ !6, !"foo" }
99!7 = !{i32 2, !"Debug Info Version", i32 3}
100!8 = !DILocation(line: 0, scope: !1)
101!9 = distinct !DICompileUnit(language: DW_LANG_C11, file: !3, producer: "clang")
102!10 = distinct !DIAssignID()
103