[Mlir-commits] [mlir] c173c04 - [mlir][tosa] Fix windows build-bot error due to implicit i64 cast

Rob Suderman llvmlistbot at llvm.org
Tue Aug 30 13:02:57 PDT 2022


Author: Rob Suderman
Date: 2022-08-30T13:00:06-07:00
New Revision: c173c04b12ce3d192747f520c66f92cfd68b862a

URL: https://github.com/llvm/llvm-project/commit/c173c04b12ce3d192747f520c66f92cfd68b862a
DIFF: https://github.com/llvm/llvm-project/commit/c173c04b12ce3d192747f520c66f92cfd68b862a.diff

LOG: [mlir][tosa] Fix windows build-bot error due to implicit i64 cast

There is an implicit i64 cast due to the << during MulOp's folder.

Reviewed By: NatashaKnk

Differential Revision: https://reviews.llvm.org/D132969

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 fe63711702258..cfa6d87fadbee 100644
--- a/mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp
+++ b/mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp
@@ -609,7 +609,9 @@ OpFoldResult MulOp::fold(ArrayRef<Attribute> operands) {
     auto val = lhsAttr.getSplatValue<APInt>();
     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;
   }
 


        


More information about the Mlir-commits mailing list