#include "mlir/Dialect/Utils/StaticValueUtils.h"
#include "mlir/IR/Matchers.h"
#include "mlir/Support/LLVM.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/Support/MathExtras.h"
namespace mlir {
bool isZeroIndex(OpFoldResult v) { … }
std::tuple<SmallVector<OpFoldResult>, SmallVector<OpFoldResult>,
SmallVector<OpFoldResult>>
getOffsetsSizesAndStrides(ArrayRef<Range> ranges) { … }
void dispatchIndexOpFoldResult(OpFoldResult ofr,
SmallVectorImpl<Value> &dynamicVec,
SmallVectorImpl<int64_t> &staticVec) { … }
void dispatchIndexOpFoldResults(ArrayRef<OpFoldResult> ofrs,
SmallVectorImpl<Value> &dynamicVec,
SmallVectorImpl<int64_t> &staticVec) { … }
OpFoldResult getAsOpFoldResult(Value val) { … }
SmallVector<OpFoldResult> getAsOpFoldResult(ValueRange values) { … }
SmallVector<OpFoldResult> getAsOpFoldResult(ArrayAttr arrayAttr) { … }
OpFoldResult getAsIndexOpFoldResult(MLIRContext *ctx, int64_t val) { … }
SmallVector<OpFoldResult> getAsIndexOpFoldResult(MLIRContext *ctx,
ArrayRef<int64_t> values) { … }
std::optional<int64_t> getConstantIntValue(OpFoldResult ofr) { … }
std::optional<SmallVector<int64_t>>
getConstantIntValues(ArrayRef<OpFoldResult> ofrs) { … }
bool isConstantIntValue(OpFoldResult ofr, int64_t value) { … }
bool isEqualConstantIntOrValue(OpFoldResult ofr1, OpFoldResult ofr2) { … }
bool isEqualConstantIntOrValueArray(ArrayRef<OpFoldResult> ofrs1,
ArrayRef<OpFoldResult> ofrs2) { … }
SmallVector<OpFoldResult> getMixedValues(ArrayRef<int64_t> staticValues,
ValueRange dynamicValues, Builder &b) { … }
std::pair<SmallVector<int64_t>, SmallVector<Value>>
decomposeMixedValues(const SmallVectorImpl<OpFoldResult> &mixedValues) { … }
template <typename K, typename V>
static SmallVector<V>
getValuesSortedByKeyImpl(ArrayRef<K> keys, ArrayRef<V> values,
llvm::function_ref<bool(K, K)> compare) { … }
SmallVector<Value>
getValuesSortedByKey(ArrayRef<Attribute> keys, ArrayRef<Value> values,
llvm::function_ref<bool(Attribute, Attribute)> compare) { … }
SmallVector<OpFoldResult>
getValuesSortedByKey(ArrayRef<Attribute> keys, ArrayRef<OpFoldResult> values,
llvm::function_ref<bool(Attribute, Attribute)> compare) { … }
SmallVector<int64_t>
getValuesSortedByKey(ArrayRef<Attribute> keys, ArrayRef<int64_t> values,
llvm::function_ref<bool(Attribute, Attribute)> compare) { … }
std::optional<int64_t> constantTripCount(OpFoldResult lb, OpFoldResult ub,
OpFoldResult step) { … }
bool hasValidSizesOffsets(SmallVector<int64_t> sizesOrOffsets) { … }
bool hasValidStrides(SmallVector<int64_t> strides) { … }
LogicalResult foldDynamicIndexList(SmallVectorImpl<OpFoldResult> &ofrs,
bool onlyNonNegative, bool onlyNonZero) { … }
LogicalResult
foldDynamicOffsetSizeList(SmallVectorImpl<OpFoldResult> &offsetsOrSizes) { … }
LogicalResult foldDynamicStrideList(SmallVectorImpl<OpFoldResult> &strides) { … }
}