blob: 9827ab1e305d8b7218f9eaa4a18a5c367fead76b [file] [log] [blame]
Chandler Carruth6b4cc8b2014-02-01 10:38:17 +00001; RUN: opt < %s -S -inline -inline-threshold=2 | FileCheck %s
2; RUN: opt < %s -S -strip-debug -inline -inline-threshold=2 | FileCheck %s
Chandler Carruth625038d2016-12-27 07:18:43 +00003; 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
Chandler Carruth6b4cc8b2014-02-01 10:38:17 +00005;
6; The purpose of this test is to check that debug info doesn't influence
7; inlining decisions.
8
Chandler Carruth6b4cc8b2014-02-01 10:38:17 +00009target 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"
10target triple = "x86_64-unknown-linux-gnu"
11
Adrian Prantl87b7eb92014-10-01 18:55:02 +000012declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
13declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1
Chandler Carruth6b4cc8b2014-02-01 10:38:17 +000014
15define <4 x float> @inner_vectors(<4 x float> %a, <4 x float> %b) {
16entry:
Duncan P. N. Exon Smithed013cd2015-07-31 18:58:39 +000017 call void @llvm.dbg.value(metadata i32 undef, i64 0, metadata !DILocalVariable(scope: !6), metadata !DIExpression()), !dbg !DILocation(scope: !6)
Chandler Carruth6b4cc8b2014-02-01 10:38:17 +000018 %mul = fmul <4 x float> %a, <float 3.000000e+00, float 3.000000e+00, float 3.000000e+00, float 3.000000e+00>
Duncan P. N. Exon Smithed013cd2015-07-31 18:58:39 +000019 call void @llvm.dbg.value(metadata i32 undef, i64 0, metadata !DILocalVariable(scope: !6), metadata !DIExpression()), !dbg !DILocation(scope: !6)
Chandler Carruth6b4cc8b2014-02-01 10:38:17 +000020 %mul1 = fmul <4 x float> %b, <float 5.000000e+00, float 5.000000e+00, float 5.000000e+00, float 5.000000e+00>
Duncan P. N. Exon Smithed013cd2015-07-31 18:58:39 +000021 call void @llvm.dbg.value(metadata i32 undef, i64 0, metadata !DILocalVariable(scope: !6), metadata !DIExpression()), !dbg !DILocation(scope: !6)
Chandler Carruth6b4cc8b2014-02-01 10:38:17 +000022 %add = fadd <4 x float> %mul, %mul1
23 ret <4 x float> %add
24}
25
26define float @outer_vectors(<4 x float> %a, <4 x float> %b) {
27; CHECK-LABEL: @outer_vectors(
28; CHECK-NOT: call <4 x float> @inner_vectors(
29; CHECK: ret float
30
31entry:
Duncan P. N. Exon Smithed013cd2015-07-31 18:58:39 +000032 call void @llvm.dbg.value(metadata i32 undef, i64 0, metadata !DILocalVariable(scope: !6), metadata !DIExpression()), !dbg !DILocation(scope: !6)
33 call void @llvm.dbg.value(metadata i32 undef, i64 0, metadata !DILocalVariable(scope: !6), metadata !DIExpression()), !dbg !DILocation(scope: !6)
Chandler Carruth6b4cc8b2014-02-01 10:38:17 +000034 %call = call <4 x float> @inner_vectors(<4 x float> %a, <4 x float> %b)
Duncan P. N. Exon Smithed013cd2015-07-31 18:58:39 +000035 call void @llvm.dbg.value(metadata i32 undef, i64 0, metadata !DILocalVariable(scope: !6), metadata !DIExpression()), !dbg !DILocation(scope: !6)
Chandler Carruth6b4cc8b2014-02-01 10:38:17 +000036 %vecext = extractelement <4 x float> %call, i32 0
37 %vecext1 = extractelement <4 x float> %call, i32 1
38 %add = fadd float %vecext, %vecext1
39 %vecext2 = extractelement <4 x float> %call, i32 2
40 %add3 = fadd float %add, %vecext2
41 %vecext4 = extractelement <4 x float> %call, i32 3
42 %add5 = fadd float %add3, %vecext4
43 ret float %add5
44}
45
46attributes #0 = { nounwind readnone }
47
48!llvm.dbg.cu = !{!0}
49!llvm.module.flags = !{!3, !4}
50!llvm.ident = !{!5}
51
Adrian Prantl75819ae2016-04-15 15:57:41 +000052!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000053!1 = !DIFile(filename: "test.c", directory: "")
Duncan P. N. Exon Smithb7865722015-03-16 21:10:12 +000054!2 = !{}
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000055!3 = !{i32 2, !"Dwarf Version", i32 4}
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000056!4 = !{i32 1, !"Debug Info Version", i32 3}
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000057!5 = !{!""}
Adrian Prantl75819ae2016-04-15 15:57:41 +000058!6 = distinct !DISubprogram(unit: !0)