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

Simplify redundant bitcasts #479

Closed
bcardosolopes opened this issue Feb 21, 2024 · 1 comment · Fixed by #591
Closed

Simplify redundant bitcasts #479

bcardosolopes opened this issue Feb 21, 2024 · 1 comment · Fixed by #591

Comments

@bcardosolopes
Copy link
Member

CIRGen emits bitcasts where some types get later updated to their complete versions, which could result in redundant ones (src and dst with the same type). Those should be eliminated post CIRGen.

Originally posted by @bcardosolopes in #467 (comment)

bcardosolopes pushed a commit that referenced this issue May 8, 2024
Fix #479 .

There are three available stages to place the simplification in.

* A straightforward method is to extend `fold` method for CastOp.
But CIR does not use CanonicalizerPass, so it does not work.
* As for somehow equivalent to it, append a pattern to
`MergeCleanupsPass`.
But now it is mainly for CFG-related simplifications like block merging.
I don't know if this is the proper way. Shall we rename it to a broader
definition?
* Add a new pass for this issue.
This is definitely not very reasonable XD. We won't consider it unless
we're really out of options.

This PR includes the second option. What do you think @bcardosolopes ?
@bcardosolopes
Copy link
Member Author

Filed #593 to track making the same move for other ops

bruteforceboy pushed a commit to bruteforceboy/clangir that referenced this issue Oct 2, 2024
Fix llvm#479 .

There are three available stages to place the simplification in.

* A straightforward method is to extend `fold` method for CastOp.
But CIR does not use CanonicalizerPass, so it does not work.
* As for somehow equivalent to it, append a pattern to
`MergeCleanupsPass`.
But now it is mainly for CFG-related simplifications like block merging.
I don't know if this is the proper way. Shall we rename it to a broader
definition?
* Add a new pass for this issue.
This is definitely not very reasonable XD. We won't consider it unless
we're really out of options.

This PR includes the second option. What do you think @bcardosolopes ?
Hugobros3 pushed a commit to shady-gang/clangir that referenced this issue Oct 2, 2024
Fix llvm#479 .

There are three available stages to place the simplification in.

* A straightforward method is to extend `fold` method for CastOp.
But CIR does not use CanonicalizerPass, so it does not work.
* As for somehow equivalent to it, append a pattern to
`MergeCleanupsPass`.
But now it is mainly for CFG-related simplifications like block merging.
I don't know if this is the proper way. Shall we rename it to a broader
definition?
* Add a new pass for this issue.
This is definitely not very reasonable XD. We won't consider it unless
we're really out of options.

This PR includes the second option. What do you think @bcardosolopes ?
keryell pushed a commit to keryell/clangir that referenced this issue Oct 19, 2024
Fix llvm#479 .

There are three available stages to place the simplification in.

* A straightforward method is to extend `fold` method for CastOp.
But CIR does not use CanonicalizerPass, so it does not work.
* As for somehow equivalent to it, append a pattern to
`MergeCleanupsPass`.
But now it is mainly for CFG-related simplifications like block merging.
I don't know if this is the proper way. Shall we rename it to a broader
definition?
* Add a new pass for this issue.
This is definitely not very reasonable XD. We won't consider it unless
we're really out of options.

This PR includes the second option. What do you think @bcardosolopes ?
lanza pushed a commit that referenced this issue Nov 5, 2024
Fix #479 .

There are three available stages to place the simplification in.

* A straightforward method is to extend `fold` method for CastOp.
But CIR does not use CanonicalizerPass, so it does not work.
* As for somehow equivalent to it, append a pattern to
`MergeCleanupsPass`.
But now it is mainly for CFG-related simplifications like block merging.
I don't know if this is the proper way. Shall we rename it to a broader
definition?
* Add a new pass for this issue.
This is definitely not very reasonable XD. We won't consider it unless
we're really out of options.

This PR includes the second option. What do you think @bcardosolopes ?
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 a pull request may close this issue.

1 participant