[mlir][LLVMIR target] Fix llvm.freeze builder to prevent crashes
authorKrzysztof Drewniak <Krzysztof.Drewniak@amd.com>
Wed, 7 Dec 2022 21:05:58 +0000 (21:05 +0000)
committerKrzysztof Drewniak <Krzysztof.Drewniak@amd.com>
Mon, 12 Dec 2022 19:43:31 +0000 (19:43 +0000)
commit392cc842c26bfc301ea622792a456e9d83aa7dca
tree63c7eb4a5dd008657165a67e0ac024b6444cb81e
parentf39b47264edda30b90ea9cc435fc1434a2e06edc
[mlir][LLVMIR target] Fix llvm.freeze builder to prevent crashes

The freeze builder did not assign the result of creating the freeze
operation to $res, which meant that when subsequent translations (such
as a sext) tried to use that result or query its type, mlir-translate
would crash.

This fixes the issue and adds a test for it.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D139574
mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
mlir/test/Target/LLVMIR/llvmir.mlir