LLVM  10.0.0svn
Go to the documentation of this file.
1 //===- SCCP.cpp - Sparse Conditional Constant Propagation -------*- 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 // \file
10 // This file implements sparse conditional constant propagation and merging:
11 //
12 // Specifically, this:
13 // * Assumes values are constant unless proven otherwise
14 // * Assumes BasicBlocks are dead unless proven otherwise
15 // * Proves values to be constant, and replaces them with constants
16 // * Proves conditional branches to be unconditional
17 //
18 //===----------------------------------------------------------------------===//
23 #include "llvm/ADT/STLExtras.h"
25 #include "llvm/IR/DataLayout.h"
26 #include "llvm/IR/Function.h"
27 #include "llvm/IR/Module.h"
28 #include "llvm/IR/PassManager.h"
31 namespace llvm {
33 class PostDominatorTree;
35 /// This pass performs function-level constant propagation and merging.
36 class SCCPPass : public PassInfoMixin<SCCPPass> {
37 public:
39 };
41 /// Helper struct for bundling up the analysis results per function for IPSCCP.
43  std::unique_ptr<PredicateInfo> PredInfo;
46 };
48 bool runIPSCCP(Module &M, const DataLayout &DL, const TargetLibraryInfo *TLI,
50 } // end namespace llvm
A parsed version of the target data layout string in and methods for querying it. ...
Definition: DataLayout.h:111
This class represents lattice values for constants.
Definition: AllocatorList.h:23
A Module instance is used to store all the information related to an LLVM module. ...
Definition: Module.h:65
An efficient, type-erasing, non-owning reference to a callable.
Definition: STLExtras.h:116
std::unique_ptr< PredicateInfo > PredInfo
Definition: SCCP.h:43
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Definition: SCCP.cpp:1858
Helper struct for bundling up the analysis results per function for IPSCCP.
Definition: SCCP.h:42
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:372
PostDominatorTree * PDT
Definition: SCCP.h:45
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
Definition: Dominators.h:144
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:153
This file implements the PredicateInfo analysis, which creates an Extended SSA form for operations us...
Module.h This file contains the declarations for the Module class.
Provides information about what library functions are available for the current target.
PostDominatorTree Class - Concrete subclass of DominatorTree that is used to compute the post-dominat...
DominatorTree * DT
Definition: SCCP.h:44
bool runIPSCCP(Module &M, const DataLayout &DL, const TargetLibraryInfo *TLI, function_ref< AnalysisResultsForFn(Function &)> getAnalysis)
Definition: SCCP.cpp:2002
This pass performs function-level constant propagation and merging.
Definition: SCCP.h:36
This header defines various interfaces for pass management in LLVM.