LLVM
8.0.1
|
This file implements the PredicateInfo analysis, which creates an Extended SSA form for operations used in branch comparisons and llvm.assume comparisons. More...
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/ilist.h"
#include "llvm/ADT/ilist_node.h"
#include "llvm/ADT/iterator.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/OrderedInstructions.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/OperandTraits.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Use.h"
#include "llvm/IR/User.h"
#include "llvm/IR/Value.h"
#include "llvm/IR/ValueHandle.h"
#include "llvm/Pass.h"
#include "llvm/PassAnalysisSupport.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <iterator>
#include <memory>
#include <utility>
Go to the source code of this file.
Classes | |
class | llvm::PredicateBase |
class | llvm::PredicateWithCondition |
class | llvm::PredicateAssume |
class | llvm::PredicateWithEdge |
class | llvm::PredicateBranch |
class | llvm::PredicateSwitch |
class | llvm::PredicateInfo |
Encapsulates PredicateInfo, including all data associated with memory accesses. More... | |
class | llvm::PredicateInfoPrinterLegacyPass |
class | llvm::PredicateInfoPrinterPass |
Printer pass for PredicateInfo . More... | |
struct | llvm::PredicateInfoVerifierPass |
Verifier pass for PredicateInfo . More... | |
Namespaces | |
llvm | |
This class represents lattice values for constants. | |
llvm::PredicateInfoClasses | |
Enumerations | |
enum | llvm::PredicateType { llvm::PT_Branch, llvm::PT_Assume, llvm::PT_Switch } |
This file implements the PredicateInfo analysis, which creates an Extended SSA form for operations used in branch comparisons and llvm.assume comparisons.
Copies of these operations are inserted into the true/false edge (and after assumes), and information attached to the copies. All uses of the original operation in blocks dominated by the true/false edge (and assume), are replaced with uses of the copies. This enables passes to easily and sparsely propagate condition based info into the operations that may be affected.
Example: cmp = icmp eq i32 x, 50 br i1 cmp, label true, label false true: ret i32 x false: ret i32 1
will become
cmp = icmp eq i32, x, 50 br i1 cmp, label true, label false true: x.0 = call @llvm.ssa_copy.i32(i32 x) ret i32 x.0 false: ret i32 1
Using getPredicateInfoFor on x.0 will give you the comparison it is dominated by (the icmp), and that you are located in the true edge of that comparison, which tells you x.0 is 50.
In order to reduce the number of copies inserted, predicateinfo is only inserted where it would actually be live. This means if there are no uses of an operation dominated by the branch edges, or by an assume, the associated predicate info is never inserted.
Definition in file PredicateInfo.h.