1. [Dominators] Rewrite the dominator implementation for efficiency. NFC. (details)
  2. [Fuchsia] Add compat multilibs to cache file (details)
  3. [lld/mac] Emit only one LC_LOAD_DYLIB per dylib (details)
  4. [CSE] Ask DominanceInfo about "hasSSADominance" instead of reconstructing it. (details)
  5. [lld-macho][nfc] Remove unnecessary use of Optional<T*> (details)
  6. [various] Remove or use variables which are unused but set. (details)
  7. [Clang] -Wunused-but-set-parameter and -Wunused-but-set-variable (details)
  8. [clang][Fuchsia] Turn on relative-vtables by default for Fuchsia (details)
  9. [lld/mac] Make -t work correctly with -flat_namespace (details)
Commit 412ae15de49a227de25a695735451f8908ebf999 by clattner
[Dominators] Rewrite the dominator implementation for efficiency. NFC.

The previous impl densely scanned the entire region starting with an op
when dominators were created, creating a DominatorTree for every region.

This is extremely expensive up front -- particularly for clients like
Linalg/Transforms/Fusion.cpp that construct DominanceInfo for a single
query.  It is also extremely memory wasteful for IRs that use single
block regions commonly (e.g. affine.for) because it's making a
dominator tree for a region that has trivial dominance.  The
implementation also had numerous unnecessary minor efficiencies, e.g.
doing multiple walks of the region tree or tryGetBlocksInSameRegion
building a DenseMap that it didn't need.

This patch switches to an approach where [Post]DominanceInfo is free
to construct, and which lazily constructs DominatorTree's for any
multiblock regions that it needs.  This avoids the up-front cost
entirely, making its runtime proportional to the complexity of the
region tree instead of # ops in a region.  This also avoids the memory
and time cost of creating DominatorTree's for single block regions.

Finally this rewrites the implementation for simplicity and to avoids
the constant factor problems the old implementation had.

Differential Revision:
The file was modifiedmlir/include/mlir/IR/Dominance.h
The file was modifiedmlir/lib/Transforms/BufferOptimizations.cpp
The file was modifiedmlir/lib/IR/Dominance.cpp
The file was modifiedmlir/include/mlir/IR/Region.h
The file was modifiedmlir/lib/Transforms/CSE.cpp
The file was modifiedmlir/lib/IR/Region.cpp
Commit da1db49409657d5212185ab9952ee35d99b773d4 by leonardchan
[Fuchsia] Add compat multilibs to cache file

Differential Revision:
The file was modifiedclang/cmake/caches/Fuchsia-stage2.cmake
Commit aeae3e0ba9061a40209987d6256e489146c2bffb by thakis
[lld/mac] Emit only one LC_LOAD_DYLIB per dylib

In some cases, we end up with several distinct DylibFiles that
have the same install name. Only emit a single LC_LOAD_DYLIB in
those cases.

This happens in 3 cases I know of:

1. Some tbd files are symlinks. libpthread.tbd is a symlink against
   libSystem.tbd for example, so `-lSystem -lpthread` loads
   libSystem.tbd twice. We could (and maybe should) cache loaded
   dylibs by realpath() to catch this.

2. Some tbd files are copies of each other. For example,
   CFNetwork.framework/CFNetwork.tbd and
   CFNetwork.framework/Versions/A/CFNetwork.tbd are two distinct
   copies of the same file. The former is found by
   `-framework CFNetwork` and the latter by the reexport in
   CoreServices.tbd. We could conceivably catch this by
   making `-framework` search look in `Versions/Current` instead
   of in the root, and/or by using a content hash to cache
   tbd files, but that's starting to sound complicated.

3. Magic $ld$ symbol processing can change the install name of
   a dylib based on the target platform_version. Here, two
   truly distinct dylibs can have the same install name.

So we need this code to deal with (3) anyways. Might as well use
it for 1 and 2, at least for now :)

With this (and D103430), clang-format links in the same dylibs
when linked with lld and ld64.

