mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-11-04 05:17:07 +00:00 
			
		
		
		
	Switch more inst insertion in instcombine to IRBuilder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131544 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
		@@ -751,27 +751,20 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
 | 
				
			|||||||
            // So at this point we know we have (Y -> OtherAddOp):
 | 
					            // So at this point we know we have (Y -> OtherAddOp):
 | 
				
			||||||
            //        select C, (add X, Y), (sub X, Z)
 | 
					            //        select C, (add X, Y), (sub X, Z)
 | 
				
			||||||
            Value *NegVal;  // Compute -Z
 | 
					            Value *NegVal;  // Compute -Z
 | 
				
			||||||
            if (Constant *C = dyn_cast<Constant>(SubOp->getOperand(1))) {
 | 
					            if (SI.getType()->isFloatingPointTy()) {
 | 
				
			||||||
              NegVal = ConstantExpr::getNeg(C);
 | 
					              NegVal = Builder->CreateFNeg(SubOp->getOperand(1));
 | 
				
			||||||
            } else if (SI.getType()->isFloatingPointTy()) {
 | 
					 | 
				
			||||||
              NegVal = InsertNewInstBefore(
 | 
					 | 
				
			||||||
                    BinaryOperator::CreateFNeg(SubOp->getOperand(1),
 | 
					 | 
				
			||||||
                                              "tmp"), SI);
 | 
					 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
              NegVal = InsertNewInstBefore(
 | 
					              NegVal = Builder->CreateNeg(SubOp->getOperand(1));
 | 
				
			||||||
                    BinaryOperator::CreateNeg(SubOp->getOperand(1),
 | 
					 | 
				
			||||||
                                              "tmp"), SI);
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            Value *NewTrueOp = OtherAddOp;
 | 
					            Value *NewTrueOp = OtherAddOp;
 | 
				
			||||||
            Value *NewFalseOp = NegVal;
 | 
					            Value *NewFalseOp = NegVal;
 | 
				
			||||||
            if (AddOp != TI)
 | 
					            if (AddOp != TI)
 | 
				
			||||||
              std::swap(NewTrueOp, NewFalseOp);
 | 
					              std::swap(NewTrueOp, NewFalseOp);
 | 
				
			||||||
            Instruction *NewSel =
 | 
					            Value *NewSel = 
 | 
				
			||||||
              SelectInst::Create(CondVal, NewTrueOp,
 | 
					              Builder->CreateSelect(CondVal, NewTrueOp,
 | 
				
			||||||
                                    NewFalseOp, SI.getName() + ".p");
 | 
					                                    NewFalseOp, SI.getName() + ".p");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            NewSel = InsertNewInstBefore(NewSel, SI);
 | 
					 | 
				
			||||||
            if (SI.getType()->isFloatingPointTy())
 | 
					            if (SI.getType()->isFloatingPointTy())
 | 
				
			||||||
              return BinaryOperator::CreateFAdd(SubOp->getOperand(0), NewSel);
 | 
					              return BinaryOperator::CreateFAdd(SubOp->getOperand(0), NewSel);
 | 
				
			||||||
            else
 | 
					            else
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user