[Canonicalize] Don't call isBeforeInBlock in OperationFolder::tryToFold.
This patch (e4635e63) 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
Loading
Please sign in to comment