Skip to content

Commit a8c0978

Browse files
committed
Add width for int64_t interface, remove one warning
1 parent b40461d commit a8c0978

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

mlir/include/mlir/Analysis/AffineExprBounds.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ class AffineExprBoundsVisitor
7878
private:
7979
bool boundsSigned;
8080
uint64_t bitWidth;
81-
void
82-
inferBinOpRange(AffineBinaryOpExpr expr,
83-
std::function<ConstantIntRanges(ArrayRef<ConstantIntRanges>)>
84-
opInference);
81+
void inferBinOpRange(
82+
AffineBinaryOpExpr expr,
83+
const std::function<ConstantIntRanges(ArrayRef<ConstantIntRanges>)>
84+
&opInference);
8585

8686
/// Bounds that have been computed for subexpressions are memoized and reused.
8787
llvm::DenseMap<AffineExpr, APInt> lb;

mlir/lib/Analysis/AffineExprBounds.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "mlir/IR/BuiltinAttributes.h"
1818
#include "mlir/Interfaces/InferIntRangeInterface.h"
1919
#include "mlir/Interfaces/Utils/InferIntRangeCommon.h"
20+
#include "llvm/ADT/APInt.h"
2021

2122
#include <cstdint>
2223

@@ -40,7 +41,8 @@ AffineExprBoundsVisitor::AffineExprBoundsVisitor(
4041

4142
AffineExprBoundsVisitor::AffineExprBoundsVisitor(
4243
ArrayRef<std::optional<int64_t>> constLowerBounds,
43-
ArrayRef<std::optional<int64_t>> constUpperBounds, MLIRContext *context) {
44+
ArrayRef<std::optional<int64_t>> constUpperBounds, MLIRContext *context)
45+
: boundsSigned(true), bitWidth(64) {
4446
assert(constLowerBounds.size() == constUpperBounds.size());
4547
// Convert int64_ts to APInts.
4648
for (unsigned i = 0; i < constLowerBounds.size(); i++) {
@@ -107,7 +109,8 @@ ConstantIntRanges getRange(APInt lb, APInt ub, bool boundsSigned) {
107109
/// binary operations on two ranges.
108110
void AffineExprBoundsVisitor::inferBinOpRange(
109111
AffineBinaryOpExpr expr,
110-
std::function<ConstantIntRanges(ArrayRef<ConstantIntRanges>)> opInference) {
112+
const std::function<ConstantIntRanges(ArrayRef<ConstantIntRanges>)>
113+
&opInference) {
111114
ConstantIntRanges lhsRange =
112115
getRange(lb[expr.getLHS()], ub[expr.getLHS()], boundsSigned);
113116
ConstantIntRanges rhsRange =

0 commit comments

Comments
 (0)