LLVM/llvm 351931llvm/trunk/test/tools/llvm-objcopy/COFF add-gnu-debuglink.test, llvm/trunk/tools/llvm-objcopy/COFF COFFObjcopy.cpp Object.h

Reapply: [llvm-objcopy] [COFF] Implement --add-gnu-debuglink

This was reverted since it broke a couple buildbots. The reason
for the breakage is not yet known, but this time, the test has
got more diagnostics added, to hopefully allow figuring out
what goes wrong.

Differential Revision: https://reviews.llvm.org/D57007

LLVM/llvm 351930llvm/trunk/lib/Target/AArch64 AArch64SpeculationHardening.cpp, llvm/trunk/test/CodeGen/AArch64 speculation-hardening.mir speculation-hardening.ll

[SLH] AArch64: correctly pick temporary register to mask SP

As part of speculation hardening, the stack pointer gets masked with the
taint register (X16) before a function call or before a function return.
Since there are no instructions that can directly mask writing to the
stack pointer, the stack pointer must first be transferred to another
register, where it can be masked, before that value is transferred back
to the stack pointer.
Before, that temporary register was always picked to be x17, since the
ABI allows clobbering x17 on any function call, resulting in the
following instruction pattern being inserted before function calls and
returns/tail calls:

mov x17, sp
and x17, x17, x16
mov sp, x17
However, x17 can be live in those locations, for example when the call
is an indirect call, using x17 as the target address (blr x17).

To fix this, this patch looks for an available register just before the
call or terminator instruction and uses that.

In the rare case when no register turns out to be available (this
situation is only encountered twice across the whole test-suite), just
insert a full speculation barrier at the start of the basic block where

    [3 lines not shown]

LLVM/llvm 351929clang-tools-extra/trunk/unittests/clangd CMakeLists.txt

[clangd] Link clangTidy into clangd tests

Patch by Nathan Ridge!

Differential Revision: https://reviews.llvm.org/D57077

LLVM/llvm 351928llvm/trunk/lib/Target/SystemZ SystemZISelLowering.cpp SystemZElimCompare.cpp, llvm/trunk/test/CodeGen/SystemZ debuginstr-02.mir debuginstr-00.mir

[SystemZ]  Handle DBG_VALUE instructions in two places in backend.

Two backend optimizations failed to handle cases when compiled with -g, due
to failing to consider DBG_VALUE instructions. This was in
SystemZTargetLowering::emitSelect() and
SystemZElimCompare::getRegReferences().

This patch makes sure that DBG_VALUEs are recognized so that they do not
affect these optimizations.

Tests for branch-on-count, load-and-trap and consecutive selects.

Review: Ulrich Weigand
https://reviews.llvm.org/D57048

LLVM/llvm 351927compiler-rt/trunk/lib/fuzzer CMakeLists.txt

Fix building sanitizers for MinGW

The /EHsc flag is MSVC specific, not generic to the windows target.

LLVM/llvm 351926llvm/trunk/lib/Transforms/Scalar InductiveRangeCheckElimination.cpp, llvm/trunk/test/Transforms/IRCE wide_indvar.ll

[IRCE] Support narrow latch condition for wide range checks

This patch relaxes restrictions on types of latch condition and range check.
In current implementation, they should match. This patch allows to handle
wide range checks against narrow condition. The motivating example is the
following:

  int N = ...
  for (long i = 0; (int) i < N; i++) {
    if (i >= length) deopt;
  }

In this patch, the option that enables this support is turned off by
default. We'll wait until it is switched to true.

Differential Revision: https://reviews.llvm.org/D56837
Reviewed By: reames

LLVM/llvm 351925clang-tools-extra/trunk/docs/clang-tidy/checks bugprone-parent-virtual-call.rst

[doc] Fix svn property for bugprone-parent-virtual-call.rst

LLVM/llvm 351924cfe/trunk/lib/CodeGen CGExpr.cpp CGExprCXX.cpp, cfe/trunk/test/CodeGenCXX catch-undef-behavior.cpp

[ubsan] Check the correct size when sanitizing array new.

We previously forgot to multiply the element size by the array bound.

LLVM/llvm 351923llvm/trunk/include/llvm/CodeGen MachinePipeliner.h, llvm/trunk/lib/CodeGen MachinePipeliner.cpp

[Pipeliner] Add two pragmas to control software pipelining optimization

#pragma clang loop pipeline(disable)
  
    Disable SWP optimization for the next loop.
    “disable” is the only possible value.
  
