| Chandler Carruth | 6b4cc8b | 2014-02-01 10:38:17 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -S -inline -inline-threshold=2 | FileCheck %s | 
|  | 2 | ; RUN: opt < %s -S -strip-debug -inline -inline-threshold=2 | FileCheck %s | 
| Chandler Carruth | 625038d | 2016-12-27 07:18:43 +0000 | [diff] [blame] | 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 | 
| Chandler Carruth | 6b4cc8b | 2014-02-01 10:38:17 +0000 | [diff] [blame] | 5 | ; | 
|  | 6 | ; The purpose of this test is to check that debug info doesn't influence | 
|  | 7 | ; inlining decisions. | 
|  | 8 |  | 
| Chandler Carruth | 6b4cc8b | 2014-02-01 10:38:17 +0000 | [diff] [blame] | 9 | target 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" | 
|  | 10 | target triple = "x86_64-unknown-linux-gnu" | 
|  | 11 |  | 
| Adrian Prantl | 87b7eb9 | 2014-10-01 18:55:02 +0000 | [diff] [blame] | 12 | declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 | 
| Adrian Prantl | abe0475 | 2017-07-28 20:21:02 +0000 | [diff] [blame] | 13 | declare void @llvm.dbg.value(metadata, metadata, metadata) #1 | 
| Chandler Carruth | 6b4cc8b | 2014-02-01 10:38:17 +0000 | [diff] [blame] | 14 |  | 
|  | 15 | define <4 x float> @inner_vectors(<4 x float> %a, <4 x float> %b) { | 
|  | 16 | entry: | 
| Adrian Prantl | abe0475 | 2017-07-28 20:21:02 +0000 | [diff] [blame] | 17 | call void @llvm.dbg.value(metadata i32 undef, metadata !DILocalVariable(scope: !6), metadata !DIExpression()), !dbg !DILocation(scope: !6) | 
| Chandler Carruth | 6b4cc8b | 2014-02-01 10:38:17 +0000 | [diff] [blame] | 18 | %mul = fmul <4 x float> %a, <float 3.000000e+00, float 3.000000e+00, float 3.000000e+00, float 3.000000e+00> | 
| Adrian Prantl | abe0475 | 2017-07-28 20:21:02 +0000 | [diff] [blame] | 19 | call void @llvm.dbg.value(metadata i32 undef, metadata !DILocalVariable(scope: !6), metadata !DIExpression()), !dbg !DILocation(scope: !6) | 
| Chandler Carruth | 6b4cc8b | 2014-02-01 10:38:17 +0000 | [diff] [blame] | 20 | %mul1 = fmul <4 x float> %b, <float 5.000000e+00, float 5.000000e+00, float 5.000000e+00, float 5.000000e+00> | 
| Adrian Prantl | abe0475 | 2017-07-28 20:21:02 +0000 | [diff] [blame] | 21 | call void @llvm.dbg.value(metadata i32 undef, metadata !DILocalVariable(scope: !6), metadata !DIExpression()), !dbg !DILocation(scope: !6) | 
| Chandler Carruth | 6b4cc8b | 2014-02-01 10:38:17 +0000 | [diff] [blame] | 22 | %add = fadd <4 x float> %mul, %mul1 | 
|  | 23 | ret <4 x float> %add | 
|  | 24 | } | 
|  | 25 |  | 
|  | 26 | define 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 |  | 
|  | 31 | entry: | 
| Adrian Prantl | abe0475 | 2017-07-28 20:21:02 +0000 | [diff] [blame] | 32 | call void @llvm.dbg.value(metadata i32 undef, metadata !DILocalVariable(scope: !6), metadata !DIExpression()), !dbg !DILocation(scope: !6) | 
|  | 33 | call void @llvm.dbg.value(metadata i32 undef, metadata !DILocalVariable(scope: !6), metadata !DIExpression()), !dbg !DILocation(scope: !6) | 
| Chandler Carruth | 6b4cc8b | 2014-02-01 10:38:17 +0000 | [diff] [blame] | 34 | %call = call <4 x float> @inner_vectors(<4 x float> %a, <4 x float> %b) | 
| Adrian Prantl | abe0475 | 2017-07-28 20:21:02 +0000 | [diff] [blame] | 35 | call void @llvm.dbg.value(metadata i32 undef, metadata !DILocalVariable(scope: !6), metadata !DIExpression()), !dbg !DILocation(scope: !6) | 
| Chandler Carruth | 6b4cc8b | 2014-02-01 10:38:17 +0000 | [diff] [blame] | 36 | %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 |  | 
|  | 46 | attributes #0 = { nounwind readnone } | 
|  | 47 |  | 
|  | 48 | !llvm.dbg.cu = !{!0} | 
|  | 49 | !llvm.module.flags = !{!3, !4} | 
|  | 50 | !llvm.ident = !{!5} | 
|  | 51 |  | 
| Adrian Prantl | 75819ae | 2016-04-15 15:57:41 +0000 | [diff] [blame] | 52 | !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 Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 53 | !1 = !DIFile(filename: "test.c", directory: "") | 
| Duncan P. N. Exon Smith | b786572 | 2015-03-16 21:10:12 +0000 | [diff] [blame] | 54 | !2 = !{} | 
| Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 55 | !3 = !{i32 2, !"Dwarf Version", i32 4} | 
| Duncan P. N. Exon Smith | e274180 | 2015-03-03 17:24:31 +0000 | [diff] [blame] | 56 | !4 = !{i32 1, !"Debug Info Version", i32 3} | 
| Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 57 | !5 = !{!""} | 
| Adrian Prantl | 75819ae | 2016-04-15 15:57:41 +0000 | [diff] [blame] | 58 | !6 = distinct !DISubprogram(unit: !0) |