mirror of
https://github.com/RPCS3/llvm.git
synced 2026-01-31 01:25:19 +01:00
The existing LoopRotation.cpp is implemented as one of loop passes instead of being a utility. The user cannot easily perform the loop rotation selectively (or on demand) under different optimization level. For example, the loop rotation is needed as part of the logic to convert a loop into a loop with bottom test for a transformation. If the loop rotation is simply added as a loop pass before the transformation, the pass is skipped if it is compiled at –O0 or if it is explicitly disabled by the user, causing the compiler to generate incorrect code. Furthermore, as a loop pass it will rotate all loops instead of just the relevant loops. We provide a utility interface for the loop rotation so that the loop rotation can be called on demand. The changeset is as follows: - Create a new file lib/Transforms/Utils/LoopRotationUtils.cpp and move the main implementation of class LoopRotate into this file. - Create a new file llvm/include/Transform/Utils/LoopRotationUtils.h with the interface LoopRotation(...). - Original LoopRotation.cpp is changed to use the utility function LoopRotation in LoopRotationUtils.cpp. This is done in the same way community did for mem-to-reg implementation. Patch by Jin Lin! Differential Revision: https://reviews.llvm.org/D44595 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328766 91177308-0d34-0410-b5e6-96231b3b80d8
36 lines
1.1 KiB
C++
36 lines
1.1 KiB
C++
//===- LoopRotationUtils.h - Utilities to perform loop rotation -*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file provides utilities to convert a loop into a loop with bottom test.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_TRANSFORMS_UTILS_LOOPROTATIONUTILS_H
|
|
#define LLVM_TRANSFORMS_UTILS_LOOPROTATIONUTILS_H
|
|
|
|
namespace llvm {
|
|
|
|
class AssumptionCache;
|
|
class DominatorTree;
|
|
class Loop;
|
|
class LoopInfo;
|
|
class ScalarEvolution;
|
|
struct SimplifyQuery;
|
|
class TargetTransformInfo;
|
|
|
|
/// \brief Convert a loop into a loop with bottom test.
|
|
bool LoopRotation(Loop *L, unsigned MaxHeaderSize, LoopInfo *LI,
|
|
const TargetTransformInfo *TTI, AssumptionCache *AC,
|
|
DominatorTree *DT, ScalarEvolution *SE,
|
|
const SimplifyQuery &SQ);
|
|
|
|
} // namespace llvm
|
|
|
|
#endif
|