[all-commits] [llvm/llvm-project] f10302: [mlir] Require folders to produce Values of same t...
Matthias Springer via All-commits
all-commits at lists.llvm.org
Tue Dec 19 21:39:36 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: f10302e3fa468a22a43e7d6bd6ec75919c60d72d
https://github.com/llvm/llvm-project/commit/f10302e3fa468a22a43e7d6bd6ec75919c60d72d
Author: Matthias Springer <me at m-sp.org>
Date: 2023-12-20 (Wed, 20 Dec 2023)
Changed paths:
M flang/lib/Optimizer/Dialect/FIROps.cpp
M mlir/lib/Dialect/Arith/IR/ArithOps.cpp
M mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp
M mlir/lib/Dialect/Vector/IR/VectorOps.cpp
M mlir/lib/IR/Builders.cpp
M mlir/lib/IR/Operation.cpp
M mlir/lib/Transforms/Utils/FoldUtils.cpp
M mlir/test/Transforms/test-canonicalize.mlir
M mlir/test/Transforms/test-legalizer.mlir
M mlir/test/lib/Dialect/Test/TestDialect.cpp
M mlir/test/lib/Dialect/Test/TestOps.td
Log Message:
-----------
[mlir] Require folders to produce Values of same type (#75887)
This commit adds extra assertions to `OperationFolder` and `OpBuilder`
to ensure that the types of the folded SSA values match with the result
types of the op. There used to be checks that discard the folded results
if the types do not match. This commit makes these checks stricter and
turns them into assertions.
Discarding folded results with the wrong type (without failing
explicitly) can hide bugs in op folders. Two such bugs became apparent
in MLIR (and some more in downstream projects) and are fixed with this
change.
Note: The existing type checks were introduced in
https://reviews.llvm.org/D95991.
Migration guide: If you see failing assertions (`folder produced value
of incorrect type`; make sure to run with assertions enabled!), run with
`-debug` or dump the operation right before the failing assertion. This
will point you to the op that has the broken folder. A common mistake is
a mismatch between static/dynamic dimensions (e.g., input has a static
dimension but folded result has a dynamic dimension).
More information about the All-commits
mailing list