[Mlir-commits] [mlir] 06d0cd1 - [mlir][tensor] Fix gcc build (ValueBoundsOpInterface)

Matthias Springer llvmlistbot at llvm.org
Thu Apr 6 18:42:37 PDT 2023


Author: Matthias Springer
Date: 2023-04-07T10:42:27+09:00
New Revision: 06d0cd1e81c19cecedbf86356bc7bfb532a1ea80

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

LOG: [mlir][tensor] Fix gcc build (ValueBoundsOpInterface)

The order of evaluation of a sum (e.g., `a() + b()`) is unspecified in
C++. clang evaluates left-to-right. gcc evaluate right-to-left. This led
to slighly different (but equivalent) affine_map in a test and the
FileCheck did not match anymore.

Added: 
    

Modified: 
    mlir/lib/Dialect/Tensor/IR/ValueBoundsOpInterfaceImpl.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Tensor/IR/ValueBoundsOpInterfaceImpl.cpp b/mlir/lib/Dialect/Tensor/IR/ValueBoundsOpInterfaceImpl.cpp
index 8d6baa184af7b..757885a736ae6 100644
--- a/mlir/lib/Dialect/Tensor/IR/ValueBoundsOpInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/Tensor/IR/ValueBoundsOpInterfaceImpl.cpp
@@ -86,10 +86,10 @@ struct PadOpInterface
     auto padOp = cast<PadOp>(op);
     assert(value == padOp.getResult() && "invalid value");
 
-    AffineExpr expr = cstr.getExpr(padOp.getSource(), dim) +
-                      cstr.getExpr(padOp.getMixedLowPad()[dim]) +
-                      cstr.getExpr(padOp.getMixedHighPad()[dim]);
-    cstr.bound(value)[dim] == expr;
+    AffineExpr srcSize = cstr.getExpr(padOp.getSource(), dim);
+    AffineExpr lowPad = cstr.getExpr(padOp.getMixedLowPad()[dim]);
+    AffineExpr highPad = cstr.getExpr(padOp.getMixedHighPad()[dim]);
+    cstr.bound(value)[dim] == srcSize + lowPad + highPad;
   }
 };
 


        


More information about the Mlir-commits mailing list