[Alignment][NFC] Migrate Instructions to Align
[llvm-core.git] / include / llvm / Transforms / Utils / PromoteMemToReg.h
blobb2b4507bbc74c2e93bf028eb2a09a8dd214251c6
1 //===- PromoteMemToReg.h - Promote Allocas to Scalars -----------*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file exposes an interface to promote alloca instructions to SSA
10 // registers, by using the SSA construction algorithm.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_TRANSFORMS_UTILS_PROMOTEMEMTOREG_H
15 #define LLVM_TRANSFORMS_UTILS_PROMOTEMEMTOREG_H
17 namespace llvm {
19 template <typename T> class ArrayRef;
20 class AllocaInst;
21 class DominatorTree;
22 class AliasSetTracker;
23 class AssumptionCache;
25 /// Return true if this alloca is legal for promotion.
26 ///
27 /// This is true if there are only loads, stores, and lifetime markers
28 /// (transitively) using this alloca. This also enforces that there is only
29 /// ever one layer of bitcasts or GEPs between the alloca and the lifetime
30 /// markers.
31 bool isAllocaPromotable(const AllocaInst *AI);
33 /// Promote the specified list of alloca instructions into scalar
34 /// registers, inserting PHI nodes as appropriate.
35 ///
36 /// This function makes use of DominanceFrontier information. This function
37 /// does not modify the CFG of the function at all. All allocas must be from
38 /// the same function.
39 ///
40 void PromoteMemToReg(ArrayRef<AllocaInst *> Allocas, DominatorTree &DT,
41 AssumptionCache *AC = nullptr);
43 } // End llvm namespace
45 #endif