xref: /llvm-project/llvm/test/Transforms/Inline/ignore-debug-info.ll (revision c672ba7dde3a6ec2f6c89fcb207c9a6a8474cedc)
1; RUN: opt < %s -S -passes=inline -inline-threshold=2 | FileCheck %s
2; RUN: opt < %s -S -strip-debug -passes=inline -inline-threshold=2 | FileCheck %s
3; RUN: opt < %s -S -passes='cgscc(inline)' -inline-threshold=2 | FileCheck %s
4; RUN: opt < %s -S -strip-debug -passes='cgscc(inline)' -inline-threshold=2 | FileCheck %s
5;
6; RUN: opt < %s -S -passes=inline -inline-threshold=2 --try-experimental-debuginfo-iterators | FileCheck %s
7; RUN: opt < %s -S -passes='cgscc(inline)' -inline-threshold=2 --try-experimental-debuginfo-iterators | FileCheck %s
8;
9; The purpose of this test is to check that debug info doesn't influence
10; inlining decisions.
11
12target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
13target triple = "x86_64-unknown-linux-gnu"
14
15declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
16declare void @llvm.dbg.value(metadata, metadata, metadata) #1
17
18define <4 x float> @inner_vectors(<4 x float> %a, <4 x float> %b) {
19entry:
20  call void @llvm.dbg.value(metadata i32 undef, metadata !DILocalVariable(scope: !6), metadata !DIExpression()), !dbg !DILocation(scope: !6)
21  %mul = fmul <4 x float> %a, <float 3.000000e+00, float 3.000000e+00, float 3.000000e+00, float 3.000000e+00>
22  call void @llvm.dbg.value(metadata i32 undef, metadata !DILocalVariable(scope: !6), metadata !DIExpression()), !dbg !DILocation(scope: !6)
23  %mul1 = fmul <4 x float> %b, <float 5.000000e+00, float 5.000000e+00, float 5.000000e+00, float 5.000000e+00>
24  call void @llvm.dbg.value(metadata i32 undef, metadata !DILocalVariable(scope: !6), metadata !DIExpression()), !dbg !DILocation(scope: !6)
25  %add = fadd <4 x float> %mul, %mul1
26  ret <4 x float> %add
27}
28
29define float @outer_vectors(<4 x float> %a, <4 x float> %b) {
30; CHECK-LABEL: @outer_vectors(
31; CHECK-NOT: call <4 x float> @inner_vectors(
32; CHECK: ret float
33
34entry:
35  call void @llvm.dbg.value(metadata i32 undef, metadata !DILocalVariable(scope: !6), metadata !DIExpression()), !dbg !DILocation(scope: !6)
36  call void @llvm.dbg.value(metadata i32 undef, metadata !DILocalVariable(scope: !6), metadata !DIExpression()), !dbg !DILocation(scope: !6)
37  %call = call <4 x float> @inner_vectors(<4 x float> %a, <4 x float> %b)
38  call void @llvm.dbg.value(metadata i32 undef, metadata !DILocalVariable(scope: !6), metadata !DIExpression()), !dbg !DILocation(scope: !6)
39  %vecext = extractelement <4 x float> %call, i32 0
40  %vecext1 = extractelement <4 x float> %call, i32 1
41  %add = fadd float %vecext, %vecext1
42  %vecext2 = extractelement <4 x float> %call, i32 2
43  %add3 = fadd float %add, %vecext2
44  %vecext4 = extractelement <4 x float> %call, i32 3
45  %add5 = fadd float %add3, %vecext4
46  ret float %add5
47}
48
49attributes #0 = { nounwind readnone }
50
51!llvm.dbg.cu = !{!0}
52!llvm.module.flags = !{!3, !4}
53!llvm.ident = !{!5}
54
55!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
56!1 = !DIFile(filename: "test.c", directory: "")
57!2 = !{}
58!3 = !{i32 2, !"Dwarf Version", i32 4}
59!4 = !{i32 1, !"Debug Info Version", i32 3}
60!5 = !{!""}
61!6 = distinct !DISubprogram(unit: !0)
62