diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2018-02-05 23:09:13 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2018-02-05 23:09:13 +0000 |
commit | 6102cb5d3132c010d2418a9109b89c65ebec6879 (patch) | |
tree | 5314eb7b0f47fa2acced4ba7517686d56d5c325c /lib/CodeGen/CGExprCXX.cpp | |
parent | 9018322d0ffb51099c9a6ca7827bf14a2d2805d1 (diff) | |
download | clang-6102cb5d3132c010d2418a9109b89c65ebec6879.tar.gz |
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 'lib/CodeGen/CGExprCXX.cpp')
-rw-r--r-- | lib/CodeGen/CGExprCXX.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/CodeGen/CGExprCXX.cpp b/lib/CodeGen/CGExprCXX.cpp index 9a18751fc2..9f70ef3dcd 100644 --- a/lib/CodeGen/CGExprCXX.cpp +++ b/lib/CodeGen/CGExprCXX.cpp @@ -371,9 +371,7 @@ RValue CodeGenFunction::EmitCXXMemberOrOperatorMemberCallExpr( CGM.GetAddrOfFunction(GlobalDecl(Ctor, Ctor_Complete), Ty), Ctor); } else if (UseVirtualCall) { - Callee = CGM.getCXXABI().getVirtualFunctionPointer(*this, MD, - This.getAddress(), Ty, - CE->getLocStart()); + Callee = CGCallee::forVirtual(CE, MD, This.getAddress(), Ty); } else { if (SanOpts.has(SanitizerKind::CFINVCall) && MD->getParent()->isDynamicClass()) { |