LoopBoundSplit.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===------- LoopBoundSplit.h - Split Loop Bound ----------------*- 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. #ifndef LLVM_TRANSFORMS_SCALAR_LOOPBOUNDSPLIT_H
  14. #define LLVM_TRANSFORMS_SCALAR_LOOPBOUNDSPLIT_H
  15. #include "llvm/Analysis/LoopAnalysisManager.h"
  16. #include "llvm/IR/PassManager.h"
  17. namespace llvm {
  18. class LPMUpdater;
  19. class Loop;
  20. /// This pass transforms loops that contain a conditional branch with induction
  21. /// variable. For example, it transforms left code to right code:
  22. ///
  23. /// newbound = min(n, c)
  24. /// while (iv < n) { while(iv < newbound) {
  25. /// A A
  26. /// if (iv < c) B
  27. /// B C
  28. /// C }
  29. /// if (iv != n) {
  30. /// while (iv < n) {
  31. /// A
  32. /// C
  33. /// }
  34. /// }
  35. class LoopBoundSplitPass : public PassInfoMixin<LoopBoundSplitPass> {
  36. public:
  37. PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
  38. LoopStandardAnalysisResults &AR, LPMUpdater &U);
  39. };
  40. } // end namespace llvm
  41. #endif // LLVM_TRANSFORMS_SCALAR_LOOPBOUNDSPLIT_H
  42. #ifdef __GNUC__
  43. #pragma GCC diagnostic pop
  44. #endif