diff --git a/mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp b/mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp --- a/mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp +++ b/mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp @@ -609,7 +609,9 @@ auto val = lhsAttr.getSplatValue(); if (val.isZero()) return lhsAttr; - if (val.getSExtValue() == (1 << getShift())) + const int64_t shift = getShift(); + const int64_t shifted = 1 << shift; + if (val.getSExtValue() == shifted) return rhs; }