blob: 61b7c1843e481c35c47d3dd47f9206d960809304 [file] [log] [blame]
David Blaikieb0cdf5302014-06-27 05:32:09 +00001; RUN: opt < %s -argpromotion -S | FileCheck %s
Chandler Carruthaddcda42017-02-09 23:46:27 +00002; RUN: opt < %s -passes=argpromotion -S | FileCheck %s
David Blaikief997c6f2014-07-23 21:30:59 +00003
4declare void @sink(i32)
David Blaikieba405c22014-06-30 20:26:12 +00005
Peter Collingbourned4bff302015-11-05 22:03:56 +00006; CHECK: define internal void @test({{.*}} !dbg [[SP:![0-9]+]]
7define internal void @test(i32** %X) !dbg !2 {
David Blaikiea79ac142015-02-27 21:17:42 +00008 %1 = load i32*, i32** %X, align 8
9 %2 = load i32, i32* %1, align 8
David Blaikie8e9cfa52014-07-23 22:09:29 +000010 call void @sink(i32 %2)
David Blaikieb0cdf5302014-06-27 05:32:09 +000011 ret void
12}
13
David Blaikie8e9cfa52014-07-23 22:09:29 +000014define void @caller(i32** %Y) {
Peter Collingbourned4bff302015-11-05 22:03:56 +000015; CHECK: call void @test(i32 %
David Blaikie8e9cfa52014-07-23 22:09:29 +000016 call void @test(i32** %Y)
David Blaikieb0cdf5302014-06-27 05:32:09 +000017 ret void
18}
19
Peter Collingbourned4bff302015-11-05 22:03:56 +000020; CHECK: [[SP]] = distinct !DISubprogram(name: "test",
21
David Blaikiee844cd52014-07-01 21:13:37 +000022!llvm.module.flags = !{!0}
23!llvm.dbg.cu = !{!3}
David Blaikieb0cdf5302014-06-27 05:32:09 +000024
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000025!0 = !{i32 2, !"Debug Info Version", i32 3}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000026!1 = !DILocation(line: 8, scope: !2)
Justin Bognerefc3fbf2017-02-17 23:57:42 +000027!2 = distinct !DISubprogram(name: "test", file: !5, line: 3, isLocal: true, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !3, scopeLine: 3, scope: null)
Adrian Prantl75819ae2016-04-15 15:57:41 +000028!3 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: LineTablesOnly, file: !5)
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000029!5 = !DIFile(filename: "test.c", directory: "")