1//===- LoopRotationUtils.h - Utilities to perform loop rotation -*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file provides utilities to convert a loop into a loop with bottom test.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_TRANSFORMS_UTILS_LOOPROTATIONUTILS_H
14#define LLVM_TRANSFORMS_UTILS_LOOPROTATIONUTILS_H
15
16namespace llvm {
17
18class AssumptionCache;
19class DominatorTree;
20class Loop;
21class LoopInfo;
22class MemorySSAUpdater;
23class ScalarEvolution;
24struct SimplifyQuery;
25class TargetTransformInfo;
26
27/// Convert a loop into a loop with bottom test. It may
28/// perform loop latch simplication as well if the flag RotationOnly
29/// is false. The flag Threshold represents the size threshold of the loop
30/// header. If the loop header's size exceeds the threshold, the loop rotation
31/// will give up. The flag IsUtilMode controls the heuristic used in the
32/// LoopRotation. If it is true, the profitability heuristic will be ignored.
33bool LoopRotation(Loop *L, LoopInfo *LI, const TargetTransformInfo *TTI,
34 AssumptionCache *AC, DominatorTree *DT, ScalarEvolution *SE,
35 MemorySSAUpdater *MSSAU, const SimplifyQuery &SQ,
36 bool RotationOnly, unsigned Threshold, bool IsUtilMode,
37 bool PrepareForLTO = false);
38
39} // namespace llvm
40
41#endif
42