Skip to content

Commit f1cf240

Browse files
author
iclsrc
committed
Merge from 'sycl' to 'sycl-web' (#1)
2 parents 50ea466 + 800c8c0 commit f1cf240

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2243,13 +2243,15 @@ llvm::Constant *CodeGenModule::EmitAnnotateAttr(llvm::GlobalValue *GV,
22432243
*UnitGV = EmitAnnotationUnit(L),
22442244
*LineNoCst = EmitAnnotationLineNo(L);
22452245

2246+
llvm::Type *ResType = llvm::PointerType::getInt8PtrTy(
2247+
this->getLLVMContext(), GV->getType()->getPointerAddressSpace());
2248+
22462249
// Create the ConstantStruct for the global annotation.
22472250
llvm::Constant *Fields[4] = {
2248-
llvm::ConstantExpr::getBitCast(GV, Int8PtrTy),
2249-
llvm::ConstantExpr::getBitCast(AnnoGV, Int8PtrTy),
2250-
llvm::ConstantExpr::getBitCast(UnitGV, Int8PtrTy),
2251-
LineNoCst
2252-
};
2251+
llvm::ConstantExpr::getPointerBitCastOrAddrSpaceCast(GV, ResType),
2252+
llvm::ConstantExpr::getBitCast(AnnoGV, Int8PtrTy),
2253+
llvm::ConstantExpr::getBitCast(UnitGV, Int8PtrTy),
2254+
LineNoCst};
22532255
return llvm::ConstantStruct::getAnon(Fields);
22542256
}
22552257

@@ -3887,8 +3889,11 @@ void CodeGenModule::addGlobalIntelFPGAAnnotation(const VarDecl *VD,
38873889
*UnitGV = EmitAnnotationUnit(VD->getLocation()),
38883890
*LineNoCst = EmitAnnotationLineNo(VD->getLocation());
38893891

3892+
llvm::Type *ResType = llvm::PointerType::getInt8PtrTy(
3893+
this->getLLVMContext(), GV->getType()->getPointerAddressSpace());
38903894
llvm::Constant *C =
3891-
llvm::ConstantExpr::getPointerBitCastOrAddrSpaceCast(GV, Int8PtrTy);
3895+
llvm::ConstantExpr::getPointerBitCastOrAddrSpaceCast(GV, ResType);
3896+
38923897
// Create the ConstantStruct for the global annotation.
38933898
llvm::Constant *Fields[4] = {
38943899
C, llvm::ConstantExpr::getBitCast(AnnoGV, Int8PtrTy),

clang/test/CodeGenSYCL/intel-fpga-local.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,13 @@
1515
//CHECK: [[ANN7:@.str[\.]*[0-9]*]] = {{.*}}{memory:MLAB}
1616
//CHECK: [[ANN8:@.str[\.]*[0-9]*]] = {{.*}}{memory:DEFAULT}{bankwidth:8}
1717
//CHECK: [[ANN9:@.str[\.]*[0-9]*]] = {{.*}}{memory:DEFAULT}{max_private_copies:4}
18+
//CHECK: [[ANN16:@.str.[0-9]*]] = {{.*}}foobar
1819

1920
//CHECK: @llvm.global.annotations
20-
//CHECK-SAME: a_one{{.*}}[[ANN1]]{{.*}}i32 148
21+
//CHECK-SAME: { i8 addrspace(1)* bitcast (i32 addrspace(1)* @_ZZ3quxiE5a_one to i8 addrspace(1)*)
22+
//CHECK-SAME: [[ANN1]]{{.*}}i32 152
23+
//CHECK-SAME: { i8 addrspace(1)* bitcast (i32 addrspace(1)* @_ZZ3quxiE5b_two to i8 addrspace(1)*)
24+
//CHECK-SAME: [[ANN16]]{{.*}}i32 156
2125

2226
void foo() {
2327
//CHECK: %[[VAR_ONE:[0-9]+]] = bitcast{{.*}}var_one
@@ -145,10 +149,14 @@ void baz() {
145149
}
146150

147151
void qux(int a) {
148-
static int a_one [[intelfpga::numbanks(2)]];
152+
static int a_one [[intelfpga::numbanks(4)]];
149153
//CHECK: load{{.*}}a_one
150154
//CHECK: store{{.*}}a_one
151155
a_one = a_one + a;
156+
static int b_two [[clang::annotate("foobar")]];
157+
//CHECK: load{{.*}}b_two
158+
//CHECK: store{{.*}}b_two
159+
b_two = b_two + a;
152160
}
153161

154162
void field_addrspace_cast() {

0 commit comments

Comments
 (0)