[all-commits] [llvm/llvm-project] 891170: [DL] Optimize address space zero lookup (NFC)

Nikita Popov via All-commits all-commits at lists.llvm.org
Sun Nov 29 13:56:41 PST 2020


  Branch: refs/heads/temp-test-main
  Home:   https://github.com/llvm/llvm-project
  Commit: 891170e8636b312092486dee7c9117db7def8836
      https://github.com/llvm/llvm-project/commit/891170e8636b312092486dee7c9117db7def8836
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2020-11-29 (Sun, 29 Nov 2020)

  Changed paths:
    M llvm/include/llvm/IR/DataLayout.h
    M llvm/lib/IR/DataLayout.cpp

  Log Message:
  -----------
  [DL] Optimize address space zero lookup (NFC)

Information for pointer size/alignment/etc is queried a lot, but
the binary search based implementation makes this fairly slow.

Add an explicit check for address space zero and skip the search
in that case -- we need to specially handle the zero address space
anyway, as it serves as the fallback for all address spaces that
were not explicitly defined.

I initially wanted to simply replace the binary search with a
linear search, which would handle both address space zero and the
general case efficiently, but I was not sure whether there are
any degenerate targets that use more than a handful of declared
address spaces (in-tree, even AMDGPU only declares six).




More information about the All-commits mailing list