summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorJay Foad <jay.foad@gmail.com>2011-03-28 13:03:10 +0000
committerJay Foad <jay.foad@gmail.com>2011-03-28 13:03:10 +0000
commit1c83965f5ac5fe1b37bbb4b57fd9dfa4d78f56b1 (patch)
tree14d582973f51b754198834c3aa5197d29846dd68 /llvm/lib/Transforms
parentcdedaf1f7dfe2c82bf929c36d5378d7855e18fdf (diff)
downloadbcm5719-llvm-1c83965f5ac5fe1b37bbb4b57fd9dfa4d78f56b1.tar.gz
bcm5719-llvm-1c83965f5ac5fe1b37bbb4b57fd9dfa4d78f56b1.zip
Make more use of PHINode::getNumIncomingValues().
llvm-svn: 128406
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp8
-rw-r--r--llvm/lib/Transforms/InstCombine/InstructionCombining.cpp2
2 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp b/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
index 297a18c40a9..2c0714bfc5a 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
+++ b/llvm/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/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index d88162a703f..0c0db3de646 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/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);
OpenPOWER on IntegriCloud