aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore
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
commit4e9b0e3587dd6e72589e13b3d0ebadb06cf72fb2 (patch)
tree77c4212af0759d4f257a11a70f39cf3037369481 /lib/VMCore
parentee69926b10b5b311c5b7cfd0c477569ad18d005c (diff)
Phi nodes always use an even number of operands, so don't ever allocate
an odd number. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129270 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/Instructions.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp
index 33dfcc032a..61da9b6b8e 100644
--- a/lib/VMCore/Instructions.cpp
+++ b/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;