diff options
author | Jay Foad <jay.foad@gmail.com> | 2011-03-28 13:03:10 +0000 |
---|---|---|
committer | Jay Foad <jay.foad@gmail.com> | 2011-03-28 13:03:10 +0000 |
commit | fd4a5497b6a2f9e67187d8ca74659388c52c5427 (patch) | |
tree | 754f1d03778881e278e7e838246fe4b30407569d | |
parent | fb4a8344b6f4be1113498e6e69dc182408dc2ec9 (diff) | |
download | external_llvm-fd4a5497b6a2f9e67187d8ca74659388c52c5427.zip external_llvm-fd4a5497b6a2f9e67187d8ca74659388c52c5427.tar.gz external_llvm-fd4a5497b6a2f9e67187d8ca74659388c52c5427.tar.bz2 |
Make more use of PHINode::getNumIncomingValues().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128406 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/InstCombine/InstCombinePHI.cpp | 8 | ||||
-rw-r--r-- | lib/Transforms/InstCombine/InstructionCombining.cpp | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/Transforms/InstCombine/InstCombinePHI.cpp b/lib/Transforms/InstCombine/InstCombinePHI.cpp index 297a18c..2c0714b 100644 --- a/lib/Transforms/InstCombine/InstCombinePHI.cpp +++ b/lib/Transforms/InstCombine/InstCombinePHI.cpp @@ -82,7 +82,7 @@ Instruction *InstCombiner::FoldPHIArgBinOpIntoPHI(PHINode &PN) { if (LHSVal == 0) { NewLHS = PHINode::Create(LHSType, FirstInst->getOperand(0)->getName() + ".pn"); - NewLHS->reserveOperandSpace(PN.getNumOperands()/2); + NewLHS->reserveOperandSpace(PN.getNumIncomingValues()); NewLHS->addIncoming(InLHS, PN.getIncomingBlock(0)); InsertNewInstBefore(NewLHS, PN); LHSVal = NewLHS; @@ -91,7 +91,7 @@ Instruction *InstCombiner::FoldPHIArgBinOpIntoPHI(PHINode &PN) { if (RHSVal == 0) { NewRHS = PHINode::Create(RHSType, FirstInst->getOperand(1)->getName() + ".pn"); - NewRHS->reserveOperandSpace(PN.getNumOperands()/2); + NewRHS->reserveOperandSpace(PN.getNumIncomingValues()); NewRHS->addIncoming(InRHS, PN.getIncomingBlock(0)); InsertNewInstBefore(NewRHS, PN); RHSVal = NewRHS; @@ -341,7 +341,7 @@ Instruction *InstCombiner::FoldPHIArgLoadIntoPHI(PHINode &PN) { // correct type, and PHI together all of the LHS's of the instructions. PHINode *NewPN = PHINode::Create(FirstLI->getOperand(0)->getType(), PN.getName()+".in"); - NewPN->reserveOperandSpace(PN.getNumOperands()/2); + NewPN->reserveOperandSpace(PN.getNumIncomingValues()); Value *InVal = FirstLI->getOperand(0); NewPN->addIncoming(InVal, PN.getIncomingBlock(0)); @@ -447,7 +447,7 @@ Instruction *InstCombiner::FoldPHIArgOpIntoPHI(PHINode &PN) { // correct type, and PHI together all of the LHS's of the instructions. PHINode *NewPN = PHINode::Create(FirstInst->getOperand(0)->getType(), PN.getName()+".in"); - NewPN->reserveOperandSpace(PN.getNumOperands()/2); + NewPN->reserveOperandSpace(PN.getNumIncomingValues()); Value *InVal = FirstInst->getOperand(0); NewPN->addIncoming(InVal, PN.getIncomingBlock(0)); diff --git a/lib/Transforms/InstCombine/InstructionCombining.cpp b/lib/Transforms/InstCombine/InstructionCombining.cpp index d88162a..0c0db3d 100644 --- a/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -601,7 +601,7 @@ Instruction *InstCombiner::FoldOpIntoPhi(Instruction &I) { // Okay, we can do the transformation: create the new PHI node. PHINode *NewPN = PHINode::Create(I.getType(), ""); - NewPN->reserveOperandSpace(PN->getNumOperands()/2); + NewPN->reserveOperandSpace(PN->getNumIncomingValues()); InsertNewInstBefore(NewPN, *PN); NewPN->takeName(PN); |