LLVM  15.0.0git
Macros | Functions | Variables
ConstraintElimination.cpp File Reference
#include "llvm/Transforms/Scalar/ConstraintElimination.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/ConstraintSystem.h"
#include "llvm/Analysis/GlobalsModRef.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/DebugCounter.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Transforms/Scalar.h"
#include <string>
Include dependency graph for ConstraintElimination.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "constraint-elimination"
 

Functions

 STATISTIC (NumCondsRemoved, "Number of instructions removed")
 
 DEBUG_COUNTER (EliminatedCounter, "conds-eliminated", "Controls which conditions are eliminated")
 
static SmallVector< std::pair< int64_t, Value * >, 4 > decompose (Value *V, SmallVector< PreconditionTy, 4 > &Preconditions, bool IsSigned)
 
static ConstraintTy getConstraint (CmpInst::Predicate Pred, Value *Op0, Value *Op1, const DenseMap< Value *, unsigned > &Value2Index, DenseMap< Value *, unsigned > &NewIndices)
 Turn a condition CmpI into a vector of constraints, using indices from Value2Index. More...
 
static ConstraintTy getConstraint (CmpInst *Cmp, ConstraintInfo &Info, DenseMap< Value *, unsigned > &NewIndices)
 
static void dumpWithNames (ConstraintTy &C, DenseMap< Value *, unsigned > &Value2Index)
 
static void tryToSimplifyOverflowMath (IntrinsicInst *II, ConstraintInfo &Info, SmallVectorImpl< Instruction * > &ToRemove)
 
static bool eliminateConstraints (Function &F, DominatorTree &DT)
 
 INITIALIZE_PASS_BEGIN (ConstraintElimination, "constraint-elimination", "Constraint Elimination", false, false) INITIALIZE_PASS_END(ConstraintElimination
 

Variables

static int64_t MaxConstraintValue = std::numeric_limits<int64_t>::max()
 
static int64_t MinSignedConstraintValue = std::numeric_limits<int64_t>::min()
 
constraint elimination
 
constraint Constraint Elimination
 
constraint Constraint false
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "constraint-elimination"

Definition at line 39 of file ConstraintElimination.cpp.

Function Documentation

◆ DEBUG_COUNTER()

DEBUG_COUNTER ( EliminatedCounter  ,
"conds-eliminated"  ,
"Controls which conditions are eliminated"   
)

◆ decompose()

static SmallVector<std::pair<int64_t, Value *>, 4> decompose ( Value V,
SmallVector< PreconditionTy, 4 > &  Preconditions,
bool  IsSigned 
)
static

◆ dumpWithNames()

static void dumpWithNames ( ConstraintTy &  C,
DenseMap< Value *, unsigned > &  Value2Index 
)
static

◆ eliminateConstraints()

static bool eliminateConstraints ( Function F,
DominatorTree DT 
)
static

◆ getConstraint() [1/2]

static ConstraintTy getConstraint ( CmpInst Cmp,
ConstraintInfo &  Info,
DenseMap< Value *, unsigned > &  NewIndices 
)
static

Definition at line 345 of file ConstraintElimination.cpp.

References getConstraint(), Info, and llvm::CmpInst::isSigned().

◆ getConstraint() [2/2]

static ConstraintTy getConstraint ( CmpInst::Predicate  Pred,
Value Op0,
Value Op1,
const DenseMap< Value *, unsigned > &  Value2Index,
DenseMap< Value *, unsigned > &  NewIndices 
)
static

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( ConstraintElimination  ,
"constraint-elimination ,
"Constraint Elimination ,
false  ,
false   
)

◆ STATISTIC()

STATISTIC ( NumCondsRemoved  ,
"Number of instructions removed  
)

◆ tryToSimplifyOverflowMath()

static void tryToSimplifyOverflowMath ( IntrinsicInst II,
ConstraintInfo &  Info,
SmallVectorImpl< Instruction * > &  ToRemove 
)
static

Variable Documentation

◆ elimination

constraint elimination

Definition at line 806 of file ConstraintElimination.cpp.

◆ Elimination

constraint Constraint Elimination

Definition at line 807 of file ConstraintElimination.cpp.

◆ false

constraint Constraint false

Definition at line 807 of file ConstraintElimination.cpp.

◆ MaxConstraintValue

int64_t MaxConstraintValue = std::numeric_limits<int64_t>::max()
static

Definition at line 45 of file ConstraintElimination.cpp.

Referenced by decompose().

◆ MinSignedConstraintValue

int64_t MinSignedConstraintValue = std::numeric_limits<int64_t>::min()
static

Definition at line 46 of file ConstraintElimination.cpp.

Referenced by decompose().