SuccessChanges

Summary

  1. [InlineCost] Implement cost-benefit-based inliner (details)
  2. [clang][cli] Port TargetOpts simple string based options to new option parsing system (details)
  3. [clang][cli] Port LangOpts simple string based options to new option parsing system (details)
  4. [clang][cli] Port PreprocessorOpts simple string based options to new option parsing system (details)
  5. [clang][cli] Port FrontendOpts simple string based options to new option parsing system (details)
  6. [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (details)
  7. Make Expr::HasSideEffect more precise for instantiation-dependent (details)
  8. [libcxx] Make filesystem::path::value_type wchar_t on windows (details)
  9. [libcxx] Reorder the two u8path functions, to make the following diff more readable. NFC. (details)
  10. [libcxx] Convert paths to/from the right narrow code page for narrow strings on windows (details)
  11. [libcxx] Fix the preexisting directory_iterator code for windows (details)
  12. [clang][cli] Port CodeGenOpts simple string flags to new option parsing system (details)
Commit 9895c7012d61525ed541ef74d9eb43300bac9b0c by kazu
[InlineCost] Implement cost-benefit-based inliner

This patch adds an alternative cost metric for the inliner to take
into account both the cost (i.e. size) and cycle count savings into
account.

Without this patch, we decide to inline a given call site if the size
of inlining the call site is below the threshold that is computed
according to the hotness of the call site.

This patch adds a new cost metric, turned off by default, to take over
the handling of hot call sites.  Specifically, with the new cost
metric, we decide to inline a given call site if the ratio of cycle
savings to size exceeds a threshold.  The cycle savings are computed
from call site costs, parameter propagation, folded conditional
branches, etc, all weighted by their respective profile counts.  The
size is primarily the callee size, but we subtract call site costs and
the size of basic blocks that are never executed.

The new cost metric implicitly takes advantage of the machine function
splitter recently introduced by Snehasish Kumar, which dramatically
reduces the cost of duplicating (e.g. inlining) cold basic blocks by
placing cold basic blocks of hot functions in the .text.split
section.

We evaluated the new cost metric on clang bootstrap and SPECInt 2017.

For clang bootstrap, we observe 0.69% runtime improvement.

For SPECInt we report the change in IntRate the C/C++ benchmarks.  All
benchmarks apart from perlbench and omnetpp improve, on average by
0.21% with the max for mcf at 1.96%.

Benchmark               % Change
500.perlbench_r         -0.45
502.gcc_r                0.13
505.mcf_r                1.96
520.omnetpp_r           -0.28
523.xalancbmk_r          0.49
525.x264_r               0.00
531.deepsjeng_r          0.00
541.leela_r              0.35
557.xz_r                 0.21

Differential Revision: https://reviews.llvm.org/D92780
The file was modifiedllvm/lib/Analysis/InlineCost.cpp
Commit ff4b76d74f38a3816495c9914789e87a95525cf4 by jan_svoboda
[clang][cli] Port TargetOpts simple string based options to new option parsing system

Depends on D84190

Reviewed By: Bigcheese

Original patch by Daniel Grumberg.

Differential Revision: https://reviews.llvm.org/D84668
The file was modifiedclang/lib/Frontend/CompilerInvocation.cpp
The file was modifiedclang/include/clang/Driver/Options.td
Commit aec2991d083a9c5b92f94d84a7b3a7bbed405af8 by jan_svoboda
[clang][cli] Port LangOpts simple string based options to new option parsing system

Depends on D84670

Reviewed By: Bigcheese

Original patch by Daniel Grumberg.

Differential Revision: https://reviews.llvm.org/D84671
The file was modifiedclang/include/clang/Driver/Options.td
The file was modifiedclang/lib/Frontend/CompilerInvocation.cpp
The file was modifiedclang/include/clang/Basic/DiagnosticFrontendKinds.td
Commit d1b3f82e51378dd9fb5a23806d8fa906151f5e7b by jan_svoboda
[clang][cli] Port PreprocessorOpts simple string based options to new option parsing system

Depends on D84671

Reviewed By: Bigcheese

Original patch by Daniel Grumberg.

Differential Revision: https://reviews.llvm.org/D84672
The file was modifiedclang/lib/Frontend/CompilerInvocation.cpp
The file was modifiedclang/include/clang/Driver/Options.td
Commit 333d41e9eb8b5f6cd67d318e84ee8dba99b840cc by jan_svoboda
[clang][cli] Port FrontendOpts simple string based options to new option parsing system

Depends on D84189

Reviewed By: dexonsmith

Original patch by Daniel Grumberg.

Differential Revision: https://reviews.llvm.org/D84190
The file was modifiedclang/include/clang/Driver/Options.td
The file was modifiedclang/lib/Frontend/CompilerInvocation.cpp
Commit 9e08e51a20d0d2b1c5724bb17e969d036fced4cd by richard
[c++20] P1907R1: Support for generalized non-type template arguments of scalar type.
The file was modifiedclang/lib/Serialization/ASTWriter.cpp
The file was modifiedclang/lib/AST/StmtProfile.cpp
The file was modifiedclang/lib/AST/MicrosoftMangle.cpp
The file was modifiedclang/lib/AST/ODRHash.cpp
The file was modifiedclang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp
The file was modifiedclang/lib/Index/USRGeneration.cpp
The file was addedclang/test/CodeGenCXX/template-arguments.cpp
The file was modifiedclang/include/clang/AST/TemplateArgumentVisitor.h
The file was modifiedclang/include/clang/AST/PropertiesBase.td
The file was modifiedclang/lib/Sema/SemaTemplateInstantiate.cpp
The file was modifiedclang/lib/AST/ASTContext.cpp
The file was modifiedclang/lib/CodeGen/CGDebugInfo.cpp
The file was modifiedclang/lib/AST/ItaniumMangle.cpp
The file was modifiedclang/lib/AST/TypeLoc.cpp
The file was modifiedclang/lib/AST/ASTStructuralEquivalence.cpp
The file was modifiedclang/lib/AST/ASTImporter.cpp
The file was modifiedclang/include/clang/Serialization/ASTRecordWriter.h
The file was modifiedclang/include/clang/AST/RecursiveASTVisitor.h
The file was modifiedclang/lib/Sema/SemaTemplateDeduction.cpp
The file was modifiedclang/test/CodeGenCXX/mangle-ms-templates.cpp
The file was modifiedclang/include/clang/Sema/Sema.h
The file was modifiedclang/test/SemaTemplate/temp_arg_nontype_cxx17.cpp
The file was modifiedclang/include/clang/AST/TemplateBase.h
The file was modifiedclang/lib/Sema/SemaTemplate.cpp
The file was modifiedclang/lib/Sema/TreeTransform.h
The file was modifiedclang/tools/libclang/CXCursor.cpp
The file was modifiedclang/test/CodeGenCXX/mangle-template.cpp
The file was modifiedclang/lib/Sema/SemaLookup.cpp
The file was modifiedclang/lib/AST/TemplateBase.cpp
The file was modifiedclang/include/clang/Basic/DiagnosticSemaKinds.td
The file was modifiedclang/lib/Sema/SemaOverload.cpp
The file was modifiedclang/lib/Sema/SemaTemplateVariadic.cpp
The file was modifiedclang/lib/Serialization/ASTReader.cpp
The file was modifiedclang/lib/CodeGen/CGExprConstant.cpp
The file was modifiedclang/lib/AST/Decl.cpp
The file was modifiedclang/tools/libclang/CIndex.cpp
Commit 569676c05725d79909bd8a9224bc709bd621553c by richard
Make Expr::HasSideEffect more precise for instantiation-dependent
expressions.

Fixes a regression in the clang-tidy test suite from making DeclRefExprs
referring to dependent declarations be instantiation-dependent.
The file was modifiedclang/lib/AST/Expr.cpp
The file was modifiedclang/lib/Sema/SemaExprCXX.cpp
The file was modifiedclang/lib/Sema/SemaType.cpp
The file was modifiedclang/lib/Sema/SemaExpr.cpp
Commit e83e0cac041bc071301f8399bb5c32b2529fc83f by martin
[libcxx] Make filesystem::path::value_type wchar_t on windows

Also set the preferred separator to backslash.

libc++ doesn't compile successfully for windows prior to this change,
and this change on its own isn't enough to make it compile successfully
either, but is the first stepping stone towards making it work correctly.

Most of operations.cpp will need to be touched, both for calling
functions that take wchar paths, but also for using other windows
specific functions instead of the posix functions used so far; that is
handled in later commits.

Changing parts of operations.cpp to generalize the string type handling
in code that doesn't touch system functions.

Differential Revision: https://reviews.llvm.org/D91135
The file was modifiedlibcxx/include/filesystem
The file was modifiedlibcxx/src/filesystem/filesystem_common.h
The file was modifiedlibcxx/src/filesystem/operations.cpp
Commit 48c6500b5bfa60dfe6ca5f407fcdbf5ddff0c289 by martin
[libcxx] Reorder the two u8path functions, to make the following diff more readable. NFC.

Differential Revision: https://reviews.llvm.org/D91136
The file was modifiedlibcxx/include/filesystem
Commit de698ae73444b5160dd6b8d768b30d6764be004e by martin
[libcxx] Convert paths to/from the right narrow code page for narrow strings on windows

On windows, the narrow, char based paths normally don't use utf8, but
can use many different native code pages, and this is what system
functions that operate on files, taking such paths/file names, interpret
them as.

Differential Revision: https://reviews.llvm.org/D91137
The file was modifiedlibcxx/src/filesystem/operations.cpp
The file was modifiedlibcxx/include/filesystem
The file was modifiedlibcxx/src/filesystem/filesystem_common.h
Commit 156180727d6c347eda3ba749730707acb8a48093 by martin
[libcxx] Fix the preexisting directory_iterator code for windows

The directory_iterator.cpp file did contain an incomplete,
non-working implementation for windows.

Change it to use the wchar version of the APIs.

Don't set the windows specific errors from GetLastError() as code
in the generic category; remap the errors to the std::errc values.

Error out cleanly on empty paths.

Invoke FindFirstFile on <directoryname>/* to actually list the
entries of the directory.

If the first entry retured by FindFirstFile is to be skipped (e.g.
being "." or ".."), call advance() (which calls FindNextFile and loops)
which doesn't return until a valid entry is found (or the end is
reached).

Differential Revision: https://reviews.llvm.org/D91140
The file was modifiedlibcxx/src/filesystem/operations.cpp
The file was modifiedlibcxx/src/filesystem/directory_iterator.cpp
The file was modifiedlibcxx/src/filesystem/filesystem_common.h
Commit 95d3cc67caac04668ef808f65c30ced60ed14f5d by jan_svoboda
[clang][cli] Port CodeGenOpts simple string flags to new option parsing system

Depends on D84668

Reviewed By: Bigcheese

Original patch by Daniel Grumberg.

Differential Revision: https://reviews.llvm.org/D84669
The file was modifiedclang/include/clang/Basic/DiagnosticDriverKinds.td
The file was modifiedclang/include/clang/Driver/Options.td
The file was modifiedclang/include/clang/Basic/CodeGenOptions.h
The file was modifiedclang/lib/Frontend/CompilerInvocation.cpp
The file was modifiedclang/test/Profile/c-generate.c