Differential Revision:
The file was modifiedlld/MachO/Writer.cpp
The file was addedlld/test/MachO/dylink-ordinal.s
Commit 6134231a78bf667a2f4357a415fac11e2732405a by clattner
[CSE] Ask DominanceInfo about "hasSSADominance" instead of reconstructing it.

I backed this off to make the previous patch easier to wrangle, but now
this is an efficient query and it is better to not replace it in CSE.

Differential Revision:
The file was modifiedmlir/lib/Transforms/CSE.cpp
Commit 8f89c054afa115e4e45dbc76f7efa2e7f485d227 by vyng
[lld-macho][nfc] Remove unnecessary use of Optional<T*>

In all of these cases, the functions could simply return a nullptr instead of {}.
There is no case where Optional<nullptr> has a special meaning.

Differential Revision:
The file was modifiedlld/MachO/Driver.cpp
The file was modifiedlld/MachO/DriverUtils.cpp
The file was modifiedlld/MachO/InputFiles.cpp
The file was modifiedlld/MachO/Driver.h
Commit 00d19c6704f421157ae3de3623aca5f58f6c366d by George Burgess IV
[various] Remove or use variables which are unused but set.

This is in preparation for the -Wunused-but-set-variable warning.

Differential Revision:
The file was modifiedllvm/lib/Target/ARM/ARMISelLowering.cpp
The file was modifiedllvm/lib/Target/AArch64/GISel/AArch64PostSelectOptimize.cpp
The file was modifiedlldb/source/Interpreter/CommandInterpreter.cpp
The file was modifiedllvm/lib/Target/ARM/ARMLowOverheadLoops.cpp
The file was modifiedlldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp
The file was modifiedllvm/lib/Target/X86/X86FloatingPoint.cpp
The file was modifiedlldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
The file was modifiedllvm/lib/Target/PowerPC/PPCBranchSelector.cpp
The file was modifiedllvm/utils/benchmark/src/
Commit cf49cae278b4e972cd2547d72f9ee7d9d69a3af4 by George Burgess IV
[Clang] -Wunused-but-set-parameter and -Wunused-but-set-variable

These are intended to mimic warnings available in gcc.

Differential Revision:
The file was modifiedclang/test/SemaObjC/foreach.m
The file was addedclang/test/SemaCXX/warn-unused-but-set-variables-cpp.cpp
The file was modifiedclang/test/CodeGen/builtins-arm.c
The file was addedclang/test/SemaCXX/warn-unused-but-set-parameters-cpp.cpp
The file was modifiedclang/test/Sema/vector-gcc-compat.c
The file was addedclang/test/Sema/warn-unused-but-set-parameters.c
The file was modifiedclang/include/clang/Basic/
The file was modifiedclang/test/CodeGen/2007-10-30-Volatile.c
The file was modifiedclang/test/Sema/vector-gcc-compat.cpp
The file was modifiedclang/test/SemaCXX/goto.cpp
The file was modifiedclang/include/clang/Sema/Sema.h
The file was modifiedclang/test/SemaCXX/shift.cpp
The file was modifiedclang/include/clang/Basic/
The file was addedclang/test/Sema/warn-unused-but-set-variables.c
The file was modifiedclang/test/SemaCXX/sizeless-1.cpp
The file was modifiedclang/test/CXX/expr/expr.prim/expr.prim.lambda/p12.cpp
The file was modifiedclang/test/CodeGen/builtins-riscv.c
The file was modifiedclang/lib/Sema/SemaDecl.cpp
The file was modifiedclang/test/CodeGen/X86/x86_32-xsave.c
The file was modifiedclang/test/Sema/shift.c
The file was modifiedclang/lib/Sema/SemaExpr.cpp
The file was modifiedclang/test/FixIt/fixit.cpp
The file was modifiedclang/test/Misc/warning-wall.c
The file was modifiedclang/test/CodeGen/X86/x86_64-xsave.c
The file was modifiedclang/lib/Sema/SemaExprCXX.cpp
Commit e6f88dc01a7208b6f4671c4fcb5d9e68d0808a34 by leonardchan
[clang][Fuchsia] Turn on relative-vtables by default for Fuchsia

