Skip to content
This repository was archived by the owner on Oct 31, 2025. It is now read-only.

Conversation

@ElectronicRU
Copy link
Contributor

Those temporary composites result from inlining of multi-argument
closures. Not only are they rather useless, they're also sometimes
invalid, when an argument to said closure is e.g. a pointer.

@ElectronicRU ElectronicRU changed the title Added an optimization that gets rid of temporary composites. Added a transformation that gets rid of temporary composites. Jul 18, 2021
Copy link
Contributor

@khyperia khyperia left a comment

Choose a reason for hiding this comment

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

Goodness this is wonderful, I've been wanting to do this since forever (it's #69), but just never got around to doing it.

Unfortunately yeah, this is only one "layer" deep of composites, and so it's not a full solution (structs within structs still need to be dealt with), but it's most definitely better than nothing and I'm more than happy to accept this. AFAIK spirv-opt's version of this pass just runs a one-layer version repeatedly until all layers are peeled away, LLVM's version might too but not 100% sure.

A few small comments, but as a whole this looks really great!

Those temporary composites result from inlining of multi-argument
closures. Not only are they rather useless, they're also sometimes
invalid, when an argument to said closure is e.g. a pointer.
- delay only if the instruction is in reference set
- properly mark composites being inserted into composites as used
@ElectronicRU
Copy link
Contributor Author

Should be ready now!

@ElectronicRU ElectronicRU requested a review from khyperia August 4, 2021 21:22
Copy link
Contributor

@khyperia khyperia left a comment

Choose a reason for hiding this comment

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

LGTM pending one nit!

{
let _timer = sess.timer("link_remove_duplicate_lines_2");
duplicates::remove_duplicate_lines(output);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than running this again, please move the original one here and only run it once. The original is where it is now because none of the later passes could modify function contents, but now with #691, DCE can.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants