1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

LoopUnrollPass: Use variable "Threshold" instead of "CurrentThreshold" when

reducing unroll count, otherwise the reduced unroll count is not taking
  the "OptimizeForSize" attribute into account.

llvm-svn: 154007
This commit is contained in:
Hongbin Zheng 2012-04-04 11:44:08 +00:00
parent a323a34d00
commit c50b4781ab

View File

@ -197,13 +197,13 @@ bool LoopUnroll::runOnLoop(Loop *L, LPPassManager &LPM) {
}
if (TripCount) {
// Reduce unroll count to be modulo of TripCount for partial unrolling
Count = CurrentThreshold / LoopSize;
Count = Threshold / LoopSize;
while (Count != 0 && TripCount%Count != 0)
Count--;
}
else if (UnrollRuntime) {
// Reduce unroll count to be a lower power-of-two value
while (Count != 0 && Size > CurrentThreshold) {
while (Count != 0 && Size > Threshold) {
Count >>= 1;
Size = LoopSize*Count;
}