[PATCH] D25166: [CUDA] Mark device functions as nounwind.

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 3 08:50:03 PDT 2016


rnk added a comment.

It feels like the right thing is to disable EH in device side compilation, but obviously that won't work because it would reject try/throw in host code. I think instead of doing that, we should make sure that CUDA diagnoses try / catch / throw in device functions, and then do what you've done here.

Also, take a look at CodeGenFunction::getInvokeDestImpl(). I think you should add some checks in there to return nullptr if we're doing a device-side CUDA compilation. That's a much more direct way to ensure we never generate invokes on the device side.



> SemaDecl.cpp:12082
> +        (getLangOpts().CUDAIsDevice && T == CFT_HostDevice))
> +      FD->addAttr(NoThrowAttr::CreateImplicit(Context, FD->getLocation()));
> +  }

Can we use a `noexcept` exception specification instead of this GCC attribute?

https://reviews.llvm.org/D25166





More information about the cfe-commits mailing list