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

[FIRRTL][LowerType] Handle unrealized_conversion_cast of other dialects #6422

Merged
merged 2 commits into from
Nov 17, 2023

Conversation

prithayan
Copy link
Contributor

LowerTypes was crashing when lowering unrealized_conversion_cast from other dialects.
This PR fixes the crash and ignores the cast op from other dialects instead of lowering them.

@@ -1334,6 +1334,10 @@ bool TypeLoweringVisitor::visitExpr(mlir::UnrealizedConversionCastOp op) {
return builder->create<mlir::UnrealizedConversionCastOp>(field.type, input)
.getResult(0);
};
// If the input to the cast is an unknown type, getSubWhatever cannot handle
// it, donot lower the op.
if (!isa<FVectorType, BundleType, RefType>(op->getOperand(0).getType()))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it may be better to continue to error if we don't support lowering the thing if it's a FIRRTL type?
(only ignore if it's not a FIRRTL type, I mean)

Also I think this maybe should be using type_isa, e.g., !type_isa<FIRRTLType>(...)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @dtzSiFive , makes sense, this is required only for other dialects. Updated the check.

@prithayan prithayan merged commit 8da7ce4 into main Nov 17, 2023
4 checks passed
@prithayan prithayan deleted the dev/pbarua/lowertype_unrealized_cast branch November 17, 2023 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants