зеркало из https://github.com/microsoft/clang.git
Remove PHINode::reserveOperandSpace(). Instead, add a parameter to
PHINode::Create() giving the (known or expected) number of operands. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128538 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
6be56729a8
Коммит
bbf3bacb3e
|
@ -473,9 +473,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
|
|||
BasicBlock *End = createBasicBlock("fpclassify_end", this->CurFn);
|
||||
Builder.SetInsertPoint(End);
|
||||
PHINode *Result =
|
||||
Builder.CreatePHI(ConvertType(E->getArg(0)->getType()),
|
||||
Builder.CreatePHI(ConvertType(E->getArg(0)->getType()), 4,
|
||||
"fpclassify_result");
|
||||
Result->reserveOperandSpace(4);
|
||||
|
||||
// if (V==0) return FP_ZERO
|
||||
Builder.SetInsertPoint(Begin);
|
||||
|
|
|
@ -207,8 +207,7 @@ CodeGenFunction::GetAddressOfBaseClass(llvm::Value *Value,
|
|||
Builder.CreateBr(CastEnd);
|
||||
EmitBlock(CastEnd);
|
||||
|
||||
llvm::PHINode *PHI = Builder.CreatePHI(Value->getType());
|
||||
PHI->reserveOperandSpace(2);
|
||||
llvm::PHINode *PHI = Builder.CreatePHI(Value->getType(), 2);
|
||||
PHI->addIncoming(Value, CastNotNull);
|
||||
PHI->addIncoming(llvm::Constant::getNullValue(Value->getType()),
|
||||
CastNull);
|
||||
|
@ -268,8 +267,7 @@ CodeGenFunction::GetAddressOfDerivedClass(llvm::Value *Value,
|
|||
Builder.CreateBr(CastEnd);
|
||||
EmitBlock(CastEnd);
|
||||
|
||||
llvm::PHINode *PHI = Builder.CreatePHI(Value->getType());
|
||||
PHI->reserveOperandSpace(2);
|
||||
llvm::PHINode *PHI = Builder.CreatePHI(Value->getType(), 2);
|
||||
PHI->addIncoming(Value, CastNotNull);
|
||||
PHI->addIncoming(llvm::Constant::getNullValue(Value->getType()),
|
||||
CastNull);
|
||||
|
|
|
@ -1765,9 +1765,8 @@ EmitConditionalOperatorLValue(const AbstractConditionalOperator *expr) {
|
|||
|
||||
EmitBlock(contBlock);
|
||||
|
||||
llvm::PHINode *phi = Builder.CreatePHI(lhs.getAddress()->getType(),
|
||||
llvm::PHINode *phi = Builder.CreatePHI(lhs.getAddress()->getType(), 2,
|
||||
"cond-lvalue");
|
||||
phi->reserveOperandSpace(2);
|
||||
phi->addIncoming(lhs.getAddress(), lhsBlock);
|
||||
phi->addIncoming(rhs.getAddress(), rhsBlock);
|
||||
return MakeAddrLValue(phi, expr->getType());
|
||||
|
|
|
@ -1053,8 +1053,7 @@ llvm::Value *CodeGenFunction::EmitCXXNewExpr(const CXXNewExpr *E) {
|
|||
llvm::BasicBlock *notNullBB = Builder.GetInsertBlock();
|
||||
EmitBlock(contBB);
|
||||
|
||||
llvm::PHINode *PHI = Builder.CreatePHI(result->getType());
|
||||
PHI->reserveOperandSpace(2);
|
||||
llvm::PHINode *PHI = Builder.CreatePHI(result->getType(), 2);
|
||||
PHI->addIncoming(result, notNullBB);
|
||||
PHI->addIncoming(llvm::Constant::getNullValue(result->getType()),
|
||||
nullCheckBB);
|
||||
|
@ -1474,8 +1473,7 @@ llvm::Value *CodeGenFunction::EmitDynamicCast(llvm::Value *V,
|
|||
}
|
||||
EmitBlock(ContBlock);
|
||||
if (CanBeZero) {
|
||||
llvm::PHINode *PHI = Builder.CreatePHI(LTy);
|
||||
PHI->reserveOperandSpace(2);
|
||||
llvm::PHINode *PHI = Builder.CreatePHI(LTy, 2);
|
||||
PHI->addIncoming(V, NonZeroBlock);
|
||||
PHI->addIncoming(llvm::Constant::getNullValue(LTy), NullBlock);
|
||||
V = PHI;
|
||||
|
|
|
@ -668,14 +668,12 @@ VisitAbstractConditionalOperator(const AbstractConditionalOperator *E) {
|
|||
eval.end(CGF);
|
||||
|
||||
// Create a PHI node for the real part.
|
||||
llvm::PHINode *RealPN = Builder.CreatePHI(LHS.first->getType(), "cond.r");
|
||||
RealPN->reserveOperandSpace(2);
|
||||
llvm::PHINode *RealPN = Builder.CreatePHI(LHS.first->getType(), 2, "cond.r");
|
||||
RealPN->addIncoming(LHS.first, LHSBlock);
|
||||
RealPN->addIncoming(RHS.first, RHSBlock);
|
||||
|
||||
// Create a PHI node for the imaginary part.
|
||||
llvm::PHINode *ImagPN = Builder.CreatePHI(LHS.first->getType(), "cond.i");
|
||||
ImagPN->reserveOperandSpace(2);
|
||||
llvm::PHINode *ImagPN = Builder.CreatePHI(LHS.first->getType(), 2, "cond.i");
|
||||
ImagPN->addIncoming(LHS.second, LHSBlock);
|
||||
ImagPN->addIncoming(RHS.second, RHSBlock);
|
||||
|
||||
|
|
|
@ -1817,8 +1817,7 @@ Value *ScalarExprEmitter::EmitOverflowCheckedBinOp(const BinOpInfo &Ops) {
|
|||
Builder.CreateBr(continueBB);
|
||||
|
||||
Builder.SetInsertPoint(continueBB);
|
||||
llvm::PHINode *phi = Builder.CreatePHI(opTy);
|
||||
phi->reserveOperandSpace(2);
|
||||
llvm::PHINode *phi = Builder.CreatePHI(opTy, 2);
|
||||
phi->addIncoming(result, initialBB);
|
||||
phi->addIncoming(handlerResult, overflowBB);
|
||||
|
||||
|
@ -2300,9 +2299,8 @@ Value *ScalarExprEmitter::VisitBinLAnd(const BinaryOperator *E) {
|
|||
// Any edges into the ContBlock are now from an (indeterminate number of)
|
||||
// edges from this first condition. All of these values will be false. Start
|
||||
// setting up the PHI node in the Cont Block for this.
|
||||
llvm::PHINode *PN = llvm::PHINode::Create(llvm::Type::getInt1Ty(VMContext),
|
||||
llvm::PHINode *PN = llvm::PHINode::Create(llvm::Type::getInt1Ty(VMContext), 2,
|
||||
"", ContBlock);
|
||||
PN->reserveOperandSpace(2); // Normal case, two inputs.
|
||||
for (llvm::pred_iterator PI = pred_begin(ContBlock), PE = pred_end(ContBlock);
|
||||
PI != PE; ++PI)
|
||||
PN->addIncoming(llvm::ConstantInt::getFalse(VMContext), *PI);
|
||||
|
@ -2356,9 +2354,8 @@ Value *ScalarExprEmitter::VisitBinLOr(const BinaryOperator *E) {
|
|||
// Any edges into the ContBlock are now from an (indeterminate number of)
|
||||
// edges from this first condition. All of these values will be true. Start
|
||||
// setting up the PHI node in the Cont Block for this.
|
||||
llvm::PHINode *PN = llvm::PHINode::Create(llvm::Type::getInt1Ty(VMContext),
|
||||
llvm::PHINode *PN = llvm::PHINode::Create(llvm::Type::getInt1Ty(VMContext), 2,
|
||||
"", ContBlock);
|
||||
PN->reserveOperandSpace(2); // Normal case, two inputs.
|
||||
for (llvm::pred_iterator PI = pred_begin(ContBlock), PE = pred_end(ContBlock);
|
||||
PI != PE; ++PI)
|
||||
PN->addIncoming(llvm::ConstantInt::getTrue(VMContext), *PI);
|
||||
|
@ -2532,8 +2529,7 @@ VisitAbstractConditionalOperator(const AbstractConditionalOperator *E) {
|
|||
return LHS;
|
||||
|
||||
// Create a PHI node for the real part.
|
||||
llvm::PHINode *PN = Builder.CreatePHI(LHS->getType(), "cond");
|
||||
PN->reserveOperandSpace(2);
|
||||
llvm::PHINode *PN = Builder.CreatePHI(LHS->getType(), 2, "cond");
|
||||
PN->addIncoming(LHS, LHSBlock);
|
||||
PN->addIncoming(RHS, RHSBlock);
|
||||
return PN;
|
||||
|
|
|
@ -830,13 +830,11 @@ void CodeGenFunction::EmitObjCForCollectionStmt(const ObjCForCollectionStmt &S){
|
|||
EmitBlock(LoopBodyBB);
|
||||
|
||||
// The current index into the buffer.
|
||||
llvm::PHINode *index = Builder.CreatePHI(UnsignedLongLTy, "forcoll.index");
|
||||
index->reserveOperandSpace(3);
|
||||
llvm::PHINode *index = Builder.CreatePHI(UnsignedLongLTy, 3, "forcoll.index");
|
||||
index->addIncoming(zero, LoopInitBB);
|
||||
|
||||
// The current buffer size.
|
||||
llvm::PHINode *count = Builder.CreatePHI(UnsignedLongLTy, "forcoll.count");
|
||||
count->reserveOperandSpace(3);
|
||||
llvm::PHINode *count = Builder.CreatePHI(UnsignedLongLTy, 3, "forcoll.count");
|
||||
count->addIncoming(initialBufferLimit, LoopInitBB);
|
||||
|
||||
// Check whether the mutations value has changed from where it was
|
||||
|
|
|
@ -1144,32 +1144,28 @@ CGObjCGNU::GenerateMessageSend(CodeGenFunction &CGF,
|
|||
CGF.EmitBlock(continueBB);
|
||||
if (msgRet.isScalar()) {
|
||||
llvm::Value *v = msgRet.getScalarVal();
|
||||
llvm::PHINode *phi = Builder.CreatePHI(v->getType());
|
||||
phi->reserveOperandSpace(2);
|
||||
llvm::PHINode *phi = Builder.CreatePHI(v->getType(), 2);
|
||||
phi->addIncoming(v, messageBB);
|
||||
phi->addIncoming(llvm::Constant::getNullValue(v->getType()), startBB);
|
||||
msgRet = RValue::get(phi);
|
||||
} else if (msgRet.isAggregate()) {
|
||||
llvm::Value *v = msgRet.getAggregateAddr();
|
||||
llvm::PHINode *phi = Builder.CreatePHI(v->getType());
|
||||
llvm::PHINode *phi = Builder.CreatePHI(v->getType(), 2);
|
||||
const llvm::PointerType *RetTy = cast<llvm::PointerType>(v->getType());
|
||||
llvm::AllocaInst *NullVal =
|
||||
CGF.CreateTempAlloca(RetTy->getElementType(), "null");
|
||||
CGF.InitTempAlloca(NullVal,
|
||||
llvm::Constant::getNullValue(RetTy->getElementType()));
|
||||
phi->reserveOperandSpace(2);
|
||||
phi->addIncoming(v, messageBB);
|
||||
phi->addIncoming(NullVal, startBB);
|
||||
msgRet = RValue::getAggregate(phi);
|
||||
} else /* isComplex() */ {
|
||||
std::pair<llvm::Value*,llvm::Value*> v = msgRet.getComplexVal();
|
||||
llvm::PHINode *phi = Builder.CreatePHI(v.first->getType());
|
||||
phi->reserveOperandSpace(2);
|
||||
llvm::PHINode *phi = Builder.CreatePHI(v.first->getType(), 2);
|
||||
phi->addIncoming(v.first, messageBB);
|
||||
phi->addIncoming(llvm::Constant::getNullValue(v.first->getType()),
|
||||
startBB);
|
||||
llvm::PHINode *phi2 = Builder.CreatePHI(v.second->getType());
|
||||
phi2->reserveOperandSpace(2);
|
||||
llvm::PHINode *phi2 = Builder.CreatePHI(v.second->getType(), 2);
|
||||
phi2->addIncoming(v.second, messageBB);
|
||||
phi2->addIncoming(llvm::Constant::getNullValue(v.second->getType()),
|
||||
startBB);
|
||||
|
|
|
@ -2689,8 +2689,7 @@ void CodeGenFunction::GenerateThunk(llvm::Function *Fn,
|
|||
Builder.CreateBr(AdjustEnd);
|
||||
EmitBlock(AdjustEnd);
|
||||
|
||||
llvm::PHINode *PHI = Builder.CreatePHI(ReturnValue->getType());
|
||||
PHI->reserveOperandSpace(2);
|
||||
llvm::PHINode *PHI = Builder.CreatePHI(ReturnValue->getType(), 2);
|
||||
PHI->addIncoming(ReturnValue, AdjustNotNull);
|
||||
PHI->addIncoming(llvm::Constant::getNullValue(ReturnValue->getType()),
|
||||
AdjustNull);
|
||||
|
|
|
@ -618,8 +618,7 @@ static void emitNonZeroVLAInit(CodeGenFunction &CGF, QualType baseType,
|
|||
// count must be nonzero.
|
||||
CGF.EmitBlock(loopBB);
|
||||
|
||||
llvm::PHINode *cur = Builder.CreatePHI(i8p, "vla.cur");
|
||||
cur->reserveOperandSpace(2);
|
||||
llvm::PHINode *cur = Builder.CreatePHI(i8p, 2, "vla.cur");
|
||||
cur->addIncoming(begin, originBB);
|
||||
|
||||
// memcpy the individual element bit-pattern.
|
||||
|
@ -729,7 +728,8 @@ llvm::BasicBlock *CodeGenFunction::GetIndirectGotoBlock() {
|
|||
CGBuilderTy TmpBuilder(createBasicBlock("indirectgoto"));
|
||||
|
||||
// Create the PHI node that indirect gotos will add entries to.
|
||||
llvm::Value *DestVal = TmpBuilder.CreatePHI(Int8PtrTy, "indirect.goto.dest");
|
||||
llvm::Value *DestVal = TmpBuilder.CreatePHI(Int8PtrTy, 0,
|
||||
"indirect.goto.dest");
|
||||
|
||||
// Create the indirect branch instruction.
|
||||
IndirectBranch = TmpBuilder.CreateIndirectBr(DestVal);
|
||||
|
|
|
@ -282,8 +282,7 @@ ItaniumCXXABI::EmitLoadOfMemberFunctionPointer(CodeGenFunction &CGF,
|
|||
|
||||
// We're done.
|
||||
CGF.EmitBlock(FnEnd);
|
||||
llvm::PHINode *Callee = Builder.CreatePHI(FTy->getPointerTo());
|
||||
Callee->reserveOperandSpace(2);
|
||||
llvm::PHINode *Callee = Builder.CreatePHI(FTy->getPointerTo(), 2);
|
||||
Callee->addIncoming(VirtualFn, FnVirtual);
|
||||
Callee->addIncoming(NonVirtualFn, FnNonVirtual);
|
||||
return Callee;
|
||||
|
|
|
@ -2082,9 +2082,8 @@ llvm::Value *X86_64ABIInfo::EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
|
|||
// Return the appropriate result.
|
||||
|
||||
CGF.EmitBlock(ContBlock);
|
||||
llvm::PHINode *ResAddr = CGF.Builder.CreatePHI(RegAddr->getType(),
|
||||
llvm::PHINode *ResAddr = CGF.Builder.CreatePHI(RegAddr->getType(), 2,
|
||||
"vaarg.addr");
|
||||
ResAddr->reserveOperandSpace(2);
|
||||
ResAddr->addIncoming(RegAddr, InRegBlock);
|
||||
ResAddr->addIncoming(MemAddr, InMemBlock);
|
||||
return ResAddr;
|
||||
|
|
Загрузка…
Ссылка в новой задаче