[all-commits] [llvm/llvm-project] 6f305e: [DAGCombiner] Limit graph traversal to cap compile...

Pranav Kant via All-commits all-commits at lists.llvm.org
Wed Jul 26 10:29:56 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6f305e0658725aaf1acaff5c2c1500593e58d8f3
      https://github.com/llvm/llvm-project/commit/6f305e0658725aaf1acaff5c2c1500593e58d8f3
  Author: Pranav Kant <prka at google.com>
  Date:   2023-07-26 (Wed, 26 Jul 2023)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

  Log Message:
  -----------
  [DAGCombiner] Limit graph traversal to cap compile times

hasPredecessorHelper method, that is used by DAGCombiner to combine to pre-indexed and post-indexed load/stores, is a major source of slowdown while compiling a large function with MSan enabled on Arm. This patch caps the DFS-graph traversal for this method to 8192 which cuts compile time by 50% (4m -> 2m compile time) at the cost of less overall nodes combined.

Here's the summary of pre-index DAG nodes created and time it took to compile the pathological case with different MaxDepth limit:
1. With MaxDepth = 0 (unlimited): 1800, took 4m
2. With MaxDepth = 32k, 560, took 2m31s
3. With MaxDepth = 8k, 139, took 2m.

Reviewed By: MaskRay

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




More information about the All-commits mailing list