From 853a5a4828f68938e7140e42927eb4742b927887 Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Fri, 17 May 2019 12:07:51 +0000 Subject: [PATCH] [MergeICmps][NFC] Add more debug. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361024 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/MergeICmps.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/Transforms/Scalar/MergeICmps.cpp b/lib/Transforms/Scalar/MergeICmps.cpp index d6d79be2a8f..19d973a39ed 100644 --- a/lib/Transforms/Scalar/MergeICmps.cpp +++ b/lib/Transforms/Scalar/MergeICmps.cpp @@ -666,6 +666,9 @@ bool BCECmpChain::simplify(const TargetLibraryInfo *const TLI, if (!AtLeastOneMerged()) return false; + LLVM_DEBUG(dbgs() << "Simplifying comparison chain starting at block " + << EntryBlock_->getName() << "\n"); + // Effectively merge blocks. We go in the reverse direction from the phi block // so that the next block is always available to branch to. const auto mergeRange = [this, TLI, AA](int I, int Num, BasicBlock *Next) { @@ -676,6 +679,9 @@ bool BCECmpChain::simplify(const TargetLibraryInfo *const TLI, BasicBlock *NextCmpBlock = Phi_.getParent(); for (int I = static_cast(Comparisons_.size()) - 2; I >= 0; --I) { if (IsContiguous(Comparisons_[I], Comparisons_[I + 1])) { + LLVM_DEBUG(dbgs() << "Merging block " << Comparisons_[I].BB->getName() + << " into " << Comparisons_[I + 1].BB->getName() + << "\n"); ++NumMerged; } else { NextCmpBlock = mergeRange(I + 1, NumMerged, NextCmpBlock); @@ -689,6 +695,8 @@ bool BCECmpChain::simplify(const TargetLibraryInfo *const TLI, // blocks in the old chain unreachable. while (!pred_empty(EntryBlock_)) { BasicBlock* const Pred = *pred_begin(EntryBlock_); + LLVM_DEBUG(dbgs() << "Updating jump into old chain from " << Pred->getName() + << "\n"); Pred->getTerminator()->replaceUsesOfWith(EntryBlock_, NextCmpBlock); } EntryBlock_ = nullptr; @@ -696,6 +704,7 @@ bool BCECmpChain::simplify(const TargetLibraryInfo *const TLI, // Delete merged blocks. This also removes incoming values in phi. SmallVector DeadBlocks; for (auto &Cmp : Comparisons_) { + LLVM_DEBUG(dbgs() << "Deleting merged block " << Cmp.BB->getName() << "\n"); DeadBlocks.push_back(Cmp.BB); } DeleteDeadBlocks(DeadBlocks); -- 2.40.0