#pragma clang loop pipeline_initiation_interval(number)
  
    Set value of initiation interval for SWP
    optimization to specified number value for
    the next loop. Number is the positive value
    greater than 0.
  
These pragmas could be used for debugging or reducing
compile time purposes. It is possible to disable SWP for
concrete loops to save compilation time or to find bugs
by not doing SWP to certain loops. It is possible to set
value of initiation interval to concrete number to save
compilation time by not doing extra pipeliner passes or
to check created schedule for specific initiation interval.

That is llvm part of the fix

Clang part of fix: https://reviews.llvm.org/D55710

    [4 lines not shown]

LLVM/llvm 351922clang-tools-extra/trunk/clang-tidy/objc PropertyDeclarationCheck.cpp PropertyDeclarationCheck.h, clang-tools-extra/trunk/docs ReleaseNotes.rst

Revert rCTE351921 to fix documentation geneeration.

Original review: https://reviews.llvm.org/D56945

LLVM/llvm 351921clang-tools-extra/trunk/clang-tidy/objc PropertyDeclarationCheck.cpp PropertyDeclarationCheck.h, clang-tools-extra/trunk/docs ReleaseNotes.rst

[clang-tidy] Delete obsolete objc-property-declaration options ✂️

Summary:
The `Acronyms` and `IncludeDefaultAcronyms` options were deprecated in
https://reviews.llvm.org/D51832. These options can be removed.

Tested by running the clang-tidy tests.

Reviewers: benhamilton, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: Eugene.Zelenko, xazax.hun, cfe-commits

Tags: #clang-tools-extra

Differential Revision: https://reviews.llvm.org/D56945

LLVM/llvm 351920compiler-rt/trunk/lib/hwasan hwasan_linux.cc, llvm/trunk/lib/Target/AArch64 AArch64AsmPrinter.cpp

hwasan: Move memory access checks into small outlined functions on aarch64.

Each hwasan check requires emitting a small piece of code like this:
https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html#memory-accesses

The problem with this is that these code blocks typically bloat code
size significantly.

An obvious solution is to outline these blocks of code. In fact, this
has already been implemented under the -hwasan-instrument-with-calls
flag. However, as currently implemented this has a number of problems:
- The functions use the same calling convention as regular C functions.
  This means that the backend must spill all temporary registers as
  required by the platform's C calling convention, even though the
  check only needs two registers on the hot path.
- The functions take the address to be checked in a fixed register,
  which increases register pressure.
Both of these factors can diminish the code size effect and increase
the performance hit of -hwasan-instrument-with-calls.

The solution that this patch implements is to involve the aarch64
backend in outlining the checks. An intrinsic and pseudo-instruction
are created to represent a hwasan check. The pseudo-instruction
is register allocated like any other instruction, and we allow the
register allocator to select almost any register for the address to

    [44 lines not shown]

LLVM/llvm 351919llvm/trunk/utils/gn/secondary/llvm/include/llvm/Config BUILD.gn

gn build: Merge r351820.

LLVM/llvm 351918llvm/trunk/utils/gn/secondary/llvm/unittests/CodeGen/GlobalISel BUILD.gn

gn build: Merge r351880

LLVM/llvm 351917lld/trunk/COFF InputFiles.cpp, lld/trunk/test/COFF associative-comdat-order.s associative-comdat-empty.s

lld-link: Use just one code path to process associative comdats, reject some invalid 
associated comdats

Currently, if an associative comdat appears after the comdat it's associated
with it's processed immediately, else it's deferred until the end of the object
file. I found this confusing to think about while working on PR40094, so this
makes it so that associated comdats are always processed at the end of the
object file.  This seems to be perf-neutral and simpler.

Now there's a natural place to reject the associated comdats referring to later
associated comdats (associated comdats referring to associated comdats is
invalid per COFF spec) that, so reject those. (A later patch will reject
associated comdats referring to earlier comdats.)

Differential Revision: https://reviews.llvm.org/D56929

LLVM/llvm 351916lld/trunk/test/ELF stdout.s, llvm/trunk/lib/ExecutionEngine SectionMemoryManager.cpp

MemoryBlock: Do not automatically extend a given size to a multiple of page size.

Previously, MemoryBlock automatically extends a requested buffer size to a
multiple of page size because (I believe) doing it was thought to be harmless
and with that you could get more memory (on average 2KiB on 4KiB-page systems)
"for free".

