Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix compiler-explorer#5987: make rustc generate *only* IR output in g…
…enerateIR (compiler-explorer#5988) All compilations run asynchronously under `await Promise.all` in `BaseCompiler.doCompilation`: https://github.com/compiler-explorer/compiler-explorer/blob/f3277b8aed2ca12ce961d08ef792c4061a3331ac/lib/base-compiler.ts#L2256-L2263 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)
- Loading branch information