diff options
author | Cameron Zwarich <zwarich@apple.com> | 2011-03-01 21:13:53 +0000 |
---|---|---|
committer | Cameron Zwarich <zwarich@apple.com> | 2011-03-01 21:13:53 +0000 |
commit | 4c078f0d6df6136cbbcf581c254869051d455fdc (patch) | |
tree | 08c0ca619952b9631bf3777a2ea1e1975b13b982 /lib | |
parent | 22a1df6bf24c188dd637a0bb2cf9a2648806b6b1 (diff) | |
download | external_llvm-4c078f0d6df6136cbbcf581c254869051d455fdc.zip external_llvm-4c078f0d6df6136cbbcf581c254869051d455fdc.tar.gz external_llvm-4c078f0d6df6136cbbcf581c254869051d455fdc.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126782 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Scalar/CodeGenPrepare.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Transforms/Scalar/CodeGenPrepare.cpp b/lib/Transforms/Scalar/CodeGenPrepare.cpp index 9536939..5d17e5f 100644 --- a/lib/Transforms/Scalar/CodeGenPrepare.cpp +++ b/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; } |