forked from OSchip/llvm-project
				
			Two-address pass should use findCommutedOpIndices to determine what registers are commuted.
llvm-svn: 75317
This commit is contained in:
		
							parent
							
								
									74a7b9188a
								
							
						
					
					
						commit
						b4dfce2dba
					
				| 
						 | 
					@ -909,9 +909,16 @@ bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &MF) {
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          // If it's profitable to commute the instruction, do so.
 | 
					          // If it's profitable to commute the instruction, do so.
 | 
				
			||||||
          if (TID.isCommutable() && mi->getNumOperands() >= 3) {
 | 
					          unsigned SrcOp1, SrcOp2;
 | 
				
			||||||
            unsigned regC = mi->getOperand(3-si).getReg();
 | 
					          if (TID.isCommutable() && mi->getNumOperands() >= 3 &&
 | 
				
			||||||
            if (isProfitableToCommute(regB, regC, mi, mbbi, Dist))
 | 
					              TII->findCommutedOpIndices(mi, SrcOp1, SrcOp2)) {
 | 
				
			||||||
 | 
					            unsigned regC = 0;
 | 
				
			||||||
 | 
					            if (si == SrcOp1)
 | 
				
			||||||
 | 
					              regC = mi->getOperand(SrcOp2).getReg();
 | 
				
			||||||
 | 
					            else if (si == SrcOp2)
 | 
				
			||||||
 | 
					              regC = mi->getOperand(SrcOp1).getReg();
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
 | 
					            if (regC && isProfitableToCommute(regB, regC, mi, mbbi, Dist))
 | 
				
			||||||
              if (CommuteInstruction(mi, mbbi, regB, regC, Dist)) {
 | 
					              if (CommuteInstruction(mi, mbbi, regB, regC, Dist)) {
 | 
				
			||||||
                ++NumAggrCommuted;
 | 
					                ++NumAggrCommuted;
 | 
				
			||||||
                ++NumCommuted;
 | 
					                ++NumCommuted;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue