[all-commits] [llvm/llvm-project] 40a89d: [Canonicalize] Don't call isBeforeInBlock in Opera...

Chris Lattner via All-commits all-commits at lists.llvm.org
Wed Sep 8 13:33:37 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 40a89da65ce85163123cdfec66afdcf2fa3687ce
      https://github.com/llvm/llvm-project/commit/40a89da65ce85163123cdfec66afdcf2fa3687ce
  Author: Chris Lattner <clattner at nondot.org>
  Date:   2021-09-08 (Wed, 08 Sep 2021)

  Changed paths:
    M mlir/lib/Transforms/Utils/FoldUtils.cpp

  Log Message:
  -----------
  [Canonicalize] Don't call isBeforeInBlock in OperationFolder::tryToFold.

This patch (e4635e6328c8) fixed a bug where a newly generated/reused
constant wouldn't dominate a folded operation.  It did so by calling
isBeforeInBlock to move the constant around on demand.  This introduced
a significant compile time regression, because "isBeforeInBlock" is
O(n) in the size of a block the first time it is called, and the cache
is invalidated any time canonicalize changes something big in the block.

This fixes LLVM PR51738 and this CIRCT issue:
https://github.com/llvm/circt/issues/1700

This does affect the order of constants left in the top of a block,
I staged in the testsuite changes in rG42431b8207a5.

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




More information about the All-commits mailing list