xref: /llvm-project/llvm/test/Transforms/InstCombine/call-cast-target-preallocated.ll (revision 32a4566fbb43f7195fd51fbe453b980897cec3fc)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
2; RUN: opt < %s -passes=instcombine -S | FileCheck %s
3
4target datalayout = "e-p:32:32"
5target triple = "i686-pc-win32"
6
7
8declare token @llvm.call.preallocated.setup(i32)
9declare ptr @llvm.call.preallocated.arg(token, i32)
10
11declare void @takes_i32(i32)
12declare void @takes_i32_preallocated(ptr preallocated(i32))
13
14define void @f() {
15; CHECK-LABEL: define void @f() {
16; CHECK-NEXT:    [[T:%.*]] = call token @llvm.call.preallocated.setup(i32 1)
17; CHECK-NEXT:    [[A:%.*]] = call ptr @llvm.call.preallocated.arg(token [[T]], i32 0) #[[ATTR1:[0-9]+]]
18; CHECK-NEXT:    call void @takes_i32(ptr preallocated(i32) [[A]]) [ "preallocated"(token [[T]]) ]
19; CHECK-NEXT:    ret void
20;
21  %t = call token @llvm.call.preallocated.setup(i32 1)
22  %a = call ptr @llvm.call.preallocated.arg(token %t, i32 0) preallocated(i32)
23  call void @takes_i32(ptr preallocated(i32) %a) ["preallocated"(token %t)]
24  ret void
25}
26
27define void @g() {
28; CHECK-LABEL: define void @g() {
29; CHECK-NEXT:    call void @takes_i32_preallocated(i32 0)
30; CHECK-NEXT:    ret void
31;
32  call void @takes_i32_preallocated(i32 0)
33  ret void
34}
35