• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Test parsing indirect calls in Subzero.
2
3; RUN: %p2i -i %s --insts | FileCheck %s
4; RUN: %p2i -i %s --args -notranslate -timing | FileCheck --check-prefix=NOIR %s
5
6define internal void @CallIndirectVoid(i32 %f_addr) {
7entry:
8  %f = inttoptr i32 %f_addr to void ()*
9  call void %f()
10  ret void
11}
12
13; CHECK:      define internal void @CallIndirectVoid(i32 %f_addr) {
14; CHECK-NEXT: entry:
15; CHECK-NEXT:   call void %f_addr()
16; CHECK-NEXT:   ret void
17; CHECK-NEXT: }
18
19define internal i32 @CallIndirectI32(i32 %f_addr) {
20entry:
21  %f = inttoptr i32 %f_addr to i32(i64, i32)*
22  %r = call i32 %f(i64 1, i32 %f_addr)
23  ret i32 %r
24}
25
26; CHECK-NEXT: define internal i32 @CallIndirectI32(i32 %f_addr) {
27; CHECK-NEXT: entry:
28; CHECK-NEXT:   %r = call i32 %f_addr(i64 1, i32 %f_addr)
29; CHECK-NEXT:   ret i32 %r
30; CHECK-NEXT: }
31
32; NOIR: Total across all functions
33