-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Suboptimal invoke-related codegen for default trait impls #43150
Comments
This happens because we don't run MIR optimizations after monomorphization. In the "default trait impl" case, we don't know that trans actually knows this landing pad is a no-op, but trans does not, and probably should not, perform that sort of optimization. |
@arielb1 I'm a little confused, is this not a bug? I'd personally at least consider this a compile time performance issue? We've had a lot of issues in the past with |
The "bug" is that we are not doing MIR optimizations on monomorphized code. This is far from the only way that can cause LLVM slowness. The LLVM problem on MSVC is indeed a (different) bug. |
@arielb1 is there another bug to reference here? This behavior is actively causing bugs so I just want to make sure we don't forget about this. |
ping @arielb1, just wanted to make sure this wasn't lost, is there a way to make sure we don't forget about this? |
i can't imagine us implementing post-monomorphization MIR optimizations in a way that does not fix this, and I find it hard to imagine us special-case-fixing this. |
Is there tracking issue for that? |
It looks like default methods in traits will always use
invoke
whereas defined methods will hit the optimization to not useinvoke
:will yield this IR, notably:
Note that
<i32 as A>::foo1
uses aninvoke
instruction whereas<i32 as A>::foo2
does not.The text was updated successfully, but these errors were encountered: