llvm.org GIT mirror llvm / 83a049f
Don't Place Entry Safepoints Before the llvm.frameescape() Intrinsic llvm.frameescape() intrinsic is not a real call. The intrinsic can only exist in the entry block. Inserting a gc.statepoint() before llvm.frameescape() may split the entry block, and push the intrinsic out of the entry block. Patch by: Swaroop.Sridhar@microsoft.com Differential Revision: http://reviews.llvm.org/D8910 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235820 91177308-0d34-0410-b5e6-96231b3b80d8 Philip Reames 4 years ago
2 changed file(s) with 36 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
429429 if (II->getIntrinsicID() == Intrinsic::assume) {
430430 continue;
431431 }
432 // llvm.frameescape() intrinsic is not a real call. The intrinsic can
433 // exist only in the entry block.
434 // Inserting a statepoint before llvm.frameescape() may split the
435 // entry block, and push the intrinsic out of the entry block.
436 if (II->getIntrinsicID() == Intrinsic::frameescape) {
437 continue;
438 }
432439 }
433440 break;
434441 }
0 ; RUN: opt %s -S -place-safepoints | FileCheck %s
1
2 declare void @llvm.frameescape(...)
3
4 ; Do we insert the entry safepoint after the frameescape intrinsic?
5 define void @parent() gc "statepoint-example" {
6 ; CHECK-LABEL: @parent
7 entry:
8 ; CHECK-LABEL: entry
9 ; CHECK-NEXT: alloca
10 ; CHECK-NEXT: frameescape
11 ; CHECK-NEXT: statepoint
12 %ptr = alloca i32
13 call void (...) @llvm.frameescape(i32* %ptr)
14 ret void
15 }
16
17 ; This function is inlined when inserting a poll. To avoid recursive
18 ; issues, make sure we don't place safepoints in it.
19 declare void @do_safepoint()
20 define void @gc.safepoint_poll() {
21 ; CHECK-LABEL: gc.safepoint_poll
22 ; CHECK-LABEL: entry
23 ; CHECK-NEXT: do_safepoint
24 ; CHECK-NEXT: ret void
25 entry:
26 call void @do_safepoint()
27 ret void
28 }