LLVM 23.0.0git
LoopPeel.h
Go to the documentation of this file.
1//===- llvm/Transforms/Utils/LoopPeel.h ----- Peeling utilities -*- 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 defines some loop peeling utilities. It does not define any
10// actual pass or policy.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_TRANSFORMS_UTILS_LOOPPEEL_H
15#define LLVM_TRANSFORMS_UTILS_LOOPPEEL_H
16
19
20namespace llvm {
21
22LLVM_ABI bool canPeel(const Loop *L);
23
24/// Returns true if the last iteration of \p L can be peeled off. It makes sure
25/// the loop exit condition can be adjusted when peeling and that the loop
26/// executes at least 2 iterations.
28
29/// VMap is the value-map that maps instructions from the original loop to
30/// instructions in the last peeled-off iteration. If \p PeelLast is true, peel
31/// off the last \p PeelCount iterations from \p L (canPeelLastIteration must be
32/// true for \p L), otherwise peel off the first \p PeelCount iterations.
33LLVM_ABI void peelLoop(Loop *L, unsigned PeelCount, bool PeelLast, LoopInfo *LI,
35 AssumptionCache *AC, bool PreserveLCSSA,
36 ValueToValueMapTy &VMap);
37
41 std::optional<bool> UserAllowPeeling,
42 std::optional<bool> UserAllowProfileBasedPeeling,
43 bool UnrollingSpecficValues = false);
44
45LLVM_ABI void computePeelCount(Loop *L, unsigned LoopSize,
47 unsigned TripCount, DominatorTree &DT,
50 AssumptionCache *AC = nullptr,
51 unsigned Threshold = UINT_MAX);
52
53} // end namespace llvm
54
55#endif // LLVM_TRANSFORMS_UTILS_LOOPPEEL_H
#define LLVM_ABI
Definition Compiler.h:213
This pass exposes codegen information to IR-level passes.
A cache of @llvm.assume calls within a function.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
Definition Dominators.h:155
Represents a single loop in the control flow graph.
Definition LoopInfo.h:40
The main scalar evolution driver.
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI bool canPeel(const Loop *L)
Definition LoopPeel.cpp:97
LLVM_ABI bool canPeelLastIteration(const Loop &L, ScalarEvolution &SE)
Returns true if the last iteration of L can be peeled off.
Definition LoopPeel.cpp:481
LLVM_ABI TargetTransformInfo::PeelingPreferences gatherPeelingPreferences(Loop *L, ScalarEvolution &SE, const TargetTransformInfo &TTI, std::optional< bool > UserAllowPeeling, std::optional< bool > UserAllowProfileBasedPeeling, bool UnrollingSpecficValues=false)
LLVM_ABI void computePeelCount(Loop *L, unsigned LoopSize, TargetTransformInfo::PeelingPreferences &PP, unsigned TripCount, DominatorTree &DT, ScalarEvolution &SE, const TargetTransformInfo &TTI, AssumptionCache *AC=nullptr, unsigned Threshold=UINT_MAX)
Definition LoopPeel.cpp:753
LLVM_ABI void peelLoop(Loop *L, unsigned PeelCount, bool PeelLast, LoopInfo *LI, ScalarEvolution *SE, DominatorTree &DT, AssumptionCache *AC, bool PreserveLCSSA, ValueToValueMapTy &VMap)
VMap is the value-map that maps instructions from the original loop to instructions in the last peele...
TargetTransformInfo TTI
ValueMap< const Value *, WeakTrackingVH > ValueToValueMapTy