|
| 1 | +/*========================== begin_copyright_notice ============================ |
| 2 | + |
| 3 | +Copyright (C) 2021-2023 Intel Corporation |
| 4 | + |
| 5 | +SPDX-License-Identifier: MIT |
| 6 | + |
| 7 | +============================= end_copyright_notice ===========================*/ |
| 8 | + |
| 9 | +/*========================== begin_copyright_notice ============================ |
| 10 | + |
| 11 | +Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 12 | +See https://llvm.org/LICENSE.txt for license information. |
| 13 | +SPDX-License-Identifier: Apache-2.0 with LLVM-exception |
| 14 | + |
| 15 | +============================= end_copyright_notice ===========================*/ |
| 16 | + |
| 17 | +diff --git a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp |
| 18 | +index 9beb2281c..a3cc73ca5 100644 |
| 19 | +--- a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp |
| 20 | ++++ b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp |
| 21 | +@@ -968,7 +968,7 @@ bool llvm::computeUnrollCount( |
| 22 | + // cost of exact full unrolling. As such, if we have an exact count and |
| 23 | + // found it unprofitable, we'll never chose to bounded unroll. |
| 24 | + if (!TripCount && MaxTripCount && (UP.UpperBound || MaxOrZero) && |
| 25 | +- MaxTripCount <= UnrollMaxUpperBound) { |
| 26 | ++ MaxTripCount < std::max(16U, UnrollMaxUpperBound.getValue())) { |
| 27 | + UP.Count = MaxTripCount; |
| 28 | + if (auto UnrollFactor = shouldFullUnroll(L, TTI, DT, SE, EphValues, |
| 29 | + MaxTripCount, UCE, UP)) { |
| 30 | +@@ -1042,7 +1042,8 @@ bool llvm::computeUnrollCount( |
| 31 | + } |
| 32 | + |
| 33 | + // Don't unroll a small upper bound loop unless user or TTI asked to do so. |
| 34 | +- if (MaxTripCount && !UP.Force && MaxTripCount < UnrollMaxUpperBound) { |
| 35 | ++ if (MaxTripCount && !UP.Force && |
| 36 | ++ MaxTripCount < std::max(16U, UnrollMaxUpperBound.getValue())) { |
| 37 | + UP.Count = 0; |
| 38 | + return false; |
| 39 | + } |
0 commit comments