================
@@ -6734,8 +6734,10 @@ ExprResult Sema::BuildCallExpr(Scope *Scope, Expr *Fn,
SourceLocation LParenLoc,
// If Arg is declared in the default address space and Param is declared
// in a non-default address space, perform an implicit address space cast
to
// the parameter type.
- if (getLangOpts().HIP && getLangOpts().CUDAIsDevice && FD &&
- FD->getBuiltinID()) {
+ FunctionDecl *Caller = getCurFunctionDecl(/*AllowLambda =*/true);
+ bool CallerIsDevice = Caller && (Caller->hasAttr<CUDAGlobalAttr>() ||
+ Caller->hasAttr<CUDADeviceAttr>());
+ if (getLangOpts().HIP && CallerIsDevice && FD && FD->getBuiltinID()) {
----------------
jmmartinez wrote:
We would be adding implicit casts on the host side, while I'd expect the host
side to remain the same.
At the same time, I guess it doesn't really matter since the host side is not
as address-space-rich as the device.
https://github.com/llvm/llvm-project/pull/165387
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits