[all-commits] [llvm/llvm-project] 9a334a: [IR] Store attributes that are available "somewher...

Nikita Popov via All-commits all-commits at lists.llvm.org
Sat Jun 27 01:45:22 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 9a334a4d204127a6941071694bd7c67d6ab31acb
      https://github.com/llvm/llvm-project/commit/9a334a4d204127a6941071694bd7c67d6ab31acb
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2020-06-27 (Sat, 27 Jun 2020)

  Changed paths:
    M llvm/lib/IR/AttributeImpl.h
    M llvm/lib/IR/Attributes.cpp

  Log Message:
  -----------
  [IR] Store attributes that are available "somewhere" (NFC)

I noticed that for some benchmarks we spend quite a bit of time
inside AttributeList::hasAttrSomewhere(), mainly when checking
for the "returned" attribute. Most of the time the attribute will
not be present, in which case this function has to walk through
the whole attribute list and check for the attribute at each index.

This patch adds a cache of all "available somewhere" attributes
inside AttributeListImpl. This makes the structure 12 bytes larger,
but I don't think that's problematic, as attribute lists are uniqued.
Compile-time in terms of instructions retired improves by 0.4% on
average, but >1% for sqlite.

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




More information about the All-commits mailing list