Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[OpenCL] Initialize temporaries in the private address space
This patch fixes initializing temporaries, which are currently initialized without an address space, meaning that no constructor can ever be applicable. Now they will be constructed in the private addrspace. Fixes the second issue in PR43296. Reviewed By: Anastasia Differential Revision: https://reviews.llvm.org/D107553
- Loading branch information
Showing
4 changed files
with
34 additions
and
4 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
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,19 @@ | ||
// RUN: %clang_cc1 %s -pedantic -ast-dump | FileCheck %s | ||
|
||
struct X { | ||
X() __private = default; | ||
}; | ||
|
||
// CHECK: VarDecl {{.*}} gx | ||
// CHECK: CXXTemporaryObjectExpr {{.*}} '__private X' | ||
__global X gx = X(); | ||
|
||
void k() { | ||
// CHECK: VarDecl {{.*}} x1 | ||
// CHECK: CXXTemporaryObjectExpr {{.*}} '__private X' | ||
X x1 = X(); | ||
|
||
// CHECK: VarDecl {{.*}} x2 | ||
// CHECK: CXXConstructExpr {{.*}} 'const __private X' | ||
const X x2; | ||
} |