1. [LLDB] [lldb-server] Use llvm::InitLLVM for doing unicode conversion of (details)
  2. [FileCheck] Implement --ignore-case option. (details)
  3. Dead Virtual Function Elimination (details)
Commit 807dbee36679a8e43b25c3fcfd38e750fd4e943d by martin
[LLDB] [lldb-server] Use llvm::InitLLVM for doing unicode conversion of
arguments for windows
This should allow lldb-server to operate on files with non-ascii
I tried looking around in lldb/tools, and this seemed like the only
other tool (other than the main lldb driver itself) that would be used
(implicitly) by an end user (which could be working in non-ascii paths).
Differential Revision:
llvm-svn: 374537
The file was modifiedlldb/tools/lldb-server/lldb-server.cpp
Commit 5b5b2fd2b8b4fe66d1e57065ab0aef22b16e4a13 by kai.nacke
[FileCheck] Implement --ignore-case option.
The FileCheck utility is enhanced to support a `--ignore-case` option.
This is useful in cases where the output of Unix tools differs in case
(e.g. case not specified by Posix).
Reviewers: Bigcheese, jakehehrlich, rupprecht, espindola, alexshap,
jhenderson, MaskRay
Differential Revision:
llvm-svn: 374538
The file was modifiedllvm/lib/Support/FileCheck.cpp
The file was modifiedllvm/lib/Support/FileCheckImpl.h
The file was modifiedllvm/include/llvm/Support/FileCheck.h
The file was addedllvm/test/FileCheck/check-ignore-case.txt
The file was modifiedllvm/docs/CommandGuide/FileCheck.rst
The file was modifiedllvm/utils/FileCheck/FileCheck.cpp
Commit 9f6a873268e1ad9855873d9d8007086c0d01cf4f by oliver.stannard
Dead Virtual Function Elimination
Currently, it is hard for the compiler to remove unused C++ virtual
functions, because they are all referenced from vtables, which are
referenced by constructors. This means that if the constructor is called
from any live code, then we keep every virtual function in the final
link, even if there are no call sites which can use it.
This patch allows unused virtual functions to be removed during LTO (and
regular compilation in limited circumstances) by using type metadata to
match virtual function call sites to the vtable slots they might load
from. This information can then be used in the global dead code
elimination pass instead of the references from vtables to virtual
functions, to more accurately determine which functions are reachable.
To make this transformation safe, I have changed clang's code-generation
to always load virtual function pointers using the
llvm.type.checked.load intrinsic, instead of regular load instructions.
I originally tried writing this using clang's existing code-generation,
which uses the llvm.type.test and llvm.assume intrinsics after doing a
normal load. However, it is possible for optimisations to obscure the
relationship between the GEP, load and llvm.type.test, causing GlobalDCE
to fail to find virtual function call sites.
The existing linkage and visibility types don't accurately describe the
scope in which a virtual call could be made which uses a given vtable.
This is wider than the visibility of the type itself, because a virtual
function call could be made using a more-visible base class. I've added
a new
!vcall_visibility metadata type to represent this, described in
TypeMetadata.rst. The internalization pass and libLTO have been updated
to change this metadata when linking is performed.
This doesn't currently work with ThinLTO, because it needs to see every
call to llvm.type.checked.load in the linkage unit. It might be possible
to extend this optimisation to be able to use the ThinLTO summary, as
was done for devirtualization, but until then that combination is
rejected in the clang driver.
To test this, I've written a fuzzer which generates random C++ programs
with complex class inheritance graphs, and virtual functions called
through object and function pointers of different types. The programs
are spread across multiple translation units and DSOs to test the
different visibility restrictions.
I've also tried doing bootstrap builds of LLVM to test this. This isn't
ideal, because only classes in anonymous namespaces can be optimised
-fvisibility=default, and some parts of LLVM (plugins and bugpoint) do
not work correctly with -fvisibility=hidden. However, there are only 12
test failures when building with -fvisibility=hidden (and an unmodified
compiler), and this change does not cause any new failures for either
value of
On the 7 C++ sub-benchmarks of SPEC2006, this gives a geomean code-size
reduction of ~6%, over a baseline compiled with "-O2 -flto
-fvisibility=hidden -fwhole-program-vtables". The best cases are
reductions of ~14% in 450.soplex and 483.xalancbmk, and there are no
code size increases.
I've also run this on a set of 8 mbed-os examples compiled for Armv7M,
which show a geomean size reduction of ~3%, again with no size
I had hoped that this would have no effect on performance, which would
allow it to awlays be enabled (when using -fwhole-program-vtables).
However, the changes in clang to use the llvm.type.checked.load
intrinsic are causing ~1% performance regression in the C++ parts of
SPEC2006. It should be possible to recover some of this perf loss by
teaching optimisations about the llvm.type.checked.load intrinsic, which
would make it worth turning this on by default (though it's still
dependent on -fwhole-program-vtables).
Differential revision:
llvm-svn: 374539
The file was modifiedllvm/lib/Analysis/TypeMetadataUtils.cpp
The file was modifiedllvm/lib/LTO/LTO.cpp
The file was addedclang/test/CodeGenCXX/virtual-function-elimination.cpp
The file was modifiedllvm/test/ThinLTO/X86/lazyload_metadata.ll
The file was addedllvm/test/Transforms/GlobalDCE/vtable-rtti.ll
The file was addedllvm/test/Transforms/GlobalDCE/virtual-functions-derived-call.ll
The file was modifiedllvm/lib/LTO/LTOCodeGenerator.cpp
The file was modifiedclang/lib/CodeGen/ItaniumCXXABI.cpp
The file was modifiedclang/include/clang/Basic/CodeGenOptions.def
The file was modifiedllvm/docs/LangRef.rst
The file was modifiedclang/lib/CodeGen/CGClass.cpp
The file was modifiedclang/lib/Driver/ToolChains/Clang.cpp
The file was modifiedllvm/include/llvm/IR/GlobalObject.h
The file was modifiedllvm/lib/Transforms/IPO/GlobalDCE.cpp
The file was modifiedclang/lib/CodeGen/CGVTables.cpp
The file was modifiedclang/lib/Frontend/CompilerInvocation.cpp
The file was addedllvm/test/Transforms/GlobalDCE/virtual-functions-visibility-post-lto.ll
The file was modifiedllvm/include/llvm/IR/FixedMetadataKinds.def
The file was addedllvm/test/Transforms/GlobalDCE/virtual-functions-derived-pointer-call.ll
The file was modifiedllvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
The file was addedllvm/test/Transforms/GlobalDCE/virtual-functions-base-call.ll
The file was modifiedclang/include/clang/Driver/
The file was addedclang/test/CodeGenCXX/vcall-visibility-metadata.cpp
The file was addedllvm/test/Transforms/GlobalDCE/virtual-functions-base-pointer-call.ll
The file was modifiedllvm/lib/IR/Metadata.cpp
The file was modifiedllvm/docs/TypeMetadata.rst
The file was modifiedllvm/include/llvm/Analysis/TypeMetadataUtils.h
The file was addedllvm/test/Transforms/GlobalDCE/virtual-functions-visibility-pre-lto.ll
The file was modifiedclang/lib/CodeGen/CodeGenModule.h
The file was addedclang/test/Driver/virtual-function-elimination.cpp
The file was modifiedllvm/include/llvm/Transforms/IPO/GlobalDCE.h
The file was addedllvm/test/LTO/ARM/lto-linking-metadata.ll
The file was addedllvm/test/Transforms/GlobalDCE/virtual-functions.ll
The file was addedllvm/test/Transforms/Internalize/vcall-visibility.ll