Debian Codegraph @

external/llvm/releases/12.0.0/patches_external/alter-unroll-max-upperbound-command-line-option-value.patch

raw
1 /*========================== begin_copyright_notice ============================
2
3 Copyright (C) 2021 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 1b974576a3cc..8324662aadd5 100644
19 --- a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
20 +++ b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
21 @@ -810,7 +810,7 @@ bool llvm::computeUnrollCount(
22 // In addition we only unroll small upper bounds.
23 unsigned FullUnrollMaxTripCount = MaxTripCount;
24 if (!(UP.UpperBound || MaxOrZero) ||
25 - FullUnrollMaxTripCount > UnrollMaxUpperBound)
26 + FullUnrollMaxTripCount > std::max(16U, UnrollMaxUpperBound.getValue()))
27 FullUnrollMaxTripCount = 0;
28
29 // UnrollByMaxCount and ExactTripCount cannot both be non zero since we only
30 @@ -941,7 +941,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 }