All fuchsia targets will now use the relative-vtables ABI by default.
Also remove -fexperimental-relative-c++-abi-vtables from test RUNs targeting fuchsia.

Differential Revision:
The file was modifiedclang/test/CodeGenCXX/RelativeVTablesABI/overriden-virtual-function.cpp
The file was modifiedclang/test/CodeGenCXX/RelativeVTablesABI/relative-vtables-flag.cpp
The file was modifiedclang/test/CodeGenCXX/RelativeVTablesABI/inlined-key-function.cpp
The file was modifiedclang/test/CodeGenCXX/RelativeVTablesABI/vbase-offset.cpp
The file was modifiedclang/test/CodeGenCXX/RelativeVTablesABI/cross-translation-unit-1.cpp
The file was modifiedclang/test/CodeGenCXX/RelativeVTablesABI/no-alias-when-dso-local.cpp
The file was modifiedclang/test/CodeGenCXX/RelativeVTablesABI/child-inheritted-from-parent-in-comdat.cpp
The file was modifiedclang/test/CodeGenCXX/RelativeVTablesABI/dynamic-cast.cpp
The file was modifiedclang/test/CodeGenCXX/RelativeVTablesABI/multiple-inheritance.cpp
The file was modifiedclang/test/CodeGenCXX/RelativeVTablesABI/type-info.cpp
The file was modifiedclang/test/CodeGenCXX/RelativeVTablesABI/inheritted-virtual-function.cpp
The file was modifiedclang/test/CodeGenCXX/RelativeVTablesABI/override-pure-virtual-method.cpp
The file was modifiedclang/test/CodeGenCXX/RelativeVTablesABI/vtable-hidden-when-in-comdat.cpp
The file was modifiedclang/test/CodeGenCXX/RelativeVTablesABI/available_externally-vtable.cpp
The file was modifiedclang/test/CodeGenCXX/RelativeVTablesABI/thunk-mangling.cpp
The file was modifiedclang/test/CodeGenCXX/constructor-destructor-return-this.cpp
The file was modifiedclang/test/CodeGenCXX/RelativeVTablesABI/member-function-pointer.cpp
The file was modifiedclang/include/clang/Basic/TargetCXXABI.h
The file was modifiedclang/lib/Driver/ToolChains/Clang.cpp
The file was modifiedclang/test/CodeGenCXX/RelativeVTablesABI/simple-vtable-definition.cpp
The file was modifiedclang/lib/Frontend/CompilerInvocation.cpp
The file was modifiedclang/test/CodeGenCXX/RelativeVTablesABI/diamond-inheritance.cpp
The file was modifiedclang/test/CodeGenCXX/RelativeVTablesABI/child-vtable-in-comdat.cpp
The file was modifiedclang/test/CodeGenCXX/RelativeVTablesABI/virtual-function-call.cpp
The file was modifiedclang/include/clang/Driver/
The file was modifiedclang/test/CodeGenCXX/RelativeVTablesABI/diamond-virtual-inheritance.cpp
The file was modifiedclang/test/CodeGenCXX/RelativeVTablesABI/cross-translation-unit-2.cpp
Commit 222a88a24371b8a1db2c2cedd1918a5f90758b75 by thakis
[lld/mac] Make -t work correctly with -flat_namespace

We used to not print dylibs referenced by other dylibs in `-t` mode. This
affected reexports, and with `-flat_namespace` also just dylibs loaded by
dylibs. Now we print them.

Fixes PR49514.

Differential Revision:
The file was modifiedlld/MachO/DriverUtils.cpp
The file was modifiedlld/test/MachO/flat-namespace.s
The file was modifiedlld/MachO/Driver.cpp