xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/fold-call.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=x86 | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=x86-64 | FileCheck %s
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker; CHECK: test1
5*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: mov
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Workerdeclare void @bar()
8*9880d681SAndroid Build Coastguard Workerdefine void @test1(i32 %i0, i32 %i1, i32 %i2, i32 %i3, i32 %i4, i32 %i5, void()* %arg) nounwind {
9*9880d681SAndroid Build Coastguard Worker	call void @bar()
10*9880d681SAndroid Build Coastguard Worker	call void %arg()
11*9880d681SAndroid Build Coastguard Worker	ret void
12*9880d681SAndroid Build Coastguard Worker}
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard Worker; PR14739
15*9880d681SAndroid Build Coastguard Worker; CHECK: test2
16*9880d681SAndroid Build Coastguard Worker; CHECK: mov{{.*}} $0, ([[REGISTER:%[a-z]+]])
17*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: jmp{{.*}} *([[REGISTER]])
18*9880d681SAndroid Build Coastguard Worker
19*9880d681SAndroid Build Coastguard Worker%struct.X = type { void ()* }
20*9880d681SAndroid Build Coastguard Workerdefine void @test2(%struct.X* nocapture %x) {
21*9880d681SAndroid Build Coastguard Workerentry:
22*9880d681SAndroid Build Coastguard Worker  %f = getelementptr inbounds %struct.X, %struct.X* %x, i64 0, i32 0
23*9880d681SAndroid Build Coastguard Worker  %0 = load void ()*, void ()** %f
24*9880d681SAndroid Build Coastguard Worker  store void ()* null, void ()** %f
25*9880d681SAndroid Build Coastguard Worker  tail call void %0()
26*9880d681SAndroid Build Coastguard Worker  ret void
27*9880d681SAndroid Build Coastguard Worker}
28