IRGen: Move vtable load after argument evaluation.
authorPeter Collingbourne <peter@pcc.me.uk>
Mon, 5 Feb 2018 23:09:13 +0000 (23:09 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Mon, 5 Feb 2018 23:09:13 +0000 (23:09 +0000)
commitea21100272c1076a34c34624a659a5a8e8ccaf76
tree9919ae0cac7f1705e1031da442de4bf3a902ee0b
parent3c748e55d54e542ff15e6c0636ac77b7a492b8c9
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

llvm-svn: 324286
clang/lib/CodeGen/CGCXXABI.h
clang/lib/CodeGen/CGCall.cpp
clang/lib/CodeGen/CGCall.h
clang/lib/CodeGen/CGExprCXX.cpp
clang/lib/CodeGen/ItaniumCXXABI.cpp
clang/lib/CodeGen/MicrosoftCXXABI.cpp
clang/test/CodeGenCXX/cfi-vcall-check-after-args.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/cxx2a-destroying-delete.cpp
clang/test/CodeGenCXX/microsoft-abi-multiple-nonvirtual-inheritance.cpp
clang/test/CodeGenCXX/microsoft-abi-virtual-inheritance.cpp
clang/test/CodeGenCXX/microsoft-abi-vtables-multiple-nonvirtual-inheritance-this-adjustment.cpp