Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:42

0001 //===- LoopSink.h - Loop Sink Pass ------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // This file provides the interface for the Loop Sink pass.
0010 //
0011 //===----------------------------------------------------------------------===//
0012 
0013 #ifndef LLVM_TRANSFORMS_SCALAR_LOOPSINK_H
0014 #define LLVM_TRANSFORMS_SCALAR_LOOPSINK_H
0015 
0016 #include "llvm/IR/PassManager.h"
0017 
0018 namespace llvm {
0019 
0020 class Function;
0021 
0022 /// A pass that does profile-guided sinking of instructions into loops.
0023 ///
0024 /// This is a function pass as it shouldn't be composed into any kind of
0025 /// unified loop pass pipeline. The goal of it is to sink code into loops that
0026 /// is loop invariant but only required within the loop body when doing so
0027 /// reduces the global expected dynamic frequency with which it executes.
0028 /// A classic example is an extremely cold branch within a loop body.
0029 ///
0030 /// We do this as a separate pass so that during normal optimization all
0031 /// invariant operations can be held outside the loop body to simplify
0032 /// fundamental analyses and transforms of the loop.
0033 class LoopSinkPass : public PassInfoMixin<LoopSinkPass> {
0034 public:
0035   PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
0036 };
0037 }
0038 
0039 #endif // LLVM_TRANSFORMS_SCALAR_LOOPSINK_H