2019-07-25 19:04:29 +08:00
|
|
|
//RUN: %clang_cc1 %s -cl-std=clc++ -triple spir -emit-llvm -o - | FileCheck %s
|
2019-03-06 21:02:41 +08:00
|
|
|
|
|
|
|
int bar(const unsigned int &i);
|
|
|
|
// CHECK-LABEL: define spir_func void @_Z3foov()
|
|
|
|
void foo() {
|
|
|
|
// The generic addr space reference parameter object will be bound
|
|
|
|
// to a temporary value allocated in private addr space. We need an
|
|
|
|
// addrspacecast before passing the value to the function.
|
|
|
|
// CHECK: [[REF:%.*]] = alloca i32
|
|
|
|
// CHECK: store i32 1, i32* [[REF]]
|
2019-07-11 01:10:05 +08:00
|
|
|
// CHECK: [[REG:%[.a-z0-9]+]] = addrspacecast i32* [[REF]] to i32 addrspace(4)*
|
Introduce Value::stripPointerCastsSameRepresentation
This patch allows current users of Value::stripPointerCasts() to force
the result of the function to have the same representation as the value
it was called on. This is useful in various cases, e.g., (non-)null
checks.
In this patch only a single call site was adjusted to fix an existing
misuse that would cause nonnull where they may be wrong. Uses in
attribute deduction and other areas, e.g., D60047, are to be expected.
For a discussion on this topic, please see [0].
[0] http://lists.llvm.org/pipermail/llvm-dev/2018-December/128423.html
Reviewers: hfinkel, arsenm, reames
Subscribers: wdng, hiraditya, bollu, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D61607
llvm-svn: 362545
2019-06-05 04:21:46 +08:00
|
|
|
// CHECK: call spir_func i32 @_Z3barRU3AS4Kj(i32 addrspace(4)* dereferenceable(4) [[REG]])
|
2019-03-06 21:02:41 +08:00
|
|
|
bar(1);
|
|
|
|
}
|