9#ifndef LLVM_ANALYSIS_CONSTRAINTSYSTEM_H
10#define LLVM_ANALYSIS_CONSTRAINTSYSTEM_H
28 Entry(int64_t Coefficient,
uint16_t Id)
29 : Coefficient(Coefficient), Id(Id) {}
32 static int64_t getConstPart(
const Entry &
E) {
41 if (Row.back().Id == Id)
42 return Row.back().Coefficient;
46 size_t NumVariables = 0;
61 bool eliminateUsingFM();
64 bool mayHaveSolutionImpl();
72 NumVariables += FunctionArgs.
size();
73 for (
auto *
Arg : FunctionArgs) {
78 : NumVariables(Value2Index.
size()), Value2Index(Value2Index) {}
81 assert(Constraints.
empty() || R.size() == NumVariables);
97 if (Constraints.
empty())
98 NumVariables = R.size();
114 NumVariables = std::max(R.size(), NumVariables);
134 assert(!Constraints.
empty() &&
"Constraint system is empty");
136 for (
auto &Entry : Constraints.
back())
137 Result[Entry.Id] = Entry.Coefficient;
148 unsigned size()
const {
return Constraints.
size(); }
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
This file implements a class to represent arbitrary precision integral constant values and operations...
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
This file defines the DenseMap class.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallVector class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
size - Get the array size.
DenseMap< Value *, unsigned > & getValue2Index()
static SmallVector< int64_t, 8 > negate(SmallVector< int64_t, 8 > R)
bool mayHaveSolution()
Returns true if there may be a solution for the constraints in the system.
bool isConditionImplied(SmallVector< int64_t, 8 > R) const
unsigned size() const
Returns the number of rows in the constraint system.
ConstraintSystem(const DenseMap< Value *, unsigned > &Value2Index)
SmallVector< int64_t > getLastConstraint() const
bool addVariableRow(ArrayRef< int64_t > R)
void popLastNVariables(unsigned N)
const DenseMap< Value *, unsigned > & getValue2Index() const
bool addVariableRowFill(ArrayRef< int64_t > R)
void dump() const
Print the constraints in the system.
ConstraintSystem(ArrayRef< Value * > FunctionArgs)
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
reference emplace_back(ArgTypes &&... Args)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
APInt GreatestCommonDivisor(APInt A, APInt B)
Compute GCD of two unsigned APInt values.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
std::enable_if_t< std::is_signed_v< T >, T > MulOverflow(T X, T Y, T &Result)
Multiply two signed integers, computing the two's complement truncated result, returning true if an o...
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
auto enumerate(FirstRange &&First, RestRanges &&...Rest)
Given two or more input ranges, returns a new range whose values are are tuples (A,...