summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorJay Foad <jay.foad@gmail.com>2011-04-11 09:25:51 +0000
committerJay Foad <jay.foad@gmail.com>2011-04-11 09:25:51 +0000
commit29426e87c17c523e220c93ba0b063fa6427c2565 (patch)
tree366912ed71a9649669a61ea6caad48a15469a9dc /llvm/lib
parent2d2e870745c22a05a173e1fcec85e57535b5314b (diff)
downloadbcm5719-llvm-29426e87c17c523e220c93ba0b063fa6427c2565.tar.gz
bcm5719-llvm-29426e87c17c523e220c93ba0b063fa6427c2565.zip
Phi nodes always use an even number of operands, so don't ever allocate
an odd number. llvm-svn: 129270
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/VMCore/Instructions.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/VMCore/Instructions.cpp b/llvm/lib/VMCore/Instructions.cpp
index 33dfcc032af..61da9b6b8e0 100644
--- a/llvm/lib/VMCore/Instructions.cpp
+++ b/llvm/lib/VMCore/Instructions.cpp
@@ -137,7 +137,8 @@ Value *PHINode::removeIncomingValue(unsigned Idx, bool DeletePHIIfEmpty) {
///
void PHINode::growOperands() {
unsigned e = getNumOperands();
- unsigned NumOps = e*3/2;
+ // Multiply by 1.5 and round down so the result is still even.
+ unsigned NumOps = e + e / 4 * 2;
if (NumOps < 4) NumOps = 4; // 4 op PHI nodes are VERY common.
ReservedSpace = NumOps;
OpenPOWER on IntegriCloud