summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/microsoft-abi-vtables-multiple-nonvirtual-inheritance-this-adjustment.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2018-02-05 23:09:13 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2018-02-05 23:09:13 +0000
commit6102cb5d3132c010d2418a9109b89c65ebec6879 (patch)
tree5314eb7b0f47fa2acced4ba7517686d56d5c325c /test/CodeGenCXX/microsoft-abi-vtables-multiple-nonvirtual-inheritance-this-adjustment.cpp
parent9018322d0ffb51099c9a6ca7827bf14a2d2805d1 (diff)
IRGen: Move vtable load after argument evaluation.
This change reduces the live range of the loaded function pointer, resulting in a slight code size decrease (~10KB in clang), and also improves the security of CFI for virtual calls by making it less likely that the function pointer will be spilled, and ensuring that it is not spilled across a function call boundary. Fixes PR35353. Differential Revision: https://reviews.llvm.org/D42725 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324286 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/microsoft-abi-vtables-multiple-nonvirtual-inheritance-this-adjustment.cpp')
-rw-r--r--test/CodeGenCXX/microsoft-abi-vtables-multiple-nonvirtual-inheritance-this-adjustment.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/test/CodeGenCXX/microsoft-abi-vtables-multiple-nonvirtual-inheritance-this-adjustment.cpp b/test/CodeGenCXX/microsoft-abi-vtables-multiple-nonvirtual-inheritance-this-adjustment.cpp
index 385e9cc17b..2aa5f34382 100644
--- a/test/CodeGenCXX/microsoft-abi-vtables-multiple-nonvirtual-inheritance-this-adjustment.cpp
+++ b/test/CodeGenCXX/microsoft-abi-vtables-multiple-nonvirtual-inheritance-this-adjustment.cpp
@@ -156,23 +156,17 @@ struct C : public A, public B {
// BITCODE-LABEL: define {{.*}}\01?ffun@test4@@YAXAAUC@1@@Z
void ffun(C &c) {
- // BITCODE: load
- // BITCODE: bitcast
- // BITCODE: bitcast
// BITCODE: [[THIS1:%.+]] = bitcast %"struct.test4::C"* {{.*}} to i8*
// BITCODE: [[THIS2:%.+]] = getelementptr inbounds i8, i8* [[THIS1]], i32 4
- // BITCODE-NEXT: call x86_thiscallcc {{.*}}(i8* [[THIS2]])
+ // BITCODE: call x86_thiscallcc {{.*}}(i8* [[THIS2]])
c.bar();
}
// BITCODE-LABEL: define {{.*}}\01?fop@test4@@YAXAAUC@1@@Z
void fop(C &c) {
- // BITCODE: load
- // BITCODE: bitcast
- // BITCODE: bitcast
// BITCODE: [[THIS1:%.+]] = bitcast %"struct.test4::C"* {{.*}} to i8*
// BITCODE: [[THIS2:%.+]] = getelementptr inbounds i8, i8* [[THIS1]], i32 4
- // BITCODE-NEXT: call x86_thiscallcc {{.*}}(i8* [[THIS2]])
+ // BITCODE: call x86_thiscallcc {{.*}}(i8* [[THIS2]])
-c;
}