-
Notifications
You must be signed in to change notification settings - Fork 247
Added a transformation that gets rid of temporary composites. #690
Conversation
khyperia
left a comment
There was a problem hiding this 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!
crates/rustc_codegen_spirv/src/linker/destructure_composites.rs
Outdated
Show resolved
Hide resolved
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
813db5c to
b835301
Compare
|
Should be ready now! |
khyperia
left a comment
There was a problem hiding this 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); | ||
| } |
There was a problem hiding this comment.
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.
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.