That programming interface turned out to be error-prone. If you request N
bytes, you usually expect that a resulting object returns N for `size()`.
That's not the case for MemoryBlock.

Looks like there is only one place where we take the advantage of
allocating more memory than the requested size. So, with this patch, I
simply removed the automatic size expansion feature from MemoryBlock
and do it on the caller side when needed. MemoryBlock now always
returns a buffer whose size is equal to the requested size.

Differential Revision: https://reviews.llvm.org/D56941

LLVM/llvm 351915compiler-rt/trunk/lib/builtins CMakeLists.txt

[builtins] Do not set hidden attribute on Android

Bionic libc relies on an old libgcc behaviour which does not set hidden
visibility attribute. Keep exporting these symbols on Android for 
compatibility.

Differential Revision: https://reviews.llvm.org/D56977

LLVM/llvm 351914llvm/trunk/test/tools/llvm-objcopy/ELF fail-no-output-directory.test

[llvm-objcopy] Remove os-dependent message from test

LLVM/llvm 351913zorg/trunk/zorg/jenkins lldb-cmake-matrix-dwarf5.sh, zorg/trunk/zorg/jenkins/jobs/jobs lldb-cmake-matrix

[jenkins] add a LLDB DWARF 5 job

LLVM/llvm 351912zorg/trunk/zorg/buildbot/builders FuchsiaBuilder.py

[Fuchsia] Fix the path to CMake cache file

The path was missing a slash which breaks the builder.

LLVM/llvm 351911cfe/trunk/lib/Sema SemaDecl.cpp, cfe/trunk/test/SemaObjCXX arc-0x.mm

[Sema][ObjC] Check whether a DelayedDiagnosticPool has been pushed
before adding a delayed diagnostic to DelayedDiagnostics.

This fixes an assertion failure in Sema::DelayedDiagnostics::add that
was caused by the changes made in r141037.

rdar://problem/42782323

LLVM/llvm 351910llvm/trunk/lib/CodeGen/AsmPrinter CodeViewDebug.cpp, llvm/trunk/test/DebugInfo/COFF types-empty-member-fn.ll

[CodeView] Allow empty types in member functions

Summary:
`CodeViewDebug::lowerTypeMemberFunction` used to default to a `Void`
return type if the function's type array was empty. After D54667, it
started blindly indexing the 0th item for the return type, which fails
in `getOperand` for empty arrays if assertions are enabled.

This patch restores the `Void` return type for empty type arrays, and
adds a test generated by Rust in line-only debuginfo mode.

Reviewers: zturner, rnk

Reviewed By: rnk

Subscribers: hiraditya, JDevlieghere, llvm-commits

Differential Revision: https://reviews.llvm.org/D57070

LLVM/llvm 351909zorg/trunk/zorg/jenkins/jobs/jobs lldb-cmake-matrix

[jenkins] fix file path

LLVM/llvm 351908zorg/trunk/zorg/jenkins build.py

[zorg] Remove --session-file-format from LLDB test suite

Removes the session format specifier (`--session-file-format fm`) from
the lldb test suite invocations. The format is not unique for inline
tests and cause problems when multiple of those are running
concurrently. The default format is perfectly fine and the bots don't
care about the log's filename.

LLVM/llvm 351907zorg/trunk/zorg/jenkins/jobs/jobs lldb-cmake-matrix

[jenkins] fix filename

LLVM/llvm 351906zorg/trunk/zorg/jenkins lldb-cmake-matrix-stage2.sh

[jenkins] Improve chapter marks.

LLVM/llvm 351905llvm/trunk/test/tools/llvm-objcopy/ELF fail-no-output-directory.test

[llvm-objcopy] Fix error message for msvc tests

LLVM/llvm 351904zorg/trunk/llvmbisect/llvmlab clang_link

This should not have been comitted!

LLVM/llvm 351903zorg/trunk/zorg/jenkins/jobs/jobs lldb-cmake-matrix

[jenkins] fix filenames

LLVM/llvm 351902lldb/trunk/packages/Python/lldbsuite/test lldbtest.py

Revert "[dotest] Add logging to investigate CI issue."

We figured out the issue so the logging is no longer necessary. It turns
out we were using a session format that was not unique for inline tests.

LLVM/llvm 351901zorg/trunk/zorg/jenkins lldb-cmake-matrix-stage2.sh

[lldb-cmake-matrix] Remove test format

The test format `fm` is not unique for inline tests, causing issues when
concurrently execution two such tests at the same time. More
specifically, when the test has executed, the log file is renamed and
this fails when another instance already moved the file.

