aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/Local.cpp
diff options
context:
space:
mode:
authorRafael Ubal <rubal@mathworks.com>2023-12-12 10:36:52 -0500
committerGitHub <noreply@github.com>2023-12-12 15:36:52 +0000
commita8f3860bcb644d724275f51e7db7b291c7a3f4df (patch)
treeaf9e3d44a7d907b6961657be71ac18902f7813be /llvm/lib/Transforms/Utils/Local.cpp
parentc873f77e87a9ebd02f94d6b9d46e84d43e1ceb38 (diff)
downloadllvm-a8f3860bcb644d724275f51e7db7b291c7a3f4df.zip
llvm-a8f3860bcb644d724275f51e7db7b291c7a3f4df.tar.gz
llvm-a8f3860bcb644d724275f51e7db7b291c7a3f4df.tar.bz2
[mlir][tensor] Fix bug in `tensor.extract(tensor.from_elements)` folder (#75109)
The folder for `tensor.extract` is not operating correctly when it is consuming the result of a `tensor.from_elements` operation. The existing unit test named `@extract_from_tensor.from_elements_3d` in `mlir/test/Dialect/Tensor/canonicalize.mlir` seems an attempt to stress this code. However, this unit tests creates a `tensor.from_elements` op exclusively from constants, which gets folded away into a single constant tensor. Therefore, the buggy code was never executed in unit tests. I have added a new unit test named `@extract_from_tensor.from_elements_variable_3d` that makes sure the `tensor.from_elements` op is not folded away by having its input operands come directly from function arguments. The original folder code would have made this test fail. This bug was notably affecting the lowering of the `tosa.pad` op in the `tosa-to-tensor` pass, where the generated code is likely to contain a `tensor.from_elements` + `tensor.extract` op sequence.
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
0 files changed, 0 insertions, 0 deletions