commit | 1679f5a84ae1e578b0de347c89eaf31e0465f33c | [log] [tgz] |
---|---|---|
author | Anders Carlsson <andersca@mac.com> | Sat Jan 29 03:52:01 2011 +0000 |
committer | Anders Carlsson <andersca@mac.com> | Sat Jan 29 03:52:01 2011 +0000 |
tree | 63f9aeb69eaefebba9deaaf42f54816f19f69de2 | |
parent | 336a7dc56871ccfeceecc296c9624f66f7ac01ec [diff] [blame] |
When calling a virtual member function on a base class and the most derived class is marked 'final', we can devirtualize the call. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124524 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGenCXX/devirtualize-virtual-function-calls-final.cpp b/test/CodeGenCXX/devirtualize-virtual-function-calls-final.cpp index f6f2a49..08a9490 100644 --- a/test/CodeGenCXX/devirtualize-virtual-function-calls-final.cpp +++ b/test/CodeGenCXX/devirtualize-virtual-function-calls-final.cpp
@@ -23,3 +23,17 @@ return a->f(); } } + +namespace Test3 { + struct A { + virtual int f(); + }; + + struct B final : A { }; + + // CHECK: define i32 @_ZN5Test31fEPNS_1BE + int f(B *b) { + // CHECK: call i32 @_ZN5Test31A1fEv + return b->f(); + } +}