LCOV - code coverage report
Current view: top level - include/llvm/Transforms/Scalar - SimpleLoopUnswitch.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 1 1 100.0 %
Date: 2018-05-20 00:06:23 Functions: 0 0 -
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- SimpleLoopUnswitch.h - Hoist loop-invariant control flow -*- C++ -*-===//
       2             : //
       3             : //                     The LLVM Compiler Infrastructure
       4             : //
       5             : // This file is distributed under the University of Illinois Open Source
       6             : // License. See LICENSE.TXT for details.
       7             : //
       8             : //===----------------------------------------------------------------------===//
       9             : 
      10             : #ifndef LLVM_TRANSFORMS_SCALAR_SIMPLELOOPUNSWITCH_H
      11             : #define LLVM_TRANSFORMS_SCALAR_SIMPLELOOPUNSWITCH_H
      12             : 
      13             : #include "llvm/Analysis/LoopAnalysisManager.h"
      14             : #include "llvm/Analysis/LoopInfo.h"
      15             : #include "llvm/IR/PassManager.h"
      16             : #include "llvm/Transforms/Scalar/LoopPassManager.h"
      17             : 
      18             : namespace llvm {
      19             : 
      20             : /// This pass transforms loops that contain branches on loop-invariant
      21             : /// conditions to have multiple loops. For example, it turns the left into the
      22             : /// right code:
      23             : ///
      24             : ///  for (...)                  if (lic)
      25             : ///    A                          for (...)
      26             : ///    if (lic)                     A; B; C
      27             : ///      B                      else
      28             : ///    C                          for (...)
      29             : ///                                 A; C
      30             : ///
      31             : /// This can increase the size of the code exponentially (doubling it every time
      32             : /// a loop is unswitched) so we only unswitch if the resultant code will be
      33             : /// smaller than a threshold.
      34             : ///
      35             : /// This pass expects LICM to be run before it to hoist invariant conditions out
      36             : /// of the loop, to make the unswitching opportunity obvious.
      37             : ///
      38             : class SimpleLoopUnswitchPass : public PassInfoMixin<SimpleLoopUnswitchPass> {
      39             :   bool NonTrivial;
      40             : 
      41             : public:
      42          71 :   SimpleLoopUnswitchPass(bool NonTrivial = false) : NonTrivial(NonTrivial) {}
      43             : 
      44             :   PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
      45             :                         LoopStandardAnalysisResults &AR, LPMUpdater &U);
      46             : };
      47             : 
      48             : /// Create the legacy pass object for the simple loop unswitcher.
      49             : ///
      50             : /// See the documentaion for `SimpleLoopUnswitchPass` for details.
      51             : Pass *createSimpleLoopUnswitchLegacyPass(bool NonTrivial = false);
      52             : 
      53             : } // end namespace llvm
      54             : 
      55             : #endif // LLVM_TRANSFORMS_SCALAR_SIMPLELOOPUNSWITCH_H

Generated by: LCOV version 1.13