-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
I-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
This code contains two offset calculations and two function pointer loads:
#![crate_type="lib"]
pub struct Wrapper<T: ?Sized> {
x: usize,
y: usize,
t: T
}
pub trait Foo {
fn foo(&self);
}
pub fn test(foo: &Wrapper<Foo>) {
foo.t.foo();
foo.t.foo();
}
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.
Metadata
Metadata
Assignees
Labels
I-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.