[PATCH] D122471: [IR] Require intrinsic struct return type to be anonymous

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 28 01:32:05 PDT 2022


nikic added a comment.

Hrm, unfortunately this fails clang/test/CodeGenCUDA/texture.cu, which does:

  __attribute__((device)) v4f tex2d_ld(texture<float, 2, ElementType>, float, float) asm("llvm.nvvm.tex.unified.2d.v4f32.f32");
  __attribute__((device)) v4f tex2d_ld(texture<float, 2, NormalizedFloat>, int, int) asm("llvm.nvvm.tex.unified.2d.v4f32.s32");

TIL about the `asm` attribute, though thankfully clang docs are very explicit about this usage being unsupported:

> While it is possible to use this attribute to name a special symbol used internally by the compiler, such as an LLVM intrinsic, this is neither recommended nor supported and may cause the compiler to crash or miscompile. Users who wish to gain access to intrinsic behavior are strongly encouraged to request new builtin functions.

I'm not entirely sure how to resolve this -- possibly the right action here is to simply delete the test, as it's an unsupported usage. An alternative would be to do intrinsic auto-upgrade during frontend codegen (this is something rustc does for example), but given the fact that this should only be relevant for this `asm` construct, and that such usage is explicitly unsupported, we probably shouldn't go out of our way to make it work.


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

https://reviews.llvm.org/D122471



More information about the llvm-commits mailing list