[all-commits] [llvm/llvm-project] 6a9f79: [pseudo] Eliminate the type-name identifier ambigu...

Haojian Wu via All-commits all-commits at lists.llvm.org
Wed Aug 17 05:32:00 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6a9f79e1020db9f581d00791f1f644b64facfebe
  Author: Haojian Wu <hokein.wu at gmail.com>
  Date:   2022-08-17 (Wed, 17 Aug 2022)

  Changed paths:
    M clang-tools-extra/pseudo/lib/cxx/cxx.bnf
    M clang-tools-extra/pseudo/test/glr.cpp

  Log Message:
  [pseudo] Eliminate the type-name identifier ambiguities in the grammar.

See https://reviews.llvm.org/D130626 for motivation.

Identifier in the grammar has different categories (type-name, template-name,
namespace-name), they requires semantic information to resolve. This patch is
to eliminate the "local" ambiguities in type-name, and namespace-name, which
gives us a performance boost of the parser:

  - eliminate all different type rules (class-name, enum-name, typedef-name), and
    fold them into a unified type-name, this removes the #1 type-name ambiguity, and
    gives us a big performance boost;
  - remove the namespace-alis rules, as they're hard and uninteresting;

Note that we could eliminate more and gain more performance (like fold template-name,
type-name, namespace together), but at current stage, we'd like keep all existing
categories of the identifier (as they might assist in correlated disambiguation &
keep the representation of important concepts uniform).

| file               |ambiguous nodes |  forest size     | glrParse performance |
|SemaCodeComplete.cpp|  11k -> 5.7K   | 10.4MB -> 7.9MB  | 7.1MB/s -> 9.98MB/s  |
|       AST.cpp      |  1.3k -> 0.73K | 0.99MB -> 0.77MB | 6.7MB/s -> 8.4MB/s   |

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

More information about the All-commits mailing list