• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -instcombine -S | FileCheck %s
2
3target datalayout = "e-p:32:32"
4target triple = "i686-pc-win32"
5
6
7declare token @llvm.call.preallocated.setup(i32)
8declare i8* @llvm.call.preallocated.arg(token, i32)
9
10declare void @takes_i32(i32)
11declare void @takes_i32_preallocated(i32* preallocated(i32))
12
13define void @f() {
14; CHECK-LABEL: define void @f()
15  %t = call token @llvm.call.preallocated.setup(i32 1)
16  %a = call i8* @llvm.call.preallocated.arg(token %t, i32 0) preallocated(i32)
17  %arg = bitcast i8* %a to i32*
18  call void bitcast (void (i32)* @takes_i32 to void (i32*)*)(i32* preallocated(i32) %arg) ["preallocated"(token %t)]
19; CHECK: call void bitcast{{.*}}@takes_i32
20  ret void
21}
22
23define void @g() {
24; CHECK-LABEL: define void @g()
25  call void bitcast (void (i32*)* @takes_i32_preallocated to void (i32)*)(i32 0)
26; CHECK: call void bitcast{{.*}}@takes_i32_preallocated
27  ret void
28}
29