[all-commits] [llvm/llvm-project] f9710d: [pseudo] Add a fast-path to GLR reduce when both p...

Sam McCall via All-commits all-commits at lists.llvm.org
Thu Jun 23 09:29:53 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f9710d190886024ba938819722eb23cba8da2c06
  Author: Sam McCall <sam.mccall at gmail.com>
  Date:   2022-06-23 (Thu, 23 Jun 2022)

  Changed paths:
    M clang-tools-extra/pseudo/lib/GLR.cpp

  Log Message:
  [pseudo] Add a fast-path to GLR reduce when both pop and push are trivial

In general we split a reduce into pop/push, so concurrently-available reductions
can run in the correct order. The data structures for this are expensive.

When only one reduction is possible at a time, we need not do this: we can pop
and immediately push instead.
Strictly this is correct whenever we yield one concurrent PushSpec.

This patch recognizes a trivial but common subset of these cases:
 - there must be no pending pushes and only one head available to pop
 - the head must have only one reduction rule
 - the reduction path must be a straight line (no multiple parents)

On my machine this speeds up by 2.12 -> 2.30 MB/s = 8%

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

More information about the All-commits mailing list