blob: eb533048e8d2db61dba3efa588579ff6c6b6a959 [file] [log] [blame]
Stanislav Mekhanoshin9053f222017-03-28 18:23:24 +00001; RUN: opt -mtriple=amdgcn-- -O1 -S -inline-threshold=1 -amdgpu-early-inline-all %s | FileCheck %s
Konstantin Zhuravlyov2534bc02017-03-20 18:06:45 +00002
Stanislav Mekhanoshin89653df2017-03-30 20:16:02 +00003@c_alias = alias i32 (i32), i32 (i32)* @callee
4
Konstantin Zhuravlyov2534bc02017-03-20 18:06:45 +00005define i32 @callee(i32 %x) {
6entry:
7 %mul1 = mul i32 %x, %x
8 %mul2 = mul i32 %mul1, %x
9 %mul3 = mul i32 %mul1, %mul2
10 %mul4 = mul i32 %mul3, %mul2
11 %mul5 = mul i32 %mul4, %mul3
12 ret i32 %mul5
13}
14
15; CHECK-LABEL: @caller
16; CHECK: mul i32
17; CHECK-NOT: call i32
18
Matt Arsenault33339682017-04-04 18:43:11 +000019define amdgpu_kernel void @caller(i32 %x) {
Konstantin Zhuravlyov2534bc02017-03-20 18:06:45 +000020entry:
21 %res = call i32 @callee(i32 %x)
Matt Arsenault33339682017-04-04 18:43:11 +000022 store volatile i32 %res, i32 addrspace(1)* undef
23 ret void
Konstantin Zhuravlyov2534bc02017-03-20 18:06:45 +000024}
Matt Arsenaulta6801992018-07-10 14:03:41 +000025
26; CHECK-LABEL: @alias_caller(
27; CHECK-NOT: call
28define amdgpu_kernel void @alias_caller(i32 %x) {
29entry:
30 %res = call i32 @c_alias(i32 %x)
31 store volatile i32 %res, i32 addrspace(1)* undef
32 ret void
33}