Skip to content

Commit e857d62

Browse files
[NFC][ESIMD] Remove dependencies on -fsycl-explicit-simd flag (#3241)
This patch is a part of the efforts for allowing ESIMD and regular SYCL kernels to coexist in the same translation unit and in the same program. Set the `kernel_arg*` metadata based on the sycl_explicit_simd attribute, not depending on `-fsycl-explicit-esimd` flag, which soon will be removed.
1 parent 3c22af9 commit e857d62

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1656,7 +1656,9 @@ void CodeGenModule::GenOpenCLArgMetadata(llvm::Function *Fn,
16561656
CGF->Builder.getInt1(parm->hasAttr<SYCLSimdAccessorPtrAttr>())));
16571657
}
16581658

1659-
if (LangOpts.SYCLIsDevice && !LangOpts.SYCLExplicitSIMD)
1659+
bool IsEsimdFunction = FD && FD->hasAttr<SYCLSimdAttr>();
1660+
1661+
if (LangOpts.SYCLIsDevice && !IsEsimdFunction)
16601662
Fn->setMetadata("kernel_arg_buffer_location",
16611663
llvm::MDNode::get(VMContext, argSYCLBufferLocationAttr));
16621664
else {
@@ -1670,7 +1672,7 @@ void CodeGenModule::GenOpenCLArgMetadata(llvm::Function *Fn,
16701672
llvm::MDNode::get(VMContext, argBaseTypeNames));
16711673
Fn->setMetadata("kernel_arg_type_qual",
16721674
llvm::MDNode::get(VMContext, argTypeQuals));
1673-
if (FD && FD->hasAttr<SYCLSimdAttr>())
1675+
if (IsEsimdFunction)
16741676
Fn->setMetadata("kernel_arg_accessor_ptr",
16751677
llvm::MDNode::get(VMContext, argESIMDAccPtrs));
16761678
if (getCodeGenOpts().EmitOpenCLArgMetadata)

0 commit comments

Comments
 (0)