1 ; RUN: opt -instcombine -S < %s | FileCheck %s
2 ; RUN: opt -debugify-each -instcombine -S < %s | FileCheck %s
4 ; These are both direct calls, but make sure instcombine leaves the casts
7 define i32 @call_thunk(i32 %x, i32 %y) {
8 %r = call i32 bitcast (void (i32, ...)* @inc_first_arg_thunk to i32 (i32, i32)*)(i32 %x, i32 %y)
12 ; CHECK-LABEL: define i32 @call_thunk(i32 %x, i32 %y)
13 ; CHECK: %r = call i32 bitcast (void (i32, ...)* @inc_first_arg_thunk to i32 (i32, i32)*)(i32 %x, i32 %y)
16 define internal void @inc_first_arg_thunk(i32 %arg1, ...) #0 {
18 %inc = add i32 %arg1, 1
19 musttail call void (i32, ...) bitcast (i32 (i32, i32)* @plus to void (i32, ...)*)(i32 %inc, ...)
23 ; CHECK-LABEL: define internal void @inc_first_arg_thunk(i32 %arg1, ...) #0
24 ; CHECK: %inc = add i32 %arg1, 1
25 ; CHECK: musttail call void (i32, ...) bitcast (i32 (i32, i32)* @plus to void (i32, ...)*)(i32 %inc, ...)
28 define internal i32 @plus(i32 %x, i32 %y) {
33 attributes #0 = { "thunk" }