[llvm-commits] [llvm] r129270 - /llvm/trunk/lib/VMCore/Instructions.cpp
Jay Foad
jay.foad at gmail.com
Mon Apr 11 02:25:51 PDT 2011
Author: foad
Date: Mon Apr 11 04:25:51 2011
New Revision: 129270
URL: http://llvm.org/viewvc/llvm-project?rev=129270&view=rev
Log:
Phi nodes always use an even number of operands, so don't ever allocate
an odd number.
Modified:
llvm/trunk/lib/VMCore/Instructions.cpp
Modified: llvm/trunk/lib/VMCore/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=129270&r1=129269&r2=129270&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Instructions.cpp (original)
+++ llvm/trunk/lib/VMCore/Instructions.cpp Mon Apr 11 04:25:51 2011
@@ -137,7 +137,8 @@
///
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;
More information about the llvm-commits
mailing list