~pali/+junk/llvm-toolchain-3.7

« back to all changes in this revision

Viewing changes to test/Transforms/InstCombine/gc.relocate.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 -instcombine -S | FileCheck %s
 
2
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
 
3
 
 
4
; Uses InstCombine with DataLayout to propagate dereferenceable
 
5
; attribute via gc.relocate: if the derived ptr is dereferenceable(N),
 
6
; then the return attribute of gc.relocate is dereferenceable(N).
 
7
 
 
8
declare zeroext i1 @return_i1()
 
9
declare i32 @llvm.experimental.gc.statepoint.p0f_i1f(i64, i32, i1 ()*, i32, i32, ...)
 
10
declare i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32, i32, i32)
 
11
 
 
12
define i32 addrspace(1)* @deref(i32 addrspace(1)* dereferenceable(8) %dparam) gc "statepoint-example" {
 
13
; Checks that a dereferenceabler pointer
 
14
; CHECK-LABEL: @deref
 
15
; CHECK: call dereferenceable(8)
 
16
entry:
 
17
    %load = load i32, i32 addrspace(1)* %dparam
 
18
    %tok = tail call i32 (i64, i32, i1 ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_i1f(i64 0, i32 0, i1 ()* @return_i1, i32 0, i32 0, i32 0, i32 0, i32 addrspace(1)* %dparam)
 
19
    %relocate = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32 %tok,  i32 7, i32 7)
 
20
    ret i32 addrspace(1)* %relocate
 
21
}