1 //===- LCSSA.h - Loop-closed SSA transform Pass -----------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This pass transforms loops by placing phi nodes at the end of the loops for
10 // all values that are live across the loop boundary. For example, it turns
11 // the left into the right code:
13 // for (...) for (...)
18 // X3 = phi(X1, X2) X3 = phi(X1, X2)
19 // ... = X3 + 4 X4 = phi(X3)
22 // This is still valid LLVM; the extra phi nodes are purely redundant, and will
23 // be trivially eliminated by InstCombine. The major benefit of this
24 // transformation is that it makes many other loop optimizations, such as
25 // LoopUnswitching, simpler.
27 //===----------------------------------------------------------------------===//
29 #ifndef LLVM_TRANSFORMS_UTILS_LCSSA_H
30 #define LLVM_TRANSFORMS_UTILS_LCSSA_H
32 #include "llvm/IR/PassManager.h"
36 /// Converts loops into loop-closed SSA form.
37 class LCSSAPass
: public PassInfoMixin
<LCSSAPass
> {
39 PreservedAnalyses
run(Function
&F
, FunctionAnalysisManager
&AM
);
41 } // end namespace llvm
43 #endif // LLVM_TRANSFORMS_UTILS_LCSSA_H