[all-commits] [llvm/llvm-project] b7cd56: [IR] Don't verify module flags on every access (#1...

Alexis Engelke via All-commits all-commits at lists.llvm.org
Tue Aug 6 09:33:47 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b7cd564fa3ecc2a9ed0fded98c24f68e2dad63ad
      https://github.com/llvm/llvm-project/commit/b7cd564fa3ecc2a9ed0fded98c24f68e2dad63ad
  Author: Alexis Engelke <engelke at in.tum.de>
  Date:   2024-08-06 (Tue, 06 Aug 2024)

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

  Log Message:
  -----------
  [IR] Don't verify module flags on every access (#102153)

8b4306ce050bd5 introduced validity checks for every module flag access,
because the auto-upgrader uses named metadata before verifying the
module.

This causes overhead for all other accesses, and the check is, in fact,
only need at that single place. Change the upgrader to be careful when
accessing module flags before the module is verified and remove the
checks on all other occasions.

There are two tangential optimizations included: first, when querying a
specific flag, don't enumerate all other flags into a vector as well.
Second, don't use a Twine for getNamedMetadata(), which has
materialization overhead -- all call sites use simple strings that can
be implicitly converted to a StringRef.



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