[Mlir-commits] [mlir] 6e3bc83 - [mlir][tosa] Fix left shift that was implicitly converted to 64-bit
Rob Suderman
llvmlistbot at llvm.org
Wed Aug 31 14:58:32 PDT 2022
Author: Rob Suderman
Date: 2022-08-31T14:56:10-07:00
New Revision: 6e3bc83c2237c9a815236b5ec66dd0e959648ed5
URL: https://github.com/llvm/llvm-project/commit/6e3bc83c2237c9a815236b5ec66dd0e959648ed5
DIFF: https://github.com/llvm/llvm-project/commit/6e3bc83c2237c9a815236b5ec66dd0e959648ed5.diff
LOG: [mlir][tosa] Fix left shift that was implicitly converted to 64-bit
Missing long specifier so that a shift would occur in 64-bits rather
than implicitly in 32-bits.
Reviewed By: NatashaKnk
Differential Revision: https://reviews.llvm.org/D133058
Added:
Modified:
mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp b/mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp
index cfa6d87fadbee..04fb3ca79a6f1 100644
--- a/mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp
+++ b/mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp
@@ -610,16 +610,18 @@ OpFoldResult MulOp::fold(ArrayRef<Attribute> operands) {
if (val.isZero())
return lhsAttr;
const int64_t shift = getShift();
- const int64_t shifted = 1 << shift;
+ const int64_t shifted = 1L << shift;
if (val.getSExtValue() == shifted)
return rhs;
}
if (rhsAttr && rhsAttr.isSplat() && resultETy.isa<IntegerType>()) {
auto val = rhsAttr.getSplatValue<APInt>();
+ const int64_t shift = getShift();
+ const int64_t shifted = 1L << shift;
if (val.isZero())
return rhsAttr;
- if (val.getSExtValue() == (1 << getShift()))
+ if (val.getSExtValue() == shifted)
return lhs;
}
More information about the Mlir-commits
mailing list