xref: /aosp_15_r20/external/llvm/test/Transforms/PlaceSafepoints/call-in-loop.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; If there's a call in the loop which dominates the backedge, we
2*9880d681SAndroid Build Coastguard Worker; don't need a safepoint poll (since the callee must contain a
3*9880d681SAndroid Build Coastguard Worker; poll test).
4*9880d681SAndroid Build Coastguard Worker;; RUN: opt < %s -place-safepoints -S | FileCheck %s
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Workerdeclare void @foo()
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Workerdefine void @test1() gc "statepoint-example" {
9*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test1
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Workerentry:
12*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: entry
13*9880d681SAndroid Build Coastguard Worker; CHECK: call void @do_safepoint
14*9880d681SAndroid Build Coastguard Worker  br label %loop
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Workerloop:
17*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: loop
18*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: call void @do_safepoint
19*9880d681SAndroid Build Coastguard Worker  call void @foo()
20*9880d681SAndroid Build Coastguard Worker  br label %loop
21*9880d681SAndroid Build Coastguard Worker}
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Worker; This function is inlined when inserting a poll.
24*9880d681SAndroid Build Coastguard Workerdeclare void @do_safepoint()
25*9880d681SAndroid Build Coastguard Workerdefine void @gc.safepoint_poll() {
26*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: gc.safepoint_poll
27*9880d681SAndroid Build Coastguard Workerentry:
28*9880d681SAndroid Build Coastguard Worker  call void @do_safepoint()
29*9880d681SAndroid Build Coastguard Worker  ret void
30*9880d681SAndroid Build Coastguard Worker}
31