Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pr: Fix cond yield conversion #771

Merged
merged 1 commit into from
Jan 31, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions lib/vast/Conversion/Parser/ToParser.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

Check notice on line 1 in lib/vast/Conversion/Parser/ToParser.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter (19, 22.04)

Run clang-format on lib/vast/Conversion/Parser/ToParser.cpp

File lib/vast/Conversion/Parser/ToParser.cpp does not conform to Custom style guidelines. (lines 593)
#include "vast/Util/Warnings.hpp"

#include "vast/Conversion/Parser/Passes.hpp"
Expand Down Expand Up @@ -588,14 +588,24 @@
logical_result matchAndRewrite(
op_t op, adaptor_t adaptor, conversion_rewriter &rewriter
) const override {
auto operand = adaptor.getResult().getDefiningOp();
if (auto cast = mlir::dyn_cast< mlir::UnrealizedConversionCastOp >(operand)) {
auto operand = adaptor.getResult();

if (auto cast = mlir::dyn_cast< mlir::UnrealizedConversionCastOp >(operand.getDefiningOp())) {
if (pr::is_parser_type(cast.getOperand(0).getType())) {
rewriter.replaceOpWithNewOp< op_t >(op, cast.getOperand(0));
return mlir::success();
}
}

if (pr::is_parser_type(operand.getType())) {
rewriter.replaceOpWithNewOp< op_t >(op, operand);
return mlir::success();
}

auto cast = rewriter.create< mlir::UnrealizedConversionCastOp >(
op.getLoc(), pr::MaybeDataType::get(op.getContext()), operand
);
rewriter.replaceOpWithNewOp< op_t >(op, cast.getResult(0));
return mlir::success();
}

Expand Down