[PATCH] D91250: Support intrinsic overloading on anonymous struct based types

Jeroen Dobbelaere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 11 04:20:39 PST 2020


jeroen.dobbelaere created this revision.
Herald added subscribers: llvm-commits, dexonsmith, hiraditya.
Herald added a reviewer: ctetreau.
Herald added a project: LLVM.
jeroen.dobbelaere requested review of this revision.

This is an attempt to add support for intrinsic overloading on anonymous struct based types.

This fixes PR38117 and will also be needed for the Full Restrict Patches (D68484 <https://reviews.llvm.org/D68484>).

The main problem is that the intrinsic overloading name mangling is using 's_s' for anonymous structs.
This patch changes this to 'sa_XXXXs' (with XXX a stable unique number, associated with the anonymous type).

Implementation details:

- The mapping is created on demand and kept in the LLVMContext.
- Because of this, Intrinsic::getName needs an extra Module* argument.
- I still kept the original two-argument 'Intrinsic::getName' around which keeps the original behavior (using s_s). (Main reason is that I did not want to change the LLVMIntrinsicGetName version, as I don't know how acceptable such a change is)
- Intrinsic::getDeclaration and the verifier are now using the new version.

Other notes:

- A testcase is not yet included. I first want to get feedback if this is an acceptable approach to the problem


https://reviews.llvm.org/D91250

Files:
  llvm/include/llvm/IR/Intrinsics.h
  llvm/include/llvm/IR/Module.h
  llvm/lib/IR/Function.cpp
  llvm/lib/IR/LLVMContextImpl.h
  llvm/lib/IR/Type.cpp
  llvm/lib/IR/Verifier.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91250.304475.patch
Type: text/x-patch
Size: 7291 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201111/a846b75c/attachment.bin>


More information about the llvm-commits mailing list