~pali/+junk/llvm-toolchain-3.7

« back to all changes in this revision

Viewing changes to test/Transforms/PlaceSafepoints/call_gc_result.ll

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2015-07-15 17:51:08 UTC
  • Revision ID: package-import@ubuntu.com-20150715175108-l8mynwovkx4zx697
Tags: upstream-3.7~+rc2
ImportĀ upstreamĀ versionĀ 3.7~+rc2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
;; RUN: opt %s -place-safepoints -S | FileCheck %s
 
2
 
 
3
;; This test is to verify that gc_result from a call statepoint
 
4
;; can have preceding phis in its parent basic block. Unlike
 
5
;; invoke statepoint, call statepoint does not terminate the
 
6
;; block, and thus its gc_result is in the same block with the
 
7
;; call statepoint.
 
8
 
 
9
declare i32 @foo()
 
10
 
 
11
define i32 @test1(i1 %cond, i32 %a) gc "statepoint-example" {
 
12
entry:
 
13
  br i1 %cond, label %branch1, label %branch2
 
14
  
 
15
branch1:
 
16
  %b = add i32 %a, 1
 
17
  br label %merge
 
18
 
 
19
branch2:
 
20
  br label %merge
 
21
 
 
22
merge:
 
23
;; CHECK:               %phi = phi i32 [ %a, %branch2 ], [ %b, %branch1 ]
 
24
;; CHECK-NEXT:  %safepoint_token.1 = call i32 (i64, i32, i32 ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_i32f(i64 2882400000, i32 0, i32 ()* @foo, i32 0, i32 0, i32 0, i32 0)
 
25
;; CHECK-NEXT:  %ret.2 = call i32 @llvm.experimental.gc.result.i32(i32 %safepoint_token.1)
 
26
  %phi = phi i32 [ %a, %branch2 ], [ %b, %branch1 ]
 
27
  %ret = call i32 @foo()
 
28
  ret i32 %ret
 
29
}
 
30
 
 
31
; This function is inlined when inserting a poll.
 
32
declare void @do_safepoint()
 
33
define void @gc.safepoint_poll() {
 
34
; CHECK-LABEL: gc.safepoint_poll
 
35
entry:
 
36
  call void @do_safepoint()
 
37
  ret void
 
38
}