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

Fix #5987: make rustc generate *only* IR output in generateIR #1

Closed
wants to merge 1 commit into from

Conversation

OfekShilon
Copy link
Owner

All compilations are run asynchronously under await Promise.all in BaseCompiler.doCompilation:
https://github.com/compiler-explorer/compiler-explorer/blob/f3277b8aed2ca12ce961d08ef792c4061a3331ac/lib/base-compiler.ts#L2256-L2261

ASM and MIR processing is done from the main runCompiler and IR from the auxiliary generateIR. But both compilation calls are passed the same options - which include --emit asm for generation of output.s assembly file and --emit mir=... for generation of MIR file. So these 2 identically-named file pairs are generated and cleaned up in both of the parallel compilations, sometimes one compilation cleans up its output before the other one tries to process its own, and mayhem ensues.

This PR makes rust's generateIR indeed generate just IR by filtering switches.

From a design perspective: ideally CE would be more opinionated on which outputs are generated on the main compilation and which on auxiliary ones. I see no reason for MIR to be generated by an additional switch on the main compilation and IR require a different compilation (there's also something called generateRustHir - I don't know what it does and am slightly afraid to ask).
I think most (all?) asm/IR outputs could be generated in a single main compilation, and just post-processed for the different panes in parallel - which could spell very good news also for servers load. But I don't dare say anything categorical about all languages, compilers and output (probably no one does). Would be happy to hear opinions.
(Anyway that's just for sake of discussion, this PR does nothing fancy of that sort)

@OfekShilon OfekShilon closed this Jan 13, 2024
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.

1 participant