-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed as not planned
Labels
llvm:optimizationsquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!
Description
Here is the test case
struct A {
virtual int f() {
return 1;
}
int call_f() {
return f();
}
};
struct C final: public A {
int f() override {
return 3;
}
};
int test1(C& c) {
return c.f();
}
int test2(C& c) {
return c.call_f();
}Both Clang and GCC devirtualize f call in test1 but not in test2 - why is that so? C is final, what is the scenario when call to C::call_f does not lead to C::f?
https://godbolt.org/z/6Kv38jeYo
mmatrosov and cdkrot
Metadata
Metadata
Assignees
Labels
llvm:optimizationsquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!