Index: lib/Transforms/Utils/LoopUnrollPeel.cpp =================================================================== --- lib/Transforms/Utils/LoopUnrollPeel.cpp +++ lib/Transforms/Utils/LoopUnrollPeel.cpp @@ -71,6 +71,10 @@ if (!L->empty()) return; + // Can we peel at least one iteration? + if (LoopSize > UP.Threshold) + return; + // Try to find a Phi node that has the same loop invariant as an input from // its only back edge. If there is such Phi, peeling 1 iteration from the // loop is profitable, because starting from 2nd iteration we will have an