[PATCH] D128907: [Clang] Disable noundef attribute for languages which allow uninitialized function arguments

Johannes Doerfert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 14 08:08:21 PDT 2022


jdoerfert added subscribers: RaviNarayanaswamy, Anastasia, tra, bader.
jdoerfert added a comment.

In D128907#3652077 <https://reviews.llvm.org/D128907#3652077>, @arsenm wrote:

> In D128907#3650750 <https://reviews.llvm.org/D128907#3650750>, @jdoerfert wrote:
>
>> That said, I doubt this is even what we want. Throwing away the benefits of the noundef for one special case. IIRC, I mentioned alternatives in the other discussion already,... not that I have a link handy.
>
> I've spent a while thinking about this and don't see a better option. It's one special case, but since that special case can be called from arbitrary user code, I don't see how we can preserve noundef. We can't specially treat the handful of special intrinsics/operands for this, since we would transitively need to apply this to any user code which calls those functions

I guess, that is the actual question here: Does CUDA/HIP overwrite the semantics of the base language entirely or make exceptions for the intrinsics they added.
>From what I can tell, CUDA/HIP did the latter. I am not sure how much their standards (if any) mention this.

OpenMP offloading, for example, does not overwrite the base language (C/C++). For OpenMP we would want to make the intrinsics special but that's it. We would even be fine without any special handling  as the only uses are in our runtime (or other clang shipped code).

If the HIP/CUDA people think we should give up on noundef arguments completely, let's do it by language rather than some implicit property (convergent). OpenCL & SYCL people should also comment. (ping @tra, @RaviNarayanaswamy, @bader, @Anastasia)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128907/new/

https://reviews.llvm.org/D128907



More information about the cfe-commits mailing list