From 06d0cd1e81c19cecedbf86356bc7bfb532a1ea80 Mon Sep 17 00:00:00 2001 From: Matthias Springer Date: Fri, 7 Apr 2023 10:33:13 +0900 Subject: [PATCH] [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. --- mlir/lib/Dialect/Tensor/IR/ValueBoundsOpInterfaceImpl.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mlir/lib/Dialect/Tensor/IR/ValueBoundsOpInterfaceImpl.cpp b/mlir/lib/Dialect/Tensor/IR/ValueBoundsOpInterfaceImpl.cpp index 8d6baa184af7..757885a736ae 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(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; } };