[EarlyCSE/CVP] Add stats for CVPs and make sure to account for any Changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267187 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chad Rosier 2016-04-22 18:47:21 +00:00
parent b5898a2cfe
commit c6ee1a00f8

View File

@ -40,6 +40,7 @@ using namespace llvm::PatternMatch;
STATISTIC(NumSimplify, "Number of instructions simplified or DCE'd");
STATISTIC(NumCSE, "Number of instructions CSE'd");
STATISTIC(NumCSECVP, "Number of compare instructions CVP'd");
STATISTIC(NumCSELoad, "Number of load instructions CSE'd");
STATISTIC(NumCSECall, "Number of call instructions CSE'd");
STATISTIC(NumDSE, "Number of trivial dead stores removed");
@ -482,6 +483,7 @@ private:
}
bool EarlyCSE::processNode(DomTreeNode *Node) {
bool Changed = false;
BasicBlock *BB = Node->getBlock();
// If this block has a single predecessor, then the predecessor is the parent
@ -512,9 +514,13 @@ bool EarlyCSE::processNode(DomTreeNode *Node) {
DEBUG(dbgs() << "EarlyCSE CVP: Add conditional value for '"
<< CondInst->getName() << "' as " << *ConditionalConstant
<< " in " << BB->getName() << "\n");
// Replace all dominated uses with the known value
replaceDominatedUsesWith(CondInst, ConditionalConstant, DT,
BasicBlockEdge(Pred, BB));
// Replace all dominated uses with the known value.
if (unsigned Count =
replaceDominatedUsesWith(CondInst, ConditionalConstant, DT,
BasicBlockEdge(Pred, BB))) {
Changed = true;
NumCSECVP = NumCSECVP + Count;
}
}
/// LastStore - Keep track of the last non-volatile store that we saw... for
@ -523,7 +529,6 @@ bool EarlyCSE::processNode(DomTreeNode *Node) {
/// stores which can occur in bitfield code among other things.
Instruction *LastStore = nullptr;
bool Changed = false;
const DataLayout &DL = BB->getModule()->getDataLayout();
// See if any instructions in the block can be eliminated. If so, do it. If