-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Worsened debug build codegen in beta #68855
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
@rodrimati1992 out of curiosity, what prompted you to investigate this specific code sequence? (I'm trying to evaluate the severity of this code-quality regression, and it might help for me to get some idea of how wide-spread the problem might be. There are obviously a couple different features interacting in the example you have provided...) |
triage: leaving unprioritized. Nominating for discussion at today's T-compiler triage meeting. |
@pnkfelix |
xorl %eax, %eax
testb $1, %al How does LLVM even generate such a code sequence? Well...: br i1 false, label %bb2, label %bb1, !dbg !945 Okay so I guess LLVM doesn't even simplify the CFG when optimizations are off? Anyway, the MIR differs. This is a constant folding regression. |
I'm guessing this is caused by #67631 We're in a generic context and resolve has to be conservative so it doesn't accidentally try to inline a default value if it could get a different value in an impl. In this situation that can't happen, but I don't know how to coax resolve to know this. |
The fix was already implemented though! Nor do we ever need to use I left comments here: #67662 (comment) |
T-compiler triage: P-medium. Leaving nomination tag on until we actually assign this to someone. |
Use Reveal::All in MIR optimizations Resolves some code review feedback in rust-lang#67662. Fixes rust-lang#68855 r? @eddyb
Use Reveal::All in MIR optimizations Resolves some code review feedback in rust-lang#67662. Fixes rust-lang#68855 r? @eddyb
Uh oh!
There was an error while loading. Please reload this page.
The assembly generated in debug builds (-C opt-level=0) worsened for this code that uses an associated constant from a trait.This seems to be caused by the fact that the function is generic,even though the associated constant doesn't depend on the generic parameters of the function.
The code:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=83dfb31158166b5ed7a92ca5dd7bb610
The entirety of the generated assembly for stable 1.41.0 in a debug build:
The assembly generated for the same functions by rustc 1.42.0-beta.2 (2020-02-04 3d2613e) in a debug build:
The text was updated successfully, but these errors were encountered: