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] Use preferred cast style, NFC #5401

Merged
merged 2 commits into from
Jun 15, 2023
Merged

Conversation

uenoku
Copy link
Member

@uenoku uenoku commented Jun 14, 2023

As mentioned in https://discourse.llvm.org/t/preferred-casting-style-going-forward/68443 and https://mlir.llvm.org/deprecation/, x.dyn_cast<T>/x.cast<T>/x.isa<T> are deprecated. This commit replaces cast member functions in FIRRTL dialect with dyn_cast<T>(x)/cast<T>(x)/isa<T>(x).

This will make it a lot easier to migrate into type alias aware type_cast. We also need to refactor tablegen files as well but it will be done in a follow-up to avoid the conflict with #5399

As mentioned in https://mlir.llvm.org/deprecation/, `x.dyn_cast<T>/x.cast<T>/x.isa<T>`
are deprecated. This commit replaces each of them wtih `dyn_cast<T>(x)/cast<T>(x)/isa<T>(x)`.

This will make it a lot easier to migrate into type alias aware type_cast.
@uenoku uenoku force-pushed the dev/uenoku/change-cast-style branch from 3cae38f to 9a1731f Compare June 14, 2023 10:20
@@ -732,7 +732,7 @@ Attribute Visitor::convertVectorConstant(FVectorType oldType,
newElements.push_back(convertConstant(oldElementType, oldElement));
}

auto bundleType = newElementType.cast<BundleType>();
auto bundleType = dyn_cast<BundleType>(newElementType);
Copy link
Contributor

Choose a reason for hiding this comment

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

was this cast to dyn_cast intentional ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks! It seems mistake 😔

Copy link
Contributor

@mikeurbach mikeurbach left a comment

Choose a reason for hiding this comment

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

Awesome, I hope we can get this in quick. I didn't review in detail, but we'll want this at some point anyway.

Copy link
Contributor

@prithayan prithayan left a comment

Choose a reason for hiding this comment

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

Looks good, as far as I could scan through the lines.

@uenoku uenoku merged commit bb14a6f into main Jun 15, 2023
@uenoku uenoku deleted the dev/uenoku/change-cast-style branch June 15, 2023 01:00
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.

3 participants