LLVM/llvm 351900zorg/trunk/zorg/jenkins lldb-cmake-matrix-stage2.sh lldb-cmake-matrix-stage1.sh, zorg/trunk/zorg/jenkins/jobs/jobs lldb-cmake-matrix-stage2.sh lldb-cmake-matrix-stage1.sh

[jenkins] Move scripts to the SCRIPT_PATH

LLVM/llvm 351899lld/trunk/COFF ICF.cpp, lld/trunk/ELF ICF.cpp

COFF, ELF: ICF: Perform 2 rounds of relocation hash propagation.

LLD's performance on PGO instrumented Windows binaries was still not
great even with the fix in D56955; out of the 2m41s linker runtime,
around 2 minutes were still being spent in ICF. I looked into this more
closely and discovered that the vast majority of the runtime was being
spent segregating .pdata sections with the following relocation chain:

.pdata -> identical .text -> unique PGO counter (not eligible for ICF)

This patch causes us to perform 2 rounds of relocation hash
propagation, which allows the hash for the .pdata sections to
incorporate the identifier from the PGO counter. With that, the amount
of time spent in ICF was reduced to about 2 seconds. I also found that
the same change led to a significant ICF performance improvement in a
regular release build of Chromium's chrome_child.dll, where ICF time
was reduced from around 1s to around 700ms.

With the same change applied to the ELF linker, median of 100 runs
for lld-speed-test/chrome reduced from 4.53s to 4.45s on my machine.

I also experimented with increasing the number of propagation rounds
further, but I did not observe any further significant performance
improvements linking Chromium or Firefox.

Differential Revision: https://reviews.llvm.org/D56986

LLVM/llvm 351898lld/trunk/COFF ICF.cpp, lld/trunk/ELF ICF.cpp

COFF, ELF: Adjust ICF hash computation to account for self relocations.

It turns out that sections in PGO instrumented object files on Windows
contain a large number of relocations pointing to themselves. With
r347429 this can cause many sections to receive the same hash (usually
zero) as a result of a section's hash being xor'ed with itself.

This patch causes the COFF and ELF linkers to avoid this problem
by adding the hash of the relocated section instead of xor'ing it.
On my machine this causes the regressing test case
provided by Mozilla to terminate in 2m41s.

Differential Revision: https://reviews.llvm.org/D56955

LLVM/llvm 351897zorg/trunk/zorg/jenkins/jobs/jobs lldb-cmake-matrix-stage2.sh lldb-cmake-matrix-stage1.sh

Add jenkins pipeline configuration for green dragon lldb-cmake-matrix job.

LLVM/llvm 351896llvm/trunk/tools/llvm-objcopy Buffer.cpp llvm-objcopy.cpp, llvm/trunk/tools/llvm-objcopy/ELF Object.cpp ELFObjcopy.cpp

[llvm-objcopy] Return Error from Buffer::allocate(), [ELF]Writer::finalize(), and 
[ELF]Writer::commit()

Summary:
This patch changes a few methods to return Error instead of manually calling 
error/reportError to abort. This will make it easier to extract into a library.

Note that error() takes just a string (this patch also adds an overload that takes an 
Error), while reportError() takes string + [error/code]. To help unify things, use 
FileError to associate a given filename with an error. Note that this takes some special 
care (for now), e.g. calling reportError(FileName, <something that could be FileError>) 
will duplicate the filename. The goal is to eventually remove reportError() and have every 
error associated with a file to be a FileError, and just one error handling block at the 
tool level.

This change was suggested in D56806. I took it a little further than suggested, but 
completely fixing llvm-objcopy will take a couple more patches. If this approach looks 
good, I'll commit this and apply similar patche(s) for the rest.

This change is NFC in terms of non-error related code, although the error message changes 
in one context.

Reviewers: alexshap, jhenderson, jakehehrlich, mstorsjo, espindola

Reviewed By: alexshap, jhenderson

    [4 lines not shown]

LLVM/llvm 351895llvm/trunk/lib/Target/RISCV RISCVInstrInfo.td

Fixed isReMaterializable setting for LUI instruction.

LLVM/llvm 351894llvm/trunk/lib/Transforms/IPO HotColdSplitting.cpp

[HotColdSplit] Calculate BFI lazily to reduce compile-time, NFC

The splitting pass does not need BFI unless the Module actually has a profile
summary. Do not calcualte BFI unless the summary is present.

For the sqlite3 amalgamation, this reduces time spent in the splitting pass
from 0.4% of the total to under 0.1%.

LLVM/llvm 351893llvm/trunk/include/llvm/Support Chrono.h

[Chrono] Remove ATTRIBUTE_ALWAYS inline from Chrono.h.

I discussed this with Pavel, who told me there was no real
thought behind this, and had no objection to remove the
attributes.

LLVM/llvm 351892llvm/trunk/lib/Transforms/IPO HotColdSplitting.cpp

[HotColdSplit] Calculate domtrees lazily to reduce compile-time, NFC

The splitting pass does not need (post)domtrees until after it's found a
cold block. Defer domtree calculation until a cold block is found.

For the sqlite3 amalgamation, this reduces time spent in the splitting
pass from 0.8% of the total to 0.4%.

LLVM/llvm 351891llvm/trunk/include/llvm/ADT StringRef.h StringSwitch.h

[ADT] Move away from __attribute__((always_inline)).

Some member functions of StringRef/SmallVector/StringSwitch
are marked with the `always_inline` attribute. The result
is that  the body of these functions is not emitted, hence the
debugger can't evaluate them (a typical example is
StringRef::size()), even if the code is built with `-O0`.

The main driver behind this was that of getting faster turnaround
when running `check-llvm`. A previous commit clarifies how to
get good performance when running the testsuite, so we can
get rid of the attribute here.

An alternative approach considered was that of using attribute `used`,
but in the end we preferred to not slap yet another attribute on
these functions.

LLVM/llvm 351890llvm/trunk/lib/CodeGen/SelectionDAG LegalizeFloatTypes.cpp

[LegalizeTypes] Add debug prints to the top of PromoteFloatOperand and PromoteFloatResult.

Also add debug prints in the default case of the switches in these routines.

Most if not all of the type legalization handlers already do this so this makes promoting 
floats consistent

LLVM/llvm 351889cfe/trunk/include/clang/Driver Options.td

[mips] Replace help-text for '-m{no}-relax-pic-calls'. NFC

Thanks to Simon Dardis for the new text.

LLVM/llvm 351888libunwind/trunk/src AddressSpace.hpp UnwindCursor.hpp

Silence warnings about unused parameters

Differential Revision: https://reviews.llvm.org/D56984

LLVM/llvm 351887libcxx/trunk/test/std/containers/views/span.cons container.fail.cpp container.pass.cpp

While reviewing D57058, Louis had some questions about the existing span constructor 
tests. They were not testing the stuff that they said they were. Updated the tests to test 
what they should have been doing

LLVM/llvm 351886llvm/trunk/lib/Target/AMDGPU AMDGPULegalizerInfo.cpp, llvm/trunk/test/CodeGen/AMDGPU/GlobalISel legalize-ashr.mir legalize-lshr.mir

AMDGPU/GlobalISel: Start selectively legalizing 16-bit operations

It might be a bit nicer to use the fancy .legalIf and co. predicates,
but this was requiring more boilerplate and disables the coverage
assertions.

LLVM/llvm 351885llvm/trunk/docs TestingGuide.rst

[Docs] Add a note clarifying how to get good test performances.

Differential Revision:  https://reviews.llvm.org/D56337

LLVM/llvm 351884llvm/trunk/test/CodeGen/AMDGPU/GlobalISel legalize-lshr.mir regbankselect-ashr.mir

AMDGPU/GlobalISel: Handle legality/regbanks for 32/64-bit shifts

LLVM/llvm 351883llvm/trunk/lib/Support FileOutputBuffer.cpp

FileOutputBuffer: handle mmap(2) failure

If the underlying filesystem does not support mmap system call,
FileOutputBuffer may fail when it attempts to mmap an output temporary
file. This patch handles such situation.

Unfortunately, it looks like it is very hard to test this functionality
without a filesystem that doesn't support mmap using llvm-lit. I tested
this locally by passing an invalid parameter to mmap so that it fails and
falls back to the in-memory buffer. Maybe that's all what we can do.
I believe it is reasonable to submit this without a test.

Differential Revision: https://reviews.llvm.org/D56949

LLVM/llvm 351882llvm/trunk/lib/CodeGen/GlobalISel LegalizerHelper.cpp, llvm/trunk/test/CodeGen/AArch64/GlobalISel legalize-shift.mir

GlobalISel: Allow shift amount to be a different type

For AMDGPU the shift amount is never 64-bit, and
this needs to use a 32-bit shift.

X86 uses i8, but seemed to be hacking around this before.