summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorCameron Zwarich <zwarich@apple.com>2011-03-01 21:13:53 +0000
committerCameron Zwarich <zwarich@apple.com>2011-03-01 21:13:53 +0000
commitb7f8eaafa371c1e8b462c470ee4f2001f73e91f8 (patch)
tree3d50a84a332641a7843f22e4f5cd3f799346972f /llvm/lib/Transforms
parent5f9f081d76bd7d0bc4b7d94fe1f42cffe38821b5 (diff)
downloadbcm5719-llvm-b7f8eaafa371c1e8b462c470ee4f2001f73e91f8.tar.gz
bcm5719-llvm-b7f8eaafa371c1e8b462c470ee4f2001f73e91f8.zip
Stop computing the number of uses twice per value in CodeGenPrepare's sinking of
addressing code. On 403.gcc this almost halves CodeGenPrepare time and reduces total llc time by 9.5%. Unfortunately, getNumUses() is still the hottest function in llc. llvm-svn: 126782
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp b/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
index 9536939ba2d..5d17e5f8d52 100644
--- a/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
+++ b/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
@@ -701,7 +701,7 @@ bool CodeGenPrepare::OptimizeMemoryInst(Instruction *MemoryInst, Value *Addr,
// the addressing mode obtained from the non-PHI roots of the graph
// are equivalent.
Value *Consensus = 0;
- unsigned NumUses = 0;
+ unsigned NumUsesConsensus = 0;
SmallVector<Instruction*, 16> AddrModeInsts;
ExtAddrMode AddrMode;
while (!worklist.empty()) {
@@ -734,9 +734,10 @@ bool CodeGenPrepare::OptimizeMemoryInst(Instruction *MemoryInst, Value *Addr,
// such root as representative, select the one with the most uses in order
// to keep the cost modeling heuristics in AddressingModeMatcher applicable.
if (!Consensus || NewAddrMode == AddrMode) {
- if (V->getNumUses() > NumUses) {
+ unsigned NumUses = V->getNumUses();
+ if (NumUses > NumUsesConsensus) {
Consensus = V;
- NumUses = V->getNumUses();
+ NumUsesConsensus = NumUses;
AddrMode = NewAddrMode;
AddrModeInsts = NewAddrModeInsts;
}
OpenPOWER on IntegriCloud