diff options
author | Chad Rosier <mcrosier@codeaurora.org> | 2016-04-22 18:47:21 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@codeaurora.org> | 2016-04-22 18:47:21 +0000 |
commit | 1a4bc110f52100fad5b5909cf76c234604c18306 (patch) | |
tree | 045dd8be6c088d7cb6773aa6b7bde216473a4cd3 | |
parent | ea53dba78b5064052793fe9a8bec4a2649fb3e4f (diff) | |
download | bcm5719-llvm-1a4bc110f52100fad5b5909cf76c234604c18306.tar.gz bcm5719-llvm-1a4bc110f52100fad5b5909cf76c234604c18306.zip |
[EarlyCSE/CVP] Add stats for CVPs and make sure to account for any Changes.
llvm-svn: 267187
-rw-r--r-- | llvm/lib/Transforms/Scalar/EarlyCSE.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/EarlyCSE.cpp b/llvm/lib/Transforms/Scalar/EarlyCSE.cpp index 949300b94a7..f490c2b6653 100644 --- a/llvm/lib/Transforms/Scalar/EarlyCSE.cpp +++ b/llvm/lib/Transforms/Scalar/EarlyCSE.cpp @@ -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 |