[all-commits] [llvm/llvm-project] 389f33: [TableGen] Rework `EmitIntrinsicToBuiltinMap` (#10...

Rahul Joshi via All-commits all-commits at lists.llvm.org
Tue Aug 20 14:23:09 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 389f339c11179fe047e7f564657c86247933e445
      https://github.com/llvm/llvm-project/commit/389f339c11179fe047e7f564657c86247933e445
  Author: Rahul Joshi <rjoshi at nvidia.com>
  Date:   2024-08-20 (Tue, 20 Aug 2024)

  Changed paths:
    M llvm/benchmarks/CMakeLists.txt
    A llvm/benchmarks/GetIntrinsicForClangBuiltin.cpp
    M llvm/include/llvm/IR/Intrinsics.h
    M llvm/include/llvm/TableGen/StringToOffsetTable.h
    M llvm/unittests/IR/IntrinsicsTest.cpp
    M llvm/utils/TableGen/IntrinsicEmitter.cpp

  Log Message:
  -----------
  [TableGen] Rework `EmitIntrinsicToBuiltinMap` (#104681)

Rework `IntrinsicEmitter::EmitIntrinsicToBuiltinMap` for improved
    peformance as well as refactor the code.

    Performance:
    - Current generated code does a linear search on the TargetPrefix,
      followed by a binary search on the builtin names for that
      target's builtins.
    - Improve the performance of this code in 2 ways:
      (a) Use binary search on the target prefix to lookup the builtin
          table for the target.
      (b) Improve the (common) case of when all builtins for a target
          share a common prefix.  Check this common prefix first, and
then do the binary search in the builtin table using the builtin
          name with the common prefix removed. This should help
          both data size (by creating a smaller static string table) and
          runtime (by reducing the cost of binary search on smaller
          strings).

    Refactor:
    - Use range based for loops for iterating over maps.
- Use formatv() and C++ raw string literals to simplify the emission
code.
    - Change the generated `getIntrinsicForClangBuiltin` and 
      `getIntrinsicForMSBuiltin`  to take a `StringRef` instead of 
      `const char *` for the prefix.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list