Skip to content

Commit 99a118a

Browse files
committed
use spelling at more opencl callsites
Signed-off-by: Sarnie, Nick <[email protected]>
1 parent 168103d commit 99a118a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

clang/lib/CodeGen/CGExpr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5887,7 +5887,7 @@ static CGCallee EmitDirectCallee(CodeGenFunction &CGF, GlobalDecl GD) {
58875887
}
58885888

58895889
static GlobalDecl getGlobalDeclForDirectCall(const FunctionDecl *FD) {
5890-
if (FD->hasAttr<DeviceKernelAttr>())
5890+
if (DeviceKernelAttr::isOpenCLSpelling(FD->getAttr<DeviceKernelAttr>()))
58915891
return GlobalDecl(FD, KernelReferenceKind::Stub);
58925892
return GlobalDecl(FD);
58935893
}
@@ -6309,7 +6309,7 @@ RValue CodeGenFunction::EmitCall(QualType CalleeType,
63096309
const auto *FnType = cast<FunctionType>(PointeeType);
63106310

63116311
if (const auto *FD = dyn_cast_or_null<FunctionDecl>(TargetDecl);
6312-
FD && FD->hasAttr<DeviceKernelAttr>())
6312+
FD && DeviceKernelAttr::isOpenCLSpelling(FD->getAttr<DeviceKernelAttr>()))
63136313
CGM.getTargetCodeGenInfo().setOCLKernelStubCallingConvention(FnType);
63146314

63156315
// If we are checking indirect calls and this call is indirect, check that the

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3929,7 +3929,8 @@ void CodeGenModule::EmitGlobal(GlobalDecl GD) {
39293929

39303930
// Ignore declarations, they will be emitted on their first use.
39313931
if (const auto *FD = dyn_cast<FunctionDecl>(Global)) {
3932-
if (FD->hasAttr<DeviceKernelAttr>() && FD->doesThisDeclarationHaveABody())
3932+
if (DeviceKernelAttr::isOpenCLSpelling(FD->getAttr<DeviceKernelAttr>()) &&
3933+
FD->doesThisDeclarationHaveABody())
39333934
addDeferredDeclToEmit(GlobalDecl(FD, KernelReferenceKind::Stub));
39343935

39353936
// Update deferred annotations with the latest declaration if the function
@@ -4895,7 +4896,7 @@ CodeGenModule::GetAddrOfFunction(GlobalDecl GD, llvm::Type *Ty, bool ForVTable,
48954896
if (!Ty) {
48964897
const auto *FD = cast<FunctionDecl>(GD.getDecl());
48974898
Ty = getTypes().ConvertType(FD->getType());
4898-
if (FD->hasAttr<DeviceKernelAttr>() &&
4899+
if (DeviceKernelAttr::isOpenCLSpelling(FD->getAttr<DeviceKernelAttr>()) &&
48994900
GD.getKernelReferenceKind() == KernelReferenceKind::Stub) {
49004901
const CGFunctionInfo &FI = getTypes().arrangeGlobalDeclaration(GD);
49014902
Ty = getTypes().GetFunctionType(FI);

0 commit comments

Comments
 (0)