Skip to content

[CIR][ThroughMLIR] Templatize unary math op lowerings. #1557

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

Merged
merged 4 commits into from
Apr 11, 2025

Conversation

goxul
Copy link
Contributor

@goxul goxul commented Apr 11, 2025

A lot of the unary math op lowerings follow the same template -- we can templatize this to remove redundant code and make things a little more neater. (Similar to what we do here)

I've checked all existing LIT tests via ninja clang-check-cir and they seem to be passing fine.

@goxul goxul changed the title [CIR][ThroughMLIR] Templatize math op lowerings. [CIR][ThroughMLIR] Templatize unary math op lowerings. Apr 11, 2025
Copy link

github-actions bot commented Apr 11, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@el-ev
Copy link
Member

el-ev commented Apr 11, 2025

Could we use TableGen for this? AFAIK, these conversion patterns for intrinsics in the LowerToLLVM pass are generated. (See LLVMLoweringInfo class in CIROps.td.)

@goxul
Copy link
Contributor Author

goxul commented Apr 11, 2025

Could we use TableGen for this? AFAIK, these conversion patterns for intrinsics in the LowerToLLVM pass are generated. (See LLVMLoweringInfo class in CIROps.td.)

I found the PR here which introduced these changes -- let me see if I can remodel this PR to use TableGen, instead of a template. Just found this comment by @bcardosolopes as well which suggests the same.

Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

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

LGTM

@bcardosolopes
Copy link
Member

All test failures are unrelated, merging!

@bcardosolopes bcardosolopes merged commit 6502f55 into llvm:main Apr 11, 2025
6 of 9 checks passed
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