mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-10-30 16:17:05 +00:00 
			
		
		
		
	Switch more inst insertion in instcombine to IRBuilder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131547 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
		| @@ -133,9 +133,8 @@ Instruction *InstCombiner::FoldSelectOpOp(SelectInst &SI, Instruction *TI, | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     // Fold this by inserting a select from the input values. |     // Fold this by inserting a select from the input values. | ||||||
|     SelectInst *NewSI = SelectInst::Create(SI.getCondition(), TI->getOperand(0), |     Value *NewSI = Builder->CreateSelect(SI.getCondition(), TI->getOperand(0), | ||||||
|                                          FI->getOperand(0), SI.getName()+".v"); |                                          FI->getOperand(0), SI.getName()+".v"); | ||||||
|     InsertNewInstBefore(NewSI, SI); |  | ||||||
|     return CastInst::Create(Instruction::CastOps(TI->getOpcode()), NewSI, |     return CastInst::Create(Instruction::CastOps(TI->getOpcode()), NewSI, | ||||||
|                             TI->getType()); |                             TI->getType()); | ||||||
|   } |   } | ||||||
| @@ -174,9 +173,8 @@ Instruction *InstCombiner::FoldSelectOpOp(SelectInst &SI, Instruction *TI, | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   // If we reach here, they do have operations in common. |   // If we reach here, they do have operations in common. | ||||||
|   SelectInst *NewSI = SelectInst::Create(SI.getCondition(), OtherOpT, |   Value *NewSI = Builder->CreateSelect(SI.getCondition(), OtherOpT, | ||||||
|                                        OtherOpF, SI.getName()+".v"); |                                        OtherOpF, SI.getName()+".v"); | ||||||
|   InsertNewInstBefore(NewSI, SI); |  | ||||||
|  |  | ||||||
|   if (BinaryOperator *BO = dyn_cast<BinaryOperator>(TI)) { |   if (BinaryOperator *BO = dyn_cast<BinaryOperator>(TI)) { | ||||||
|     if (MatchIsOpZero) |     if (MatchIsOpZero) | ||||||
| @@ -224,8 +222,7 @@ Instruction *InstCombiner::FoldSelectIntoOp(SelectInst &SI, Value *TrueVal, | |||||||
|           // Avoid creating select between 2 constants unless it's selecting |           // Avoid creating select between 2 constants unless it's selecting | ||||||
|           // between 0, 1 and -1. |           // between 0, 1 and -1. | ||||||
|           if (!isa<Constant>(OOp) || isSelect01(C, cast<Constant>(OOp))) { |           if (!isa<Constant>(OOp) || isSelect01(C, cast<Constant>(OOp))) { | ||||||
|             Instruction *NewSel = SelectInst::Create(SI.getCondition(), OOp, C); |             Value *NewSel = Builder->CreateSelect(SI.getCondition(), OOp, C); | ||||||
|             InsertNewInstBefore(NewSel, SI); |  | ||||||
|             NewSel->takeName(TVI); |             NewSel->takeName(TVI); | ||||||
|             BinaryOperator *TVI_BO = cast<BinaryOperator>(TVI); |             BinaryOperator *TVI_BO = cast<BinaryOperator>(TVI); | ||||||
|             BinaryOperator *BO = BinaryOperator::Create(TVI_BO->getOpcode(), |             BinaryOperator *BO = BinaryOperator::Create(TVI_BO->getOpcode(), | ||||||
| @@ -260,8 +257,7 @@ Instruction *InstCombiner::FoldSelectIntoOp(SelectInst &SI, Value *TrueVal, | |||||||
|           // Avoid creating select between 2 constants unless it's selecting |           // Avoid creating select between 2 constants unless it's selecting | ||||||
|           // between 0, 1 and -1. |           // between 0, 1 and -1. | ||||||
|           if (!isa<Constant>(OOp) || isSelect01(C, cast<Constant>(OOp))) { |           if (!isa<Constant>(OOp) || isSelect01(C, cast<Constant>(OOp))) { | ||||||
|             Instruction *NewSel = SelectInst::Create(SI.getCondition(), C, OOp); |             Value *NewSel = Builder->CreateSelect(SI.getCondition(), C, OOp); | ||||||
|             InsertNewInstBefore(NewSel, SI); |  | ||||||
|             NewSel->takeName(FVI); |             NewSel->takeName(FVI); | ||||||
|             BinaryOperator *FVI_BO = cast<BinaryOperator>(FVI); |             BinaryOperator *FVI_BO = cast<BinaryOperator>(FVI); | ||||||
|             BinaryOperator *BO = BinaryOperator::Create(FVI_BO->getOpcode(), |             BinaryOperator *BO = BinaryOperator::Create(FVI_BO->getOpcode(), | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user