Skip to content

Commit 5667100

Browse files
committed
Back out r62958 from the release branch.
llvm-svn: 63791
1 parent 1c1d310 commit 5667100

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

llvm/lib/Analysis/ScalarEvolution.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,17 @@ static SCEVHandle BinomialCoefficient(SCEVHandle It, unsigned K,
585585
}
586586

587587
// We need at least W + T bits for the multiplication step
588-
unsigned CalculationBits = W + T;
588+
// FIXME: A temporary hack; we round up the bitwidths
589+
// to the nearest power of 2 to be nice to the code generator.
590+
unsigned CalculationBits = 1U << Log2_32_Ceil(W + T);
591+
// FIXME: Temporary hack to avoid generating integers that are too wide.
592+
// Although, it's not completely clear how to determine how much
593+
// widening is safe; for example, on X86, we can't really widen
594+
// beyond 64 because we need to be able to do multiplication
595+
// that's CalculationBits wide, but on X86-64, we can safely widen up to
596+
// 128 bits.
597+
if (CalculationBits > 64)
598+
return new SCEVCouldNotCompute();
589599

590600
// Calcuate 2^T, at width T+W.
591601
APInt DivFactor = APInt(CalculationBits, 1).shl(T);

0 commit comments

Comments
 (0)