[PATCH] D94576: [LoopVectorize] Guard verifyFunction with EXPENSIVE_CHECKS macro

Tarique Islam via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 13 06:42:35 PST 2021


tislam added a comment.

In D94576#2495433 <https://reviews.llvm.org/D94576#2495433>, @fhahn wrote:

>> We have found that the calls to verifyFunction can take up to 66% of the time spent in llvm::LoopVectorizePass::processLoop. For some source files, verifyFunction took around 10% of the total compile time.
>
> See also https://bugs.llvm.org/show_bug.cgi?id=47712. I'm curious, where is the time spent in the verifier? PR47712 mentions a regression in the verifier where the majority of time is spent in `visitMDNode`. Is this a similar issue?
>
> In general, I think the function verification has been very valuable in terms of surfacing bugs and I would be very reluctant to move it behind expensive checks, especially since we had this check for a long time. As mentioned in PR47712, I think `verifyFunction` should be `O(# instructions in function)` and not behind `EXPENSIVE_CHECKS`.

Thanks @fhahn for the information on PR47712.

The above stats are for cases where the instructions do not have any metadata (like debug or alias) in general. Here is some profile snapshots.

  |      |             |     --3.96%--llvm::LoopVectorizePass::runImpl
  |      |             |      |
  |      |             |       --3.96%--llvm::LoopVectorizePass::processLoop
  |      |             |        |
  |      |             |        |--2.63%--llvm::verifyFunction
  |      |             |        |    |
  |      |             |        |     --2.54%--(anonymous namespace)::Verifier::verify
  |      |             |        |      |
  |      |             |        |      |--1.95%--llvm::InstVisitor<(anonymous namespace)::Verifier, void>::visit<llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::BasicBlock, true, false, void>, false, false> >
  |      |             |        |      |
  |      |             |        |       --0.54%--llvm::DomTreeBuilder::Calculate<llvm::DominatorTreeBase<llvm::BasicBlock, false> >
  |      |             |        |
  |      |             |         --1.17%--llvm::LoopVectorizationPlanner::executePlan

With our local branch, we saw the following.

  |      |      |     --14.69%--llvm::LoopVectorizePass::runImpl
  |      |      |      |
  |      |      |       --14.69%--llvm::LoopVectorizePass::processLoop
  |      |      |        |
  |      |      |        |--9.98%--llvm::verifyFunction
  |      |      |        |    |
  |      |      |        |     --9.59%--(anonymous namespace)::Verifier::verify
  |      |      |        |      |
  |      |      |        |      |--2.49%--(anonymous namespace)::Verifier::visitInstruction
  |      |      |        |      |    |
  |      |      |        |      |     --1.28%--(anonymous namespace)::Verifier::visitInstruction
  |      |      |        |      |
  |      |      |        |      |--2.35%--llvm::InstVisitor<(anonymous namespace)::Verifier, void>::visit
  |      |      |        |      |    |
  |      |      |        |      |     --2.04%--(anonymous namespace)::Verifier::visitInstruction
  |      |      |        |      |      |
  |      |      |        |      |       --1.14%--(anonymous namespace)::Verifier::visitInstruction
  |      |      |        |      |
  |      |      |        |      |--2.12%--(anonymous namespace)::Verifier::verify
  |      |      |        |      |
  |      |      |        |       --2.06%--llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::CalculateFromScratch
  |      |      |        |        |
  |      |      |        |        |--0.89%--llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::runDFS<false, bool (*)(llvm::BasicBlock*, llvm::BasicBlock*)>
  |      |      |        |        |
  |      |      |        |        |--0.60%--llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::attachNewSubtree
  |      |      |        |        |
  |      |      |        |         --0.52%--llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::runSemiNCA
  |      |      |        |
  |      |      |         --4.22%--llvm::LoopVectorizationPlanner::executePlan


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94576/new/

https://reviews.llvm.org/D94576



More information about the llvm-commits mailing list