blob: 34f67620eb2479e6bb041dc397de072430d5d03b [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
3;
4; The purpose of this test is to check that debug info doesn't influence
5; inlining decisions.
6
Chandler Carruth6b4cc8b2014-02-01 10:38:17 +00007target 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"
8target triple = "x86_64-unknown-linux-gnu"
9
Adrian Prantl87b7eb92014-10-01 18:55:02 +000010declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
11declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1
Chandler Carruth6b4cc8b2014-02-01 10:38:17 +000012
13define <4 x float> @inner_vectors(<4 x float> %a, <4 x float> %b) {
14entry:
Duncan P. N. Exon Smith166121a2015-03-15 01:21:30 +000015 call void @llvm.dbg.value(metadata i32 undef, i64 0, metadata !MDLocalVariable(tag: DW_TAG_auto_variable), metadata !MDExpression())
Chandler Carruth6b4cc8b2014-02-01 10:38:17 +000016 %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 Smith166121a2015-03-15 01:21:30 +000017 call void @llvm.dbg.value(metadata i32 undef, i64 0, metadata !MDLocalVariable(tag: DW_TAG_auto_variable), metadata !MDExpression())
Chandler Carruth6b4cc8b2014-02-01 10:38:17 +000018 %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 Smith166121a2015-03-15 01:21:30 +000019 call void @llvm.dbg.value(metadata i32 undef, i64 0, metadata !MDLocalVariable(tag: DW_TAG_auto_variable), metadata !MDExpression())
Chandler Carruth6b4cc8b2014-02-01 10:38:17 +000020 %add = fadd <4 x float> %mul, %mul1
21 ret <4 x float> %add
22}
23
24define float @outer_vectors(<4 x float> %a, <4 x float> %b) {
25; CHECK-LABEL: @outer_vectors(
26; CHECK-NOT: call <4 x float> @inner_vectors(
27; CHECK: ret float
28
29entry:
Duncan P. N. Exon Smith166121a2015-03-15 01:21:30 +000030 call void @llvm.dbg.value(metadata i32 undef, i64 0, metadata !MDLocalVariable(tag: DW_TAG_auto_variable), metadata !MDExpression())
31 call void @llvm.dbg.value(metadata i32 undef, i64 0, metadata !MDLocalVariable(tag: DW_TAG_auto_variable), metadata !MDExpression())
Chandler Carruth6b4cc8b2014-02-01 10:38:17 +000032 %call = call <4 x float> @inner_vectors(<4 x float> %a, <4 x float> %b)
Duncan P. N. Exon Smith166121a2015-03-15 01:21:30 +000033 call void @llvm.dbg.value(metadata i32 undef, i64 0, metadata !MDLocalVariable(tag: DW_TAG_auto_variable), metadata !MDExpression())
Chandler Carruth6b4cc8b2014-02-01 10:38:17 +000034 %vecext = extractelement <4 x float> %call, i32 0
35 %vecext1 = extractelement <4 x float> %call, i32 1
36 %add = fadd float %vecext, %vecext1
37 %vecext2 = extractelement <4 x float> %call, i32 2
38 %add3 = fadd float %add, %vecext2
39 %vecext4 = extractelement <4 x float> %call, i32 3
40 %add5 = fadd float %add3, %vecext4
41 ret float %add5
42}
43
44attributes #0 = { nounwind readnone }
45
46!llvm.dbg.cu = !{!0}
47!llvm.module.flags = !{!3, !4}
48!llvm.ident = !{!5}
49
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000050!0 = !MDCompileUnit(language: DW_LANG_C_plus_plus, isOptimized: false, emissionKind: 0, file: !1, enums: !2, retainedTypes: !2, subprograms: !{}, globals: !2, imports: !2)
Duncan P. N. Exon Smithb7865722015-03-16 21:10:12 +000051!1 = !MDFile(filename: "test.c", directory: "")
52!2 = !{}
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000053!3 = !{i32 2, !"Dwarf Version", i32 4}
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000054!4 = !{i32 1, !"Debug Info Version", i32 3}
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000055!5 = !{!""}