forked from OSchip/llvm-project
				
			Trivially re-materializable instructions have spill weights that are half of what it would be otherwise.
llvm-svn: 35658
This commit is contained in:
		
							parent
							
								
									12e2843475
								
							
						
					
					
						commit
						2bf2aadd9a
					
				| 
						 | 
					@ -164,13 +164,13 @@ bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) {
 | 
				
			||||||
            unsigned reg = rep(mop.getReg());
 | 
					            unsigned reg = rep(mop.getReg());
 | 
				
			||||||
            mii->getOperand(i).setReg(reg);
 | 
					            mii->getOperand(i).setReg(reg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // If the definition instruction is re-materializable, its spill
 | 
					 | 
				
			||||||
            // weight is zero.
 | 
					 | 
				
			||||||
            LiveInterval &RegInt = getInterval(reg);
 | 
					            LiveInterval &RegInt = getInterval(reg);
 | 
				
			||||||
            if (!RegInt.remat) {
 | 
					            float w = (mop.isUse()+mop.isDef()) * powf(10.0F, (float)loopDepth);
 | 
				
			||||||
              RegInt.weight +=
 | 
					            // If the definition instruction is re-materializable, its spill
 | 
				
			||||||
                (mop.isUse() + mop.isDef()) * pow(10.0F, (int)loopDepth);
 | 
					            // weight is half of what it would have been normally.
 | 
				
			||||||
            }
 | 
					            if (RegInt.remat)
 | 
				
			||||||
 | 
					              w /= 2;
 | 
				
			||||||
 | 
					            RegInt.weight += w;
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        ++mii;
 | 
					        ++mii;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue