1//RUN: %clang_cc1 %s -cl-std=clc++ -triple spir -emit-llvm -o - | FileCheck %s
2
3int bar(const unsigned int &i);
4// CHECK-LABEL: define spir_func void @_Z3foov()
5void foo() {
6  // The generic addr space reference parameter object will be bound
7  // to a temporary value allocated in private addr space. We need an
8  // addrspacecast before passing the value to the function.
9  // CHECK: [[REF:%.*]] = alloca i32
10  // CHECK: store i32 1, i32* [[REF]]
11  // CHECK: [[REG:%[.a-z0-9]+]] = addrspacecast i32* [[REF]] to i32 addrspace(4)*
12  // CHECK: call spir_func i32 @_Z3barRU3AS4Kj(i32 addrspace(4)* align 4 dereferenceable(4) [[REG]])
13  bar(1);
14}
15