forked from OSchip/llvm-project
				
			Add a new llcbeta option. This speeds up viterbi from 12.34 to 8.76s on
X86. If happy, I'll enable this by default. llvm-svn: 31493
This commit is contained in:
		
							parent
							
								
									78c84a0328
								
							
						
					
					
						commit
						01d039cc44
					
				| 
						 | 
					@ -59,6 +59,9 @@ namespace {
 | 
				
			||||||
  EnableJoining("join-liveintervals",
 | 
					  EnableJoining("join-liveintervals",
 | 
				
			||||||
                cl::desc("Coallesce copies (default=true)"),
 | 
					                cl::desc("Coallesce copies (default=true)"),
 | 
				
			||||||
                cl::init(true));
 | 
					                cl::init(true));
 | 
				
			||||||
 | 
					  static cl::opt<bool>
 | 
				
			||||||
 | 
					  EnableReweight("enable-majik-f00");
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void LiveIntervals::getAnalysisUsage(AnalysisUsage &AU) const {
 | 
					void LiveIntervals::getAnalysisUsage(AnalysisUsage &AU) const {
 | 
				
			||||||
| 
						 | 
					@ -208,14 +211,26 @@ bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
  for (iterator I = begin(), E = end(); I != E; ++I) {
 | 
					  for (iterator I = begin(), E = end(); I != E; ++I) {
 | 
				
			||||||
    LiveInterval &li = I->second;
 | 
					    LiveInterval &LI = I->second;
 | 
				
			||||||
    if (MRegisterInfo::isVirtualRegister(li.reg)) {
 | 
					    if (MRegisterInfo::isVirtualRegister(LI.reg)) {
 | 
				
			||||||
      // If the live interval length is essentially zero, i.e. in every live
 | 
					      // If the live interval length is essentially zero, i.e. in every live
 | 
				
			||||||
      // range the use follows def immediately, it doesn't make sense to spill
 | 
					      // range the use follows def immediately, it doesn't make sense to spill
 | 
				
			||||||
      // it and hope it will be easier to allocate for this li.
 | 
					      // it and hope it will be easier to allocate for this li.
 | 
				
			||||||
      if (isZeroLengthInterval(&li))
 | 
					      if (isZeroLengthInterval(&LI))
 | 
				
			||||||
        li.weight = float(HUGE_VAL);
 | 
					        LI.weight = float(HUGE_VAL);
 | 
				
			||||||
 | 
					      
 | 
				
			||||||
 | 
					      if (EnableReweight) {
 | 
				
			||||||
 | 
					        // Divide the weight of the interval by its size.  This encourages 
 | 
				
			||||||
 | 
					        // spilling of intervals that are large and have few uses, and
 | 
				
			||||||
 | 
					        // discourages spilling of small intervals with many uses.
 | 
				
			||||||
 | 
					        unsigned Size = 0;
 | 
				
			||||||
 | 
					        for (LiveInterval::iterator II = LI.begin(), E = LI.end(); II != E;++II)
 | 
				
			||||||
 | 
					          Size += II->end - II->start;
 | 
				
			||||||
 | 
					      
 | 
				
			||||||
 | 
					        LI.weight /= Size;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue