[all-commits] [llvm/llvm-project] 04790d: Support intrinsic overloading on unnamed types

dobbelaj-snps via All-commits all-commits at lists.llvm.org
Fri Mar 19 06:35:42 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 04790d9cfba35073d56047544502c387c5657bb1
      https://github.com/llvm/llvm-project/commit/04790d9cfba35073d56047544502c387c5657bb1
  Author: Jeroen Dobbelaere <jeroen.dobbelaere at synopsys.com>
  Date:   2021-03-19 (Fri, 19 Mar 2021)

  Changed paths:
    M llvm/docs/LangRef.rst
    M llvm/include/llvm/IR/Intrinsics.h
    M llvm/include/llvm/IR/Module.h
    M llvm/lib/IR/Function.cpp
    M llvm/lib/IR/Module.cpp
    M llvm/lib/IR/Verifier.cpp
    M llvm/lib/Linker/IRMover.cpp
    A llvm/test/Bitcode/intrinsics-with-unnamed-types.ll
    A llvm/test/Linker/intrinsics-with-unnamed-types.ll
    A llvm/test/Transforms/LoopVectorize/X86/pr48340.ll

  Log Message:
  -----------
  Support intrinsic overloading on unnamed types

This patch adds support for intrinsic overloading on unnamed types.

This fixes PR38117 and PR48340 and will also be needed for the Full Restrict Patches (D68484).

The main problem is that the intrinsic overloading name mangling is using 's_s' for unnamed types.
This can result in identical intrinsic mangled names for different function prototypes.

This patch changes this by adding a '.XXXXX' to the intrinsic mangled name when at least one of the types is based on an unnamed type, ensuring that we get a unique name.

Implementation details:
- The mapping is created on demand and kept in Module.
- It also checks for existing clashes and recycles potentially existing prototypes and declarations.
- Because of extra data in Module, Intrinsic::getName needs an extra Module* argument and, for speed, an optional FunctionType* argument.
- I still kept the original two-argument 'Intrinsic::getName' around which keeps the original behavior (providing the base name).
-- Main reason is that I did not want to change the LLVMIntrinsicGetName version, as I don't know how acceptable such a change is
-- The current situation already has a limitation. So that should not get worse with this patch.
- Intrinsic::getDeclaration and the verifier are now using the new version.

Other notes:
- As far as I see, this should not suffer from stability issues. The count is only added for prototypes depending on at least one anonymous struct
- The initial count starts from 0 for each intrinsic mangled name.
- In case of name clashes, existing prototypes are remembered and reused when that makes sense.

Reviewed By: fhahn

Differential Revision: https://reviews.llvm.org/D91250




More information about the All-commits mailing list