12 #include "llvm/ADT/APSInt.h" 26 auto v = ofr.dyn_cast<
Value>();
28 APInt apInt = ofr.get<
Attribute>().cast<IntegerAttr>().getValue();
29 staticVec.push_back(apInt.getSExtValue());
32 dynamicVec.push_back(v);
33 staticVec.push_back(sentinel);
46 return llvm::to_vector<4>(
47 llvm::map_range(attr.
cast<ArrayAttr>(), [](
Attribute a) -> int64_t {
48 return a.cast<IntegerAttr>().getInt();
64 return llvm::to_vector<4>(
71 if (
auto val = ofr.dyn_cast<
Value>()) {
74 return intVal.getSExtValue();
80 return intAttr.getValue().getSExtValue();
87 return val && *val ==
value;
96 if (cst1 && cst2 && *cst1 == *cst2)
98 auto v1 = ofr1.dyn_cast<
Value>(), v2 = ofr2.dyn_cast<
Value>();
99 return v1 && v1 == v2;
TODO: Remove this file when SCCP and integer range analysis have been ported to the new framework...
U dyn_cast_or_null() const
detail::constant_int_op_binder m_ConstantInt(IntegerAttr::ValueType *bind_value)
Matches a constant holding a scalar/vector/tensor integer (splat) and writes the integer value to bin...
void dispatchIndexOpFoldResults(ArrayRef< OpFoldResult > ofrs, SmallVectorImpl< Value > &dynamicVec, SmallVectorImpl< int64_t > &staticVec, int64_t sentinel)
Helper function to dispatch multiple OpFoldResults according to the behavior of dispatchIndexOpFoldRe...
This class represents a single result from folding an operation.
static constexpr const bool value
Attributes are known-constant values of operations.
detail::constant_op_matcher m_Constant()
Matches a constant foldable operation.
bool isConstantIntValue(OpFoldResult ofr, int64_t value)
Return true if ofr is constant integer equal to value.
void dispatchIndexOpFoldResult(OpFoldResult ofr, SmallVectorImpl< Value > &dynamicVec, SmallVectorImpl< int64_t > &staticVec, int64_t sentinel)
Helper function to dispatch an OpFoldResult into staticVec if: a) it is an IntegerAttr In other cases...
OpFoldResult getAsOpFoldResult(Value val)
Given a value, try to extract a constant Attribute.
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
bool matchPattern(Value value, const Pattern &pattern)
Entry point for matching a pattern over a Value.
SmallVector< int64_t, 4 > extractFromI64ArrayAttr(Attribute attr)
Extract int64_t values from the assumed ArrayAttr of IntegerAttr.
Optional< int64_t > getConstantIntValue(OpFoldResult ofr)
If ofr is a constant integer or an IntegerAttr, return the integer.
bool isEqualConstantIntOrValue(OpFoldResult ofr1, OpFoldResult ofr2)
Return true if ofr1 and ofr2 are the same integer constant attribute values or the same SSA value...