• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -deadargelim -S | FileCheck %s
2
3define i32 @bar(i32 %A) {
4  call void (i32, ...) @thunk(i32 %A, i64 47, double 1.000000e+00)
5  %a = call i32 (i32, ...) @has_vastart(i32 %A, i64 47, double 1.000000e+00)
6  %b = call i32 (i32, ...) @no_vastart( i32 %A, i32 %A, i32 %A, i32 %A, i64 47, double 1.000000e+00 )
7  %c = add i32 %a, %b
8  ret i32 %c
9}
10; CHECK-LABEL: define i32 @bar
11; CHECK: call void (i32, ...) @thunk(i32 %A, i64 47, double 1.000000e+00)
12; CHECK: call i32 (i32, ...) @has_vastart(i32 %A, i64 47, double 1.000000e+00)
13; CHECK: call i32 @no_vastart(i32 %A)
14
15declare void @thunk_target(i32 %X, ...)
16
17define internal void @thunk(i32 %X, ...) {
18  musttail call void(i32, ...) @thunk_target(i32 %X, ...)
19  ret void
20}
21; CHECK-LABEL: define internal void @thunk(i32 %X, ...)
22; CHECK: musttail call void (i32, ...) @thunk_target(i32 %X, ...)
23
24define internal i32 @has_vastart(i32 %X, ...) {
25  %valist = alloca i8
26  call void @llvm.va_start(i8* %valist)
27  ret i32 %X
28}
29; CHECK-LABEL: define internal i32 @has_vastart(i32 %X, ...)
30
31declare void @llvm.va_start(i8*)
32
33define internal i32 @no_vastart(i32 %X, ...) {
34  ret i32 %X
35}
36; CHECK-LABEL: define internal i32 @no_vastart(i32 %X)
37