[all-commits] [llvm/llvm-project] 2ead34: [SimplifyCFG] Add early bailout if Use is not in s...

Florian Hahn via All-commits all-commits at lists.llvm.org
Tue Nov 9 04:57:27 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2ead34716a8e294b1d22910c116e91732fc27320
      https://github.com/llvm/llvm-project/commit/2ead34716a8e294b1d22910c116e91732fc27320
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2021-11-09 (Tue, 09 Nov 2021)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp

  Log Message:
  -----------
  [SimplifyCFG] Add early bailout if Use is not in same BB.

Without this patch, passingValueIsAlwaysUndefined will iterate over all
instructions from I to the end of the basic block, even if the use is
outside the block.

This patch adds an early bail out, if the use instruction is outside I's
BB. This can greatly reduce compile-time in cases where very large basic
blocks are involved, with a large number of PHI nodes and incoming
values.

Note that the refactoring makes the handling of the case where I is a
phi and Use is in PHI more explicit  as well: for phi nodes, we can also
directly bail out. In the existing code, we would iterate until we reach
the end and return false.

Based on an earlier patch by Matt Wala.

Reviewed By: lebedev.ri

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




More information about the All-commits mailing list