[all-commits] [llvm/llvm-project] 80b0f7: Small improvements to Intrinsic::getName

Xun Li via All-commits all-commits at lists.llvm.org
Wed Dec 2 16:49:39 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 80b0f74c8c539b2385f897467aa99b2b6b298c04
      https://github.com/llvm/llvm-project/commit/80b0f74c8c539b2385f897467aa99b2b6b298c04
  Author: Xun Li <xun at fb.com>
  Date:   2020-12-02 (Wed, 02 Dec 2020)

  Changed paths:
    M llvm/lib/IR/Function.cpp

  Log Message:
  -----------
  Small improvements to Intrinsic::getName

While I was adding a new intrinsic instruction (not overloaded), I accidentally used CreateUnaryIntrinsic to create the intrinsics, which turns out to be passing the type list to getName, and ended up naming the intrinsics function with type suffix, which leads to wierd bugs latter on. It took me a long time to debug.
It seems a good idea to add an assertion in getName so that it fails if types are passed but it's not a overloaded function.
Also, the overloade version of getName is less efficient because it creates an std::string. We should avoid calling it if we know that there are no types provided.

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




More information about the All-commits mailing list