[all-commits] [llvm/llvm-project] 510fb8: [IR][TLI] Cache getLibFunc() result on Function (N...

Nikita Popov via All-commits all-commits at lists.llvm.org
Wed Nov 22 02:19:00 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 510fb8711e9ad68afdf2b9ef0f2bbf312bf9ccf5
      https://github.com/llvm/llvm-project/commit/510fb8711e9ad68afdf2b9ef0f2bbf312bf9ccf5
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2023-11-22 (Wed, 22 Nov 2023)

  Changed paths:
    M llvm/include/llvm/IR/Function.h
    M llvm/lib/Analysis/TargetLibraryInfo.cpp
    M llvm/lib/IR/Function.cpp
    M llvm/lib/IR/Value.cpp

  Log Message:
  -----------
  [IR][TLI] Cache getLibFunc() result on Function (NFC) (#72867)

Cache the result of the TLI libfunc lookup in the Function object. This
only caches the actual lookup of the LibFunc in the TLI map, but not the
prototype validation, as that might differ between different TLI
instances.

This uses the existing mechanism for invalidating the intrinsic ID when
the function name changes. The libfunc will be invalidated in that case
as well.

I don't believe this increases the size of Function on 64bit (which
currently has a trailing `bool` member), and I don't think we would
particularly care if it did, as Functions are uncommon as Values go.




More information about the All-commits mailing list