xref: /llvm-project/llvm/test/Transforms/InstCombine/call-cast-attrs.ll (revision 29441e4f5fa5f5c7709f7cf180815ba97f611297)
1; RUN: opt < %s -passes=instcombine -data-layout="p:32:32" -S | FileCheck %s --check-prefixes=CHECK,CHECK32
2; RUN: opt < %s -passes=instcombine -data-layout="p:64:64" -S | FileCheck %s --check-prefixes=CHECK,CHECK64
3
4define signext i32 @b(ptr inreg %x)   {
5  ret i32 0
6}
7
8define void @c(...) {
9  ret void
10}
11
12declare void @useit(i32)
13
14define void @d(i32 %x, ...) {
15  call void @useit(i32 %x)
16  ret void
17}
18
19define void @naked_func() naked {
20  tail call void asm sideeffect "mov  r1, r0", ""()
21  unreachable
22}
23
24define void @g(ptr %y) {
25  call i32 @b(i32 zeroext 0)
26  call void @c(ptr %y)
27  call void @c(ptr sret(i32) %y)
28  call void @d(i32 0, ptr sret(i32) %y)
29  call void @d(i32 0, ptr captures(none) %y)
30  call void @d(ptr noundef captures(none) %y)
31  call void @naked_func(i32 1)
32  ret void
33}
34; CHECK-LABEL: define void @g(ptr %y)
35; CHECK:    call i32 @b(i32 zeroext 0)
36; CHECK:    call void (...) @c(ptr %y)
37; CHECK:    call void @c(ptr sret(i32) %y)
38; CHECK:    call void @d(i32 0, ptr sret(i32) %y)
39; CHECK:    call void (i32, ...) @d(i32 0, ptr captures(none) %y)
40; CHECK32:  %2 = ptrtoint ptr %y to i32
41; CHECK32:  call void (i32, ...) @d(i32 noundef %2)
42; CHECK64:  call void @d(ptr noundef captures(none) %y)
43; CHECK:    call void @naked_func(i32 1)
44