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 17 #include "llvm/Analysis/TargetTransformInfo.h" 18 #include "llvm/Transforms/Utils/ValueMapper.h" 19 20 namespace llvm { 21 22 bool canPeel(const Loop *L); 23 24 /// VMap is the value-map that maps instructions from the original loop to 25 /// instructions in the last peeled-off iteration. 26 bool peelLoop(Loop *L, unsigned PeelCount, LoopInfo *LI, ScalarEvolution *SE, 27 DominatorTree &DT, AssumptionCache *AC, bool PreserveLCSSA, 28 ValueToValueMapTy &VMap); 29 30 TargetTransformInfo::PeelingPreferences 31 gatherPeelingPreferences(Loop *L, ScalarEvolution &SE, 32 const TargetTransformInfo &TTI, 33 std::optional<bool> UserAllowPeeling, 34 std::optional<bool> UserAllowProfileBasedPeeling, 35 bool UnrollingSpecficValues = false); 36 37 void computePeelCount(Loop *L, unsigned LoopSize, 38 TargetTransformInfo::PeelingPreferences &PP, 39 unsigned TripCount, DominatorTree &DT, 40 ScalarEvolution &SE, AssumptionCache *AC = nullptr, 41 unsigned Threshold = UINT_MAX); 42 43 } // end namespace llvm 44 45 #endif // LLVM_TRANSFORMS_UTILS_LOOPPEEL_H 46