mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-25 17:20:48 +00:00
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
This commit is contained in:
@@ -701,7 +701,7 @@ bool CodeGenPrepare::OptimizeMemoryInst(Instruction *MemoryInst, Value *Addr,
|
|||||||
// the addressing mode obtained from the non-PHI roots of the graph
|
// the addressing mode obtained from the non-PHI roots of the graph
|
||||||
// are equivalent.
|
// are equivalent.
|
||||||
Value *Consensus = 0;
|
Value *Consensus = 0;
|
||||||
unsigned NumUses = 0;
|
unsigned NumUsesConsensus = 0;
|
||||||
SmallVector<Instruction*, 16> AddrModeInsts;
|
SmallVector<Instruction*, 16> AddrModeInsts;
|
||||||
ExtAddrMode AddrMode;
|
ExtAddrMode AddrMode;
|
||||||
while (!worklist.empty()) {
|
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
|
// such root as representative, select the one with the most uses in order
|
||||||
// to keep the cost modeling heuristics in AddressingModeMatcher applicable.
|
// to keep the cost modeling heuristics in AddressingModeMatcher applicable.
|
||||||
if (!Consensus || NewAddrMode == AddrMode) {
|
if (!Consensus || NewAddrMode == AddrMode) {
|
||||||
if (V->getNumUses() > NumUses) {
|
unsigned NumUses = V->getNumUses();
|
||||||
|
if (NumUses > NumUsesConsensus) {
|
||||||
Consensus = V;
|
Consensus = V;
|
||||||
NumUses = V->getNumUses();
|
NumUsesConsensus = NumUses;
|
||||||
AddrMode = NewAddrMode;
|
AddrMode = NewAddrMode;
|
||||||
AddrModeInsts = NewAddrModeInsts;
|
AddrModeInsts = NewAddrModeInsts;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user