[NFC][JumpThreading] Increment 'NumFolds' statistic all places terminator becomes uncond

This commit is contained in:
Roman Lebedev 2021-04-10 21:24:29 +03:00
parent a407738def
commit f041757e9c
No known key found for this signature in database
GPG Key ID: 083C3EBB4A1689E0
1 changed files with 4 additions and 0 deletions

View File

@ -1110,6 +1110,7 @@ bool JumpThreadingPass::processBlock(BasicBlock *BB) {
LLVM_DEBUG(dbgs() << " In block '" << BB->getName()
<< "' folding undef terminator: " << *BBTerm << '\n');
BranchInst::Create(BBTerm->getSuccessor(BestSucc), BBTerm);
++NumFolds;
BBTerm->eraseFromParent();
DTU->applyUpdatesPermissive(Updates);
if (FI)
@ -1165,6 +1166,7 @@ bool JumpThreadingPass::processBlock(BasicBlock *BB) {
BranchInst *UncondBr =
BranchInst::Create(CondBr->getSuccessor(ToKeep), CondBr);
UncondBr->setDebugLoc(CondBr->getDebugLoc());
++NumFolds;
CondBr->eraseFromParent();
if (CondCmp->use_empty())
CondCmp->eraseFromParent();
@ -1280,6 +1282,7 @@ bool JumpThreadingPass::processImpliedCondition(BasicBlock *BB) {
RemoveSucc->removePredecessor(BB);
BranchInst *UncondBI = BranchInst::Create(KeepSucc, BI);
UncondBI->setDebugLoc(BI->getDebugLoc());
++NumFolds;
BI->eraseFromParent();
DTU->applyUpdatesPermissive({{DominatorTree::Delete, BB, RemoveSucc}});
if (HasProfileData)
@ -1729,6 +1732,7 @@ bool JumpThreadingPass::processThreadableEdges(Value *Cond, BasicBlock *BB,
// Finally update the terminator.
Instruction *Term = BB->getTerminator();
BranchInst::Create(OnlyDest, Term);
++NumFolds;
Term->eraseFromParent();
DTU->applyUpdatesPermissive(Updates);
if (HasProfileData)