1*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -S -place-safepoints | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.localescape(...) 4*9880d681SAndroid Build Coastguard Worker 5*9880d681SAndroid Build Coastguard Worker; Do we insert the entry safepoint after the localescape intrinsic? 6*9880d681SAndroid Build Coastguard Workerdefine void @parent() gc "statepoint-example" { 7*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @parent 8*9880d681SAndroid Build Coastguard Workerentry: 9*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: entry 10*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: alloca 11*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: localescape 12*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: call void @do_safepoint 13*9880d681SAndroid Build Coastguard Worker %ptr = alloca i32 14*9880d681SAndroid Build Coastguard Worker call void (...) @llvm.localescape(i32* %ptr) 15*9880d681SAndroid Build Coastguard Worker ret void 16*9880d681SAndroid Build Coastguard Worker} 17*9880d681SAndroid Build Coastguard Worker 18*9880d681SAndroid Build Coastguard Worker; This function is inlined when inserting a poll. To avoid recursive 19*9880d681SAndroid Build Coastguard Worker; issues, make sure we don't place safepoints in it. 20*9880d681SAndroid Build Coastguard Workerdeclare void @do_safepoint() 21*9880d681SAndroid Build Coastguard Workerdefine void @gc.safepoint_poll() { 22*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: gc.safepoint_poll 23*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: entry 24*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: do_safepoint 25*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret void 26*9880d681SAndroid Build Coastguard Workerentry: 27*9880d681SAndroid Build Coastguard Worker call void @do_safepoint() 28*9880d681SAndroid Build Coastguard Worker ret void 29*9880d681SAndroid Build Coastguard Worker}