Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PR41157][OpenCL] Prevent implicit init of local addr space var in C+…
…+ mode. Prevent adding initializers implicitly to variables declared in local address space. This happens when they get converted into global variables and therefore theoretically have to be default initialized in C++. Differential Revision: https://reviews.llvm.org/D59646 llvm-svn: 357684
- Loading branch information
Anastasia Stulova
committed
Apr 4, 2019
1 parent
e2622b3
commit 9b4c6b8
Showing
3 changed files
with
27 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// RUN: %clang_cc1 %s -triple spir -cl-std=c++ -emit-llvm -O0 -o - | FileCheck %s | ||
|
||
// Test that we don't initialize local address space objects. | ||
//CHECK: @_ZZ4testvE1i = internal addrspace(3) global i32 undef | ||
//CHECK: @_ZZ4testvE2ii = internal addrspace(3) global %class.C undef | ||
class C { | ||
int i; | ||
}; | ||
|
||
kernel void test() { | ||
__local int i; | ||
__local C ii; | ||
// FIXME: In OpenCL C we don't accept initializers for local | ||
// address space variables. User defined initialization could | ||
// make sense, but would it mean that all work items need to | ||
// execute it? Potentially disallowing any initialization would | ||
// make things easier and assingments can be used to set specific | ||
// values. This rules should make it consistent with OpenCL C. | ||
//__local C c(); | ||
} |