[all-commits] [llvm/llvm-project] 176c7f: [IR] Optimize adding attribute to AttributeList (NFC)

Nikita Popov via All-commits all-commits at lists.llvm.org
Fri Jan 22 02:35:27 PST 2021


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 176c7f22172eefddc9ff42dfae8a6015d4e017c6
      https://github.com/llvm/llvm-project/commit/176c7f22172eefddc9ff42dfae8a6015d4e017c6
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2021-01-22 (Fri, 22 Jan 2021)

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

  Log Message:
  -----------
  [IR] Optimize adding attribute to AttributeList (NFC)

When adding an enum attribute to an AttributeList, avoid going
through an AttrBuilder and instead directly add the attribute to
the correct set. Going through AttrBuilder is expensive, because
it requires all string attributes to be reconstructed.

This can be further improved by inserting the attribute at the
right position and using the AttributeSetNode::getSorted() API.

This recovers the small compile-time regression from D94633.




More information about the All-commits mailing list