Skip to content

Commit

Permalink
[mlir][tensor] Fix gcc build (ValueBoundsOpInterface)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
matthias-springer committed Apr 7, 2023
1 parent 5e2afe5 commit 06d0cd1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mlir/lib/Dialect/Tensor/IR/ValueBoundsOpInterfaceImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
};

Expand Down

0 comments on commit 06d0cd1

Please sign in to comment.