Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //===- LCSSA.h - Loop-closed SSA transform 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 pass transforms loops by placing phi nodes at the end of the loops for
0010 // all values that are live across the loop boundary.  For example, it turns
0011 // the left into the right code:
0012 //
0013 // for (...)                for (...)
0014 //   if (c)                   if (c)
0015 //     X1 = ...                 X1 = ...
0016 //   else                     else
0017 //     X2 = ...                 X2 = ...
0018 //   X3 = phi(X1, X2)         X3 = phi(X1, X2)
0019 // ... = X3 + 4             X4 = phi(X3)
0020 //                          ... = X4 + 4
0021 //
0022 // This is still valid LLVM; the extra phi nodes are purely redundant, and will
0023 // be trivially eliminated by InstCombine.  The major benefit of this
0024 // transformation is that it makes many other loop optimizations, such as
0025 // LoopUnswitching, simpler.
0026 //
0027 //===----------------------------------------------------------------------===//
0028 
0029 #ifndef LLVM_TRANSFORMS_UTILS_LCSSA_H
0030 #define LLVM_TRANSFORMS_UTILS_LCSSA_H
0031 
0032 #include "llvm/IR/PassManager.h"
0033 
0034 namespace llvm {
0035 
0036 /// Converts loops into loop-closed SSA form.
0037 class LCSSAPass : public PassInfoMixin<LCSSAPass> {
0038 public:
0039   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
0040 };
0041 } // end namespace llvm
0042 
0043 #endif // LLVM_TRANSFORMS_UTILS_LCSSA_H