[all-commits] [llvm/llvm-project] c9c1b3: [mlir][memref] Fix an invalid dim loop motion cras...
Rik Huijzer via All-commits
all-commits at lists.llvm.org
Sun Dec 3 23:58:12 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: c9c1b3c37fa5d5c617068afe67afcafacd58a241
https://github.com/llvm/llvm-project/commit/c9c1b3c37fa5d5c617068afe67afcafacd58a241
Author: Rik Huijzer <github at huijzer.xyz>
Date: 2023-12-04 (Mon, 04 Dec 2023)
Changed paths:
M mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
M mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
M mlir/test/Transforms/loop-invariant-code-motion.mlir
Log Message:
-----------
[mlir][memref] Fix an invalid dim loop motion crash (#74204)
Fixes https://github.com/llvm/llvm-project/issues/73382.
This PR suggests to replace two assertions that were introduced in
https://github.com/llvm/llvm-project/commit/adabce41185910227ca276a1cfd22e76443dd238
(https://reviews.llvm.org/D135748). According to the enum definition of
`NotSpeculatable`, an op that invokes undefined behavior is
`NotSpeculatable`.
https://github.com/llvm/llvm-project/blob/0c06e8745f131d867c566f4d35a7a04e24b4a075/mlir/include/mlir/Interfaces/SideEffectInterfaces.h#L248-L258
and both `tensor.dim` and `memref.dim` state that "If the dimension
index is out of bounds, the behavior is undefined."
So therefore it seems to me that `DimOp::getSpeculatability()` should
return `NotSpeculatable` if the dimension index is out of bounds.
The added test is just a simplified version of
https://github.com/llvm/llvm-project/issues/73382.
More information about the All-commits
mailing list