[all-commits] [llvm/llvm-project] 0031c7: Implement some micro-optimizations for Identifier....

Chris Lattner via All-commits all-commits at lists.llvm.org
Sat Apr 11 21:49:10 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 0031c7f7dab5489934fc97c783fedbd49a377323
      https://github.com/llvm/llvm-project/commit/0031c7f7dab5489934fc97c783fedbd49a377323
  Author: Chris Lattner <clattner at nondot.org>
  Date:   2020-04-11 (Sat, 11 Apr 2020)

  Changed paths:
    M mlir/include/mlir/IR/Identifier.h
    M mlir/lib/IR/Attributes.cpp
    M mlir/lib/IR/MLIRContext.cpp

  Log Message:
  -----------
  Implement some micro-optimizations for Identifier. NFC

Summary:
Identifier doesn't maintain a length, so every time strref() is called,
it does a strlen.  In the case of comparisons, this isn't necessary:
there is no need to scan a string to get its length, then rescan it to
do the comparison.  Just done one comparison.

This also moves some assertions in Identifier::get as another
microoptimization for 'assertions enabled' modes.

Reviewers: rriddle!

Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, grosul1, frgossen, llvm-commits

Tags: #llvm

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




More information about the All-commits mailing list