-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
LLVM pessimises vtable loads. #39992
Labels
I-slow
Issue: Problems and improvements with respect to performance of generated code.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
/cc @rust-lang/compiler |
Aatch
added
I-slow
Issue: Problems and improvements with respect to performance of generated code.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
Feb 21, 2017
Aatch
added a commit
to Aatch/rust
that referenced
this issue
Feb 21, 2017
Give LLVM much more information about vtable pointers. Without the extra information, LLVM has to be rather pessimistic about vtables, preventing a number of obvious optimisations. * Makes the vtable pointer argument noalias and readonly. * Marks loads of the vtable pointer as nonnull. * Marks load from the vtable with `!invariant.load` metadata. Fixes rust-lang#39992
eddyb
added a commit
to eddyb/rust
that referenced
this issue
Feb 25, 2017
Set metadata for vtable-related loads Give LLVM much more information about vtable pointers. Without the extra information, LLVM has to be rather pessimistic about vtables, preventing a number of obvious optimisations. * Makes the vtable pointer argument noalias and readonly. * Marks loads of the vtable pointer as nonnull. * Marks load from the vtable with `!invariant.load` metadata. Fixes rust-lang#39992
eddyb
added a commit
to eddyb/rust
that referenced
this issue
Feb 25, 2017
Set metadata for vtable-related loads Give LLVM much more information about vtable pointers. Without the extra information, LLVM has to be rather pessimistic about vtables, preventing a number of obvious optimisations. * Makes the vtable pointer argument noalias and readonly. * Marks loads of the vtable pointer as nonnull. * Marks load from the vtable with `!invariant.load` metadata. Fixes rust-lang#39992
Any way to help LLVM move vtable stuff out of a tight loop? This playrust:
Generates the tight loop:
while it seems to me the vtable access should be out of the loop, and it shouldn't be hard... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
I-slow
Issue: Problems and improvements with respect to performance of generated code.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
This code contains two offset calculations and two function pointer loads:
Playpen
LLVM should be able to remove all but the first occurrences via common subexpression elimination, but for some reason it reloads from the vtable pointer each time. The only reasonable explanation I can think of is that LLVM assumes that the vtable pointer may alias some pointer that the called function manipulates.
The text was updated successfully, but these errors were encountered: