llvm-project/mlir/lib/Interfaces/InferStridedMetadataInterface.cpp
Fabian Mora b2797d9b82
Reland "[mlir] Add strided metadata range dataflow analysis" (#163403)" (#163408)
This relands commit aa8499863ad23350da0912d99d189f306d0ea139. That
commit was originally reverted because it caused failures in shared lib
builds due to missing link dependencies. This patch relands the commit
with the missing libs added.

Signed-off-by: Fabian Mora <fabian.mora-cordero@amd.com>
2025-10-14 11:16:30 -04:00

37 lines
1.2 KiB
C++

//===- InferStridedMetadataInterface.cpp - Strided md inference interface -===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "mlir/Interfaces/InferStridedMetadataInterface.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/TypeUtilities.h"
#include <optional>
using namespace mlir;
#include "mlir/Interfaces/InferStridedMetadataInterface.cpp.inc"
void StridedMetadataRange::print(raw_ostream &os) const {
if (isUninitialized()) {
os << "strided_metadata<None>";
return;
}
os << "strided_metadata<offset = [";
llvm::interleaveComma(*offsets, os, [&](const ConstantIntRanges &range) {
os << "{" << range << "}";
});
os << "], sizes = [";
llvm::interleaveComma(sizes, os, [&](const ConstantIntRanges &range) {
os << "{" << range << "}";
});
os << "], strides = [";
llvm::interleaveComma(strides, os, [&](const ConstantIntRanges &range) {
os << "{" << range << "}";
});
os << "]>";
}