LoopSink.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- LoopSink.h - Loop Sink Pass ------------------------------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. // This file provides the interface for the Loop Sink pass.
  15. //
  16. //===----------------------------------------------------------------------===//
  17. #ifndef LLVM_TRANSFORMS_SCALAR_LOOPSINK_H
  18. #define LLVM_TRANSFORMS_SCALAR_LOOPSINK_H
  19. #include "llvm/IR/PassManager.h"
  20. namespace llvm {
  21. class Function;
  22. /// A pass that does profile-guided sinking of instructions into loops.
  23. ///
  24. /// This is a function pass as it shouldn't be composed into any kind of
  25. /// unified loop pass pipeline. The goal of it is to sink code into loops that
  26. /// is loop invariant but only required within the loop body when doing so
  27. /// reduces the global expected dynamic frequency with which it executes.
  28. /// A classic example is an extremely cold branch within a loop body.
  29. ///
  30. /// We do this as a separate pass so that during normal optimization all
  31. /// invariant operations can be held outside the loop body to simplify
  32. /// fundamental analyses and transforms of the loop.
  33. class LoopSinkPass : public PassInfoMixin<LoopSinkPass> {
  34. public:
  35. PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
  36. };
  37. }
  38. #endif // LLVM_TRANSFORMS_SCALAR_LOOPSINK_H
  39. #ifdef __GNUC__
  40. #pragma GCC diagnostic pop
  41. #endif