Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a new command to
collector, calledcodegen_diff. It takes as input the name of a single runtime benchmark group, the type of codegen you are interested in (assembly, assembly interleraved with Rust source, LLVM IR or MIR) and two versions of the compiler. It then uses the cargo-show-asm tool to compute the codegen and diff it between the two compiler versions.The diff is computed separately for each symbol (function) found in the benchmark crate. We therefore have to match the same function between two
rustcversions (toolchains) by its symbol name. By default,cargo asmdoesn't include hashes in the symbol names, which helps making sure that the name will stay the same, but it also means that a different version of the same function (e.g. one monomorphized with a different generic argument) will get matched between two toolchains. There is acargo asmflag called--full-namewhich includes the hashes in the symbol names, which would resolve this issue. However, there is a problem with that - different versions of the compiler produce different hashes, and this doesn't seem to be easily fixable. Therefore, I don't include the hashes in the symbol names, and I also opted in to thev0mangling scheme, as it seems to me that with it more functions are matched even without the hashes.The diff for each function is then printed to stdout, with colors if the output is a terminal. Eventually we might want to display some small HTML page so that the diff is easier to understand (?).