platform/upstream/llvm.git
2 years ago[mlir] Canonicalizer constructor should accept disabled/enabled patterns
Mogball [Tue, 21 Dec 2021 01:18:14 +0000 (01:18 +0000)]
[mlir] Canonicalizer constructor should accept disabled/enabled patterns

There is no way to programmatically configure the list of disabled and enabled patterns in the canonicalizer pass, other than the duplicate the whole pass. This patch exposes the `disabledPatterns` and `enabledPatterns` options.

Reviewed By: mehdi_amini

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

2 years ago[libc] apply formatting to tests
Michael Jones [Tue, 21 Dec 2021 21:12:45 +0000 (13:12 -0800)]
[libc] apply formatting to tests

Apply the formatting rules that were applied to the libc/src directory
to the libc/test directory, as well as the files in libc/utils that are
included by the tests. This does not include automated enforcement.

Reviewed By: sivachandra, lntue

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

2 years agoRemove superfluous semicolon.
Simon Pilgrim [Wed, 22 Dec 2021 17:42:45 +0000 (17:42 +0000)]
Remove superfluous semicolon.

Missed by MSVC

2 years ago[gn build] Port cb8a0b07974e
LLVM GN Syncbot [Wed, 22 Dec 2021 17:34:39 +0000 (17:34 +0000)]
[gn build] Port cb8a0b07974e

2 years ago[libc++] [ranges] Introduce _LIBCPP_AUTO_CAST(x) for auto(x).
Arthur O'Dwyer [Tue, 14 Dec 2021 00:21:38 +0000 (19:21 -0500)]
[libc++] [ranges] Introduce _LIBCPP_AUTO_CAST(x) for auto(x).

Clang is gaining `auto(x)` support in D113393; sadly there
seems to be no feature-test macro for it. Zhihao is opening
a core issue for that macro.

Use `_LIBCPP_AUTO_CAST` where C++20 specifies we should use `auto(x)`;
stop using `__decay_copy(x)` in those places.
In fact, remove `__decay_copy` entirely. As of C++20, it's purely
a paper specification tool signifying "Return just `x`, but it was
perfect-forwarded, so we understand you're going to have to call
its move-constructor sometimes." I believe there's no reason we'd
ever need to do its operation explicitly in code.

This heisenbugs away a test failure on MinGW; see D112214.

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

2 years ago[mlir][arith] Fix CmpIOP folding for vector types.
Adrian Kuegel [Wed, 22 Dec 2021 17:09:59 +0000 (18:09 +0100)]
[mlir][arith] Fix CmpIOP folding for vector types.

Previously, the folding assumed that it always operates on scalar types.

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

2 years ago[DAG][X86] Add TargetLowering::isSplatValueForTargetNode override
Simon Pilgrim [Wed, 22 Dec 2021 16:57:44 +0000 (16:57 +0000)]
[DAG][X86] Add TargetLowering::isSplatValueForTargetNode override

Add callback to enable us to test target nodes if they are splat vectors

Added some basic X86ISD::VBROADCAST + X86ISD::VBROADCAST_LOAD handling

2 years agoRevert "[AMDGPU] Move call clobbered return address registers s[30:31] to callee...
Ron Lieberman [Wed, 22 Dec 2021 16:39:28 +0000 (11:39 -0500)]
Revert "[AMDGPU] Move call clobbered return address registers s[30:31] to callee saved range"

This reverts commit 9075009d1fd5f2bf9aa6c2f362d2993691a316b3.

 Failed amdgpu runtime buildbot # 3514

2 years ago[Clang][DebugInfo] Cease turning instruction-referencing off by default
Jeremy Morse [Wed, 22 Dec 2021 16:13:29 +0000 (16:13 +0000)]
[Clang][DebugInfo] Cease turning instruction-referencing off by default

Over in D114631 I turned this debug-info feature on by default, for x86_64
only. I'd previously stripped out the clang cc1 option that controlled it
in 651122fc4ac, unfortunately that turned out to not be completely
effective, and the two things deleted in this patch continued to keep it
off-by-default.  Oooff.

As a follow-up, this patch removes the last few things to do with
ValueTrackingVariableLocations from clang, which was the original purpose
of D114631. In an ideal world, if this patch causes you trouble you'd
revert 3c045070882f instead, which was where this behaviour was supposed
to start being the default, although that might not be practical any more.

2 years ago[NFC][Clang] Move function implementation of `OpenMPAtomicUpdateChecker` into anonymo...
Shilei Tian [Wed, 22 Dec 2021 16:24:06 +0000 (11:24 -0500)]
[NFC][Clang] Move function implementation of `OpenMPAtomicUpdateChecker` into anonymous namespace

Just to keep code consistent as `OpenMPAtomicUpdateChecker` is defined
in anonymous namespace.

Reviewed By: ABataev

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

2 years ago[OpenMP] Regenerate test checks (NFC)
Nikita Popov [Wed, 22 Dec 2021 16:11:48 +0000 (17:11 +0100)]
[OpenMP] Regenerate test checks (NFC)

Regenerate test checks to reduce diff for an upcoming patch.

2 years ago[JSONNodeDumper] Regenerate test checks (NFC)
Nikita Popov [Wed, 22 Dec 2021 15:55:56 +0000 (16:55 +0100)]
[JSONNodeDumper] Regenerate test checks (NFC)

gen_ast_dump_json_test.py adds these lines of whitespace. Precommit
it to avoid spurious diffs in future changes.

2 years ago[clang-tidy] abseil-string-find-startswith: detect `s.rfind(z, 0) == 0`
Ivan Gerasimov [Wed, 22 Dec 2021 15:33:09 +0000 (16:33 +0100)]
[clang-tidy] abseil-string-find-startswith: detect `s.rfind(z, 0) == 0`

Suggest converting `std::string::rfind()` calls to `absl::StartsWith()`
where possible.

2 years ago[libc++] [ranges] Remove the static_assert from ranges::begin and ranges::end.
Arthur O'Dwyer [Thu, 16 Dec 2021 03:10:34 +0000 (22:10 -0500)]
[libc++] [ranges] Remove the static_assert from ranges::begin and ranges::end.

As discussed with ldionne. The problem with this static_assert
is that it makes ranges::begin a pitfall for anyone ever to use
inside a constraint or decltype. Many Ranges things, such as ranges::size,
are specified as "Does X if X is well-formed, or else Y if Y is well-formed,
or else `ranges::end(t) - ranges::begin(t)` if that is well-formed, or else..."
And if there's a static_assert hidden inside `ranges::begin(t)`, then you get
a hard error as soon as you ask the question -- even if the answer would have
been "no, that's not well-formed"!

Constraining on `requires { t + 0; }` or `requires { t + N; }` is verboten
because of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103700 . For ranges::begin,
we can just decay to a pointer even in the incomplete-type case. For ranges::end,
we can safely constrain on `sizeof(*t)`. Yes, this means that an array of incomplete
type has a `ranges::begin` but no `ranges::end`... just like an unbounded array of
complete type. This is a valid manifestation of IFNDR.

All of the new libcxx/test/std/ cases are mandatory behavior, as far as I'm aware.
Tests for the IFNDR cases in ranges::begin and ranges::end remain in `libcxx/test/libcxx/`.
The similar tests for ranges::empty and ranges::data were simply wrong, AFAIK.

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

2 years ago[AMDGPU] Move call clobbered return address registers s[30:31] to callee saved range
RamNalamothu [Wed, 22 Dec 2021 13:02:52 +0000 (18:32 +0530)]
[AMDGPU] Move call clobbered return address registers s[30:31] to callee saved range

Currently the return address ABI registers s[30:31], which fall in the call
clobbered register range, are added as a live-in on the function entry to
preserve its value when we have calls so that it gets saved and restored
around the calls.

But the DWARF unwind information (CFI) needs to track where the return address
resides in a frame and the above approach makes it difficult to track the
return address when the CFI information is emitted during the frame lowering,
due to the involvment of understanding the control flow.

This patch moves the return address ABI registers s[30:31] into callee saved
registers range and stops adding live-in for return address registers, so that
the CFI machinery will know where the return address resides when CSR
save/restore happen during the frame lowering.

And doing the above poses an issue that now the return instruction uses undefined
register `sgpr30_sgpr31`. This is resolved by hiding the return address register
use by the return instruction through the `SI_RETURN` pseudo instruction, which
doesn't take any input operands, until the `SI_RETURN` pseudo gets lowered to the
`S_SETPC_B64_return` during the `expandPostRAPseudo()`.

As an added benefit, this patch simplifies overall return instruction handling.

Note: The AMDGPU CFI changes are there only in the downstream code and another
version of this patch will be posted for review for the downstream code.

Reviewed By: arsenm

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

2 years ago[lldb] [Process/FreeBSDKernel] Introduce libkvm support
Michał Górny [Sat, 18 Dec 2021 09:09:12 +0000 (10:09 +0100)]
[lldb] [Process/FreeBSDKernel] Introduce libkvm support

Introduce initial support for using libkvm on FreeBSD.  The library
can be used as an alternate implementation for processing kernel
coredumps but it can also be used to access live kernel memory through
specifying "/dev/mem" as the core file, i.e.:

    lldb --core /dev/mem /boot/kernel/kernel

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

2 years ago[clang][OpenMP][DebugInfo] Debug support for variables in shared clause of OpenMP...
Alok Kumar Sharma [Wed, 22 Dec 2021 14:26:37 +0000 (19:56 +0530)]
[clang][OpenMP][DebugInfo] Debug support for variables in shared clause of OpenMP task construct

Currently variables appearing inside shared clause of OpenMP task construct
are not visible inside lldb debugger.

After the current patch, lldb is able to show the variable

```
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
    frame #0: 0x0000000000400934 a.out`.omp_task_entry. [inlined] .omp_outlined.(.global_tid.=0, .part_id.=0x000000000071f0d0, .privates.=0x000000000071f0e8, .copy_fn.=(a.out`.omp_task_privates_map. at testshared.cxx:8), .task_t.=0x000000000071f0c0, __context=0x000000000071f0f0) at testshared.cxx:10:34
   7      else {
   8    #pragma omp task shared(svar) firstprivate(n)
   9        {
-> 10         printf("Task svar = %d\n", svar);
   11         printf("Task n = %d\n", n);
   12         svar = fib(n - 1);
   13       }
(lldb) p svar
(int) $0 = 9
```

Reviewed By: djtodoro

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

2 years ago[msan] Break optimization in memccpy tests
Nikita Popov [Wed, 22 Dec 2021 13:43:52 +0000 (14:43 +0100)]
[msan] Break optimization in memccpy tests

After D116148 the memccpy gets optimized away and the expected
uninitialized memory access does not occur.

Make sure the call does not get optimized away.

2 years ago[libc++] Add from-scratch testing configs for Windows
Martin Storsjö [Wed, 8 Dec 2021 18:54:21 +0000 (20:54 +0200)]
[libc++] Add from-scratch testing configs for Windows

The paths to the compiler and to the python executable may need to
be quoted (if they're installed into e.g. C:\Program Files).

All testing commands that are executed expect a gcc compatible command
line interface, while clang-cl uses different command line options.
In the original testing config, if the chosen compiler was clang-cl, it
was replaced with clang++ by looking for such an executable in the path.

For the new from-scratch test configs, I instead chose to add
"--driver-mode=g++" to flags - invoking "clang-cl --driver-mode=g++"
has the same effect as invoking "clang++", without needing to run any
heuristics for picking a different compiler executable.

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

2 years ago[libcxx] [test] Remove a leftover unused function in config.py. NFC.
Martin Storsjö [Wed, 8 Dec 2021 22:04:35 +0000 (00:04 +0200)]
[libcxx] [test] Remove a leftover unused function in config.py. NFC.

While there's little value in polishing the old config system,
I ran into this function and was confused for a while, while grepping
around and trying to wrap my head around things.

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

2 years ago[libcxx] [test] Prepare the ctime.timespec test for mingw CI env upgrades
Martin Storsjö [Fri, 17 Dec 2021 12:15:37 +0000 (12:15 +0000)]
[libcxx] [test] Prepare the ctime.timespec test for mingw CI env upgrades

The test is currently marked XFAIL for mingw environments, but latest
mingw-w64 got support for timespec_get:
https://github.com/mingw-w64/mingw-w64/commit/e62a0a987c80f6a6fdac3e350943ae8085de0bd5

The CI environment will probably be upgraded to a state where this
test is passing only after 14.x is branched in the llvm-project monorepo.

If we'd just go from having an XFAIL to no marking at all (when CI is
passing), we'd have to update both main and 14.x branches in sync
exactly when the CI runners are updated to a newer version.

Instead, mark the test as temporarily unsupported (so it doesn't
cause failed builds when the CI environment is updated); after the
CI environments are upgraded to such a state, we can remove the
UNSUPPORTED marking to start requiring it to pass on the main branch,
without needing to synchronize that change to anything else.

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

2 years ago[lldb] Use GetSupportedArchitectures on darwin platforms
Pavel Labath [Fri, 17 Dec 2021 13:13:52 +0000 (14:13 +0100)]
[lldb] Use GetSupportedArchitectures on darwin platforms

This finishes the GetSupportedArchitectureAtIndex migration. There are
opportunities to simplify this even further, but I am going to leave
that to the platform owners.

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

2 years ago[lldb/python] Avoid more dangling pointers in python glue code
Pavel Labath [Fri, 17 Dec 2021 12:02:21 +0000 (13:02 +0100)]
[lldb/python] Avoid more dangling pointers in python glue code

2 years ago[VPlan] Create header & latch blocks for skeleton up front (NFC).
Florian Hahn [Wed, 22 Dec 2021 12:44:24 +0000 (12:44 +0000)]
[VPlan] Create header & latch blocks for skeleton up front (NFC).

By creating the header and latch blocks up front and adding blocks and
recipes in between those 2 blocks we ensure that the entry and exits of
the plan remain valid throughout construction.

In order to avoid test changes and keep printing of the plans the same,
we use the new header block instead of creating a new block on the first
iteration of the loop traversing the original loop.

We also fold the latch into its predecessor.

This is a follow up to a post-commit suggestion in D114586.

Reviewed By: Ayal

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

2 years ago[LV] Adjust comment to say the induction is created in header.
Florian Hahn [Wed, 22 Dec 2021 11:56:40 +0000 (11:56 +0000)]
[LV] Adjust comment to say the induction is created in header.

Follow-up suggested post-commit for 1a54889f48fa.

2 years ago[unittest][DebugInfo/DWARF] Do not report skipped tests as passed
Igor Kudrin [Wed, 22 Dec 2021 11:52:49 +0000 (18:52 +0700)]
[unittest][DebugInfo/DWARF] Do not report skipped tests as passed

This is similar to what we have already done to some other tests.
See D102643, D102710, D102754.

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

2 years ago[unittest][DebugInfo/DWARF] Do not create dwarfgen::Generator if MCAsmBackend is...
Igor Kudrin [Wed, 22 Dec 2021 11:52:43 +0000 (18:52 +0700)]
[unittest][DebugInfo/DWARF] Do not create dwarfgen::Generator if MCAsmBackend is missing

dwarfgen::Generator cannot be created if there is no asm backend for a
target. For example, if the default target triple is nvptx-nvidia-cuda,
some tests fail even after D98400, which added checks for most cases.
This patch extends the approach to the remaining cases.

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

2 years ago[unittest][DebugInfo/DWARF] Check that dwarfgen::Generator is created
Igor Kudrin [Wed, 22 Dec 2021 11:52:36 +0000 (18:52 +0700)]
[unittest][DebugInfo/DWARF] Check that dwarfgen::Generator is created

If Generator::create() returns an error, tests should fail gracefully
and report the cause, for example:

[ RUN      ] DebugLineBasicFixture.ParserSkipsCorrectly
.../llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp:47: Failure
Value of: llvm::detail::TakeExpected(ExpectedGenerator)
Expected: succeeded
  Actual: failed  (no asm backend for target nvptx64-nvidia-cuda)

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

2 years ago[mlir][NFC] Use .empty() instead of .size()
Adrian Kuegel [Wed, 22 Dec 2021 11:29:53 +0000 (12:29 +0100)]
[mlir][NFC] Use .empty() instead of .size()

2 years ago[CodeGen] Make lifetime marker test more robust (NFC)
Nikita Popov [Wed, 22 Dec 2021 11:21:54 +0000 (12:21 +0100)]
[CodeGen] Make lifetime marker test more robust (NFC)

Mark the first function optnone as well, to make sure that the
test is independent of optimization.

2 years ago[mlir][NFC] Fix typo in VectorOps.cpp
Adrian Kuegel [Wed, 22 Dec 2021 11:23:57 +0000 (12:23 +0100)]
[mlir][NFC] Fix typo in VectorOps.cpp

2 years ago[MemoryLocation] Don't require nocapture in getForDest()
Nikita Popov [Wed, 22 Dec 2021 09:54:49 +0000 (10:54 +0100)]
[MemoryLocation] Don't require nocapture in getForDest()

As reames mentioned on related reviews, we don't need the nocapture
requirement here. First of all, from an API perspective, this is
not something that MemoryLocation::getForDest() should be checking
in the first place, because it does not affect which memory this
particular call can access; it's an orthogonal concern that should
be handled by the caller if necessary.

However, for both of the motivating users in DSE and InstCombine,
we don't need the nocapture requirement, because the capture can
either be purely local to the call (a pointer identity check that
is irrelevant to us), be part of the return value (which we check
is unused), or be written in the dest location, which we have
determined to be dead.

This allows us to remove the special handling for libcalls as well.

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

2 years ago[ConstantFolding] Tests for constrained compare intrinsics
Serge Pavlov [Wed, 22 Dec 2021 10:12:54 +0000 (17:12 +0700)]
[ConstantFolding] Tests for constrained compare intrinsics

This are tests extracted from https://reviews.llvm.org/D110322, committed
prior to that patch to show the change in behavior.

2 years ago[Clang] Add __builtin_reduce_xor
Jun Zhan [Wed, 22 Dec 2021 10:00:27 +0000 (10:00 +0000)]
[Clang] Add __builtin_reduce_xor

This patch implements __builtin_reduce_xor as specified in D111529.

Reviewed By: fhahn, aaron.ballman

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

2 years ago[flang] Add missing include. NFCI.
Diana Picus [Wed, 22 Dec 2021 09:14:53 +0000 (09:14 +0000)]
[flang] Add missing include. NFCI.

descriptor.h is using std::max, so it should include <algorithm>.

This should fix a build issue on Windows on Arm.

2 years agofix build bots after f5ac23b5ae090d64d31f0b6624470af97dc20bf6
Krasimir Georgiev [Wed, 22 Dec 2021 09:00:35 +0000 (10:00 +0100)]
fix build bots after f5ac23b5ae090d64d31f0b6624470af97dc20bf6

The old member was `= 0`:
https://github.com/llvm/llvm-project/commit/f5ac23b5ae090d64d31f0b6624470af97dc20bf6#diff-7781d63141d53242da0520361a554df579ecb079b33bdcfbe7a0db95d44cca49L1740

It looks like this caused some bots to fail:
https://lab.llvm.org/buildbot/#/builders/127/builds/21684

2 years ago[RS4GC] Clean up attribute removal (NFC)
Nikita Popov [Wed, 22 Dec 2021 08:55:54 +0000 (09:55 +0100)]
[RS4GC] Clean up attribute removal (NFC)

It is not necessary to explicitly check which attributes are
present, and only add those to the builder. We can simply list
all attributes that need to be stripped and remove them
unconditionally. This also allows us to use some nicer APIs that
don't require mucking about with attribute list indices.

2 years ago[DataFlowSanitizer] Simplify attribute removal (NFC)
Nikita Popov [Wed, 22 Dec 2021 08:42:55 +0000 (09:42 +0100)]
[DataFlowSanitizer] Simplify attribute removal (NFC)

We're only removing a single attribute, so there is no need to
go through AttrBuilder.

2 years ago[Mips16HardFloat] Simplify attribute change (NFC)
Nikita Popov [Wed, 22 Dec 2021 08:41:11 +0000 (09:41 +0100)]
[Mips16HardFloat] Simplify attribute change (NFC)

As we're only removing and adding a single attribute, there is no
need to go through AttrBuilder.

2 years ago[ArgPromotion][TTI] Pass types to ABI compatibility hook
Nikita Popov [Mon, 20 Dec 2021 11:27:05 +0000 (12:27 +0100)]
[ArgPromotion][TTI] Pass types to ABI compatibility hook

The areFunctionArgsABICompatible() hook currently accepts a list of
pointer arguments, though what we're actually interested in is the
ABI compatibility after these pointer arguments have been converted
into value arguments.

This means that a) the current API is incompatible with opaque
pointers (because it requires inspection of pointee types) and
b) it can only be used in the specific context of ArgPromotion.
I would like to reuse the API when inspecting calls during inlining.

This patch converts it into an areTypesABICompatible() hook, which
accepts a list of types. This makes the method more generally usable,
and compatible with opaque pointers from an API perspective (the
actual usage in ArgPromotion/Attributor is still incompatible,
I'll follow up on that in separate patches).

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

2 years ago[Test] Add test showing missing opportunity in IndVar's handling of lshr
Max Kazantsev [Wed, 22 Dec 2021 08:07:41 +0000 (15:07 +0700)]
[Test] Add test showing missing opportunity in IndVar's handling of lshr

2 years agoSupport v2 of 'main bin spec' Mach-O LC_NOTE in corefiles
Jason Molenda [Wed, 22 Dec 2021 08:02:27 +0000 (00:02 -0800)]
Support v2 of 'main bin spec' Mach-O LC_NOTE in corefiles

Version 2 of 'main bin spec' LC_NOTE allows for the specification
of a slide of where the binary is loaded in the corefile virtual
address space.  It also adds a (currently unused) platform field
for the main binary.

Some corefile creators will only have a UUID and an offset to be
applied to the binary.

Changed TestFirmwareCorefiles.py to test this new form of
'main bin spec' with a slide, and also to run on both x86_64
and arm64 macOS systems.

Differential Revision: https://reviews.llvm.org/D116094
rdar://85938455

2 years ago[ConstantFolding] Do not remove side effect from constrained functions
Serge Pavlov [Thu, 16 Dec 2021 11:05:41 +0000 (18:05 +0700)]
[ConstantFolding] Do not remove side effect from constrained functions

According to the discussion in https://reviews.llvm.org/D110322 the code
that removes side effect from replaced function call is deleted.

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

2 years ago[llvm] Use depth_first (NFC)
Kazu Hirata [Wed, 22 Dec 2021 06:28:48 +0000 (22:28 -0800)]
[llvm] Use depth_first (NFC)

2 years ago[ELF] Change mipsGotIndex to uint32_t
Fangrui Song [Wed, 22 Dec 2021 04:19:51 +0000 (20:19 -0800)]
[ELF] Change mipsGotIndex to uint32_t

This does not decrease sizeof(InputSection) (important for memory usage) on
ELF64 by itself but allows we to add another uint32_t.

2 years ago[NFC] Use %clang_cc instead of %clang in c++20 module tests
Chuanqi Xu [Wed, 22 Dec 2021 03:43:56 +0000 (11:43 +0800)]
[NFC] Use %clang_cc instead of %clang in c++20 module tests

2 years ago[NFC] [C++20] [Modules] Add tests for template instantiation in transitively imported...
Chuanqi Xu [Wed, 22 Dec 2021 03:09:08 +0000 (11:09 +0800)]
[NFC] [C++20] [Modules] Add tests for template instantiation in transitively imported module

This commit adds two test about template class instantiation in
transitively imported module. They are used as pre-commit tests for
successive patches.

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

2 years ago[gn build] Port 7056250f517a
LLVM GN Syncbot [Wed, 22 Dec 2021 01:35:25 +0000 (01:35 +0000)]
[gn build] Port 7056250f517a

2 years ago[libc++][NFC] Granularize <filesystem>
Nikolas Klauser [Sat, 18 Dec 2021 09:21:25 +0000 (10:21 +0100)]
[libc++][NFC] Granularize <filesystem>

Granularize the `<filesystem>` header

Reviewed By: Quuxplusone, ldionne, #libc

Spies: libcxx-commits, mgorny

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

2 years ago[libc++] [test] Simplify some ranges tests.
Arthur O'Dwyer [Thu, 7 Oct 2021 02:30:47 +0000 (22:30 -0400)]
[libc++] [test] Simplify some ranges tests.

Eliminate a bogus operator== overload.
Also, check more intermediate steps in the logic we're checking here.
Some of this simplification is possible only now that we've implemented
more of <ranges>.

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

2 years ago[TSan] Don't instrument code that is executed from __tsan_on_report()
Julian Lettner [Wed, 22 Dec 2021 00:44:12 +0000 (16:44 -0800)]
[TSan] Don't instrument code that is executed from __tsan_on_report()

See also: https://reviews.llvm.org/D111157

2 years ago[clang-format][NFC] Handle wrapping after => in mustBreakBefore()
Owen Pan [Fri, 17 Dec 2021 20:00:48 +0000 (12:00 -0800)]
[clang-format][NFC] Handle wrapping after => in mustBreakBefore()

Move the handling of brace wrapping after => from unwrapped line
parser to token annotator and clean up the parser.

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

2 years ago[lldb] Use `GNUInstallDirs` to support custom installation dirs.
John Ericson [Sun, 4 Apr 2021 17:02:18 +0000 (13:02 -0400)]
[lldb] Use `GNUInstallDirs` to support custom installation dirs.

Extracted from D99484. My new plan is to start from the outside and work
inward.

Reviewed By: compnerd

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

2 years agoReland - [CodeView] Emit S_OBJNAME record
Alexandre Ganea [Tue, 21 Dec 2021 23:59:47 +0000 (18:59 -0500)]
Reland - [CodeView] Emit S_OBJNAME record

Reland integrates build fixes & further review suggestions.

Thanks to @zturner for the initial S_OBJNAME patch!

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

2 years agoRevert [CodeView] Emit S_OBJNAME record
Alexandre Ganea [Tue, 21 Dec 2021 23:36:54 +0000 (18:36 -0500)]
Revert [CodeView] Emit S_OBJNAME record

Also revert all subsequent fixes:
abd1cbf5e543f0f114d2742e109ead7d7ddbf9c4 [Clang] Disable debug-info-objname.cpp test on Unix until I sort out the issue.
00ec441253048f5e30540ea26bb0a28c42a5fc18 [Clang] debug-info-objname.cpp test: explictly encode a x86 target when using %clang_cl to avoid falling back to a native CPU triple.
cd407f6e52b09cce2bef24c74b7f36fedc94991b [Clang] Fix build by restricting debug-info-objname.cpp test to x86.

2 years ago[gn build] (manually) port f68e89044a2ee
Nico Weber [Tue, 21 Dec 2021 23:59:37 +0000 (18:59 -0500)]
[gn build] (manually) port f68e89044a2ee

2 years ago[libcxx] [test] Extend test for bash for executor-has-no-bash
Martin Storsjö [Tue, 21 Dec 2021 13:14:28 +0000 (13:14 +0000)]
[libcxx] [test] Extend test for bash for executor-has-no-bash

If %{exec} sets "--env PATH=single-dir", the directory containing
bash and related shell utils is omitted from the path, which means
that most shell scripts would fail.

(Setting PATH is needed for DLL builds on Windows; PATH fills the same
role as e.g. LD_LIBRARY_PATH on Linux.)

This condition is missed in the current test, because the executor
run.py first resolves the executable to run using the original path,
then invokes that executable with an environment with a restricted
path. Thus the executor is able to run bash, but that bash is then
unable to run further shell commands (other than bash builtins).

Extend the test from "bash --version" to "bash -c 'bash --version'".
This correctly identifies the executor-has-no-bash condition in the
current Windows CI configs, allowing removing 6 cases of
LIBCXX-WINDOWS-FIXME.

Another longterm fix would be to extend run.py with an option like
"--env-prepend PATH=dir", to allow keeping the current path while
adding a directory to it.

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

2 years ago[libcxx] Add LIBCXX_EXTRA_SITE_DEFINES for adding extra defines in __config_site
Martin Storsjö [Mon, 20 Dec 2021 23:19:34 +0000 (01:19 +0200)]
[libcxx] Add LIBCXX_EXTRA_SITE_DEFINES for adding extra defines in __config_site

This is similar to the existing setting LIBCXX_ABI_DEFINES, with
the difference that this also allows setting other defines than
ones that start with "_LIBCPP_ABI_", and allows setting defines
to a specific value.

This allows avoiding using LIBCXX_TEST_COMPILER_FLAGS in two
CI configurations.

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

2 years ago[libcxx] Use LIBCXX_EXECUTOR in new test configs
Martin Storsjö [Wed, 8 Dec 2021 21:29:18 +0000 (23:29 +0200)]
[libcxx] Use LIBCXX_EXECUTOR in new test configs

This allows cross-testing (by setting LIBCXX_EXECUTOR to point
to ssh.py) without making an entirely new test config file.

Implicitly, this also fixes quoting of the python executable name
(which is quoted in test/CMakeLists.txt).

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

2 years ago[Clang] Own the CommandLineArgs in CodeGenOptions
Alexandre Ganea [Tue, 21 Dec 2021 22:41:26 +0000 (17:41 -0500)]
[Clang] Own the CommandLineArgs in CodeGenOptions

Fixes PR52704 : https://github.com/llvm/llvm-project/issues/52704

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

2 years ago[libc++] Partially revert 346ef5e5879e
Louis Dionne [Tue, 21 Dec 2021 21:50:34 +0000 (16:50 -0500)]
[libc++] Partially revert 346ef5e5879e

This moves the macro definitions back to __config, but keeps the
improved documentation. 346ef5e5879e had broken the MinGW build.

2 years ago[ASan] Change optimized callbacks visibility to hidden.
Kirill Stoimenov [Tue, 21 Dec 2021 20:43:31 +0000 (20:43 +0000)]
[ASan] Change optimized callbacks visibility to hidden.

Making callbacks hidden will remove PLT calls.

Reviewed By: vitalybuka

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

2 years ago[PowerPC] Add missed test case updates
Nemanja Ivanovic [Tue, 21 Dec 2021 20:53:55 +0000 (14:53 -0600)]
[PowerPC] Add missed test case updates

In commit 1674d9b6b2da914619c7c197336bb74f7988cf38,
I missed adding the updates to existing test cases.
This should bring the bots back to green.

2 years ago[libc++][NFC] Improve documentation of the various random_device implementations
Louis Dionne [Tue, 21 Dec 2021 20:31:18 +0000 (15:31 -0500)]
[libc++][NFC] Improve documentation of the various random_device implementations

Also, move the setting of the macro closer to its point of use, which
also has the benefit of uncluttering `__config`.

2 years ago[PowerPC] Fix vector equality comparison for v2i64 pre-Power8
Nemanja Ivanovic [Tue, 21 Dec 2021 20:28:41 +0000 (14:28 -0600)]
[PowerPC] Fix vector equality comparison for v2i64 pre-Power8

The current code makes the assumption that equality
comparison can be performed with a word comparison
instruction. While this is true if the entire 64-bit
results are used, it does not generally work. It is
possible that the low order words and high order
words produce different results and a user of only
one will get the wrong result.

This patch adds an and of the result words so that
each word has the result of the comparison of the
entire doubleword that contains it.

Differential revision: https://reviews.llvm.org/D115678

2 years ago[PowerPC] Do not increase cost for getUserCost with MMA types
Nemanja Ivanovic [Tue, 21 Dec 2021 19:35:17 +0000 (13:35 -0600)]
[PowerPC] Do not increase cost for getUserCost with MMA types

Commit 150681f increases
cost of producing MMA types (vector pair and quad).
However, it increases the cost for getUserCost() which is
used in unrolling. As a result, loops that contain these
types already (from the user code) cannot be unrolled
(even with the user's unroll pragma). This was an unintended
sideeffect. Reverting that portion of the commit to allow
unrolling such loops.

Differential revision: https://reviews.llvm.org/D115424

2 years ago[libc] Show average runtime for math single-input-single-output performance tests.
Tue Ly [Tue, 21 Dec 2021 15:31:42 +0000 (10:31 -0500)]
[libc] Show average runtime for math single-input-single-output performance tests.

Run performance tests in denormal and normal ranges separately and show more detailed results.

Reviewed By: sivachandra

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

2 years ago[gn build] Port f78d49e06883
LLVM GN Syncbot [Tue, 21 Dec 2021 18:57:55 +0000 (18:57 +0000)]
[gn build] Port f78d49e06883

2 years agotsan: remove old vector clocks
Dmitry Vyukov [Wed, 6 Oct 2021 06:56:42 +0000 (08:56 +0200)]
tsan: remove old vector clocks

They are unused in the new tsan runtime.

Depends on D112604.

Reviewed By: vitalybuka, melver

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

2 years agotsan: remove hacky call
Dmitry Vyukov [Sun, 10 Oct 2021 06:18:15 +0000 (08:18 +0200)]
tsan: remove hacky call

It's unused in the new tsan runtime.

Depends on D112603.

Reviewed By: vitalybuka, melver

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

2 years agotsan: reduce shadow ranges
Dmitry Vyukov [Thu, 11 Nov 2021 17:49:38 +0000 (18:49 +0100)]
tsan: reduce shadow ranges

The new tsan runtime has 2x more compact shadow.
Adjust shadow ranges accordingly.

Depends on D112603.

Reviewed By: vitalybuka, melver

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

2 years agotsan: remove unused variable
Dmitry Vyukov [Tue, 16 Nov 2021 07:44:09 +0000 (08:44 +0100)]
tsan: remove unused variable

Depends on D113983.

Reviewed By: melver

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

2 years agotsan: use VReport instead of VPrintf in background thread
Dmitry Vyukov [Tue, 16 Nov 2021 07:41:36 +0000 (08:41 +0100)]
tsan: use VReport instead of VPrintf in background thread

If there are multiple processes, it's hard to understand
what output comes from what process.
VReport prepends pid to the output. Use it.

Depends on D113982.

Reviewed By: melver

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

2 years agotsan: better maintain current time in the background thread
Dmitry Vyukov [Tue, 16 Nov 2021 07:39:30 +0000 (08:39 +0100)]
tsan: better maintain current time in the background thread

Update now after long operations so that we don't use
stale value in subsequent computations.

Depends on D113981.

Reviewed By: melver

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

2 years ago[ELF] --gc-sections: Work around SHT_PROGBITS .init_array
Fangrui Song [Tue, 21 Dec 2021 18:44:29 +0000 (10:44 -0800)]
[ELF] --gc-sections: Work around SHT_PROGBITS .init_array

Older Go cmd/link used SHT_PROGBITS for .init_array .
Work around the lack of https://golang.org/cl/373734 for a while.
It does not generate .fini_array or .preinit_array

2 years ago[libc++][NFC] Reformatting in random_device.h and random.cpp
Louis Dionne [Tue, 21 Dec 2021 16:27:19 +0000 (11:27 -0500)]
[libc++][NFC] Reformatting in random_device.h and random.cpp

2 years ago[LTO][WPD] Ignore unreachable function by analyzing IR.
minglotus-6 [Mon, 20 Dec 2021 20:44:05 +0000 (20:44 +0000)]
[LTO][WPD] Ignore unreachable function by analyzing IR.

In regular LTO, analyze IR and discard unreachable functions when finding virtual call targets.

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

2 years ago[ELF] Optimize RelocationSection<ELFT>::writeTo
Fangrui Song [Tue, 21 Dec 2021 17:43:44 +0000 (09:43 -0800)]
[ELF] Optimize RelocationSection<ELFT>::writeTo

When linking a 1.2G output (nearly no debug info, 2846621 dynamic relocations) using `--threads=8`, I measured

```
9.131462 Total ExecuteLinker
1.449913 Total Write output file
1.445784 Total Write sections
0.657152 Write sections {"detail":".rela.dyn"}
```

This change decreases the .rela.dyn time to 0.25, leading to 4% speed up in the total time.

* The parallelSort is slow because of expensive r_sym/r_offset computation. Cache the values.
* The iteration is slow. Move r_sym/r_addend computation ahead of time and parallelize it.

With the change, the new encodeDynamicReloc is cheap (0.05s). So no need to parallelize it.

Reviewed By: ikudrin

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

2 years ago[libcxx] [test] Don't rerun supportsVerify for each individual test
Martin Storsjö [Sun, 19 Dec 2021 14:16:15 +0000 (16:16 +0200)]
[libcxx] [test] Don't rerun supportsVerify for each individual test

We can't just memoize _supportsVerify in place in format.py, as it
previously was executed in each of the individual processes.

Instead use hasCompileFlag() and add a feature flag for it instead,
which can be used both by tests (that already have such a flag,
locally for one set of tests) and for the testing framework itself.

By using hasCompileFlag(), this also implicitly fixes two other issues:
Previously, _supportsVerify called subprocess.call() directly, which can
interpret command line quoting differently than lit.TestRunner.

(In particular, TestRunner handles arguments quoted by a single quote,
while launching Windows processes with subprocess.call() only supports
double quotes. This allows using shlex.quote(), which uses single quotes,
everywhere - as all commands now go through TestRunner. This should make
41d7909368bebc897467a75860a524a5f172564f redundant.)

Secondly, the old _supportsVerify method didn't include %{flags) or
%{compile_flags}.

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

2 years ago[funcattrs] Infer access attributes for vararg arguments
Philip Reames [Tue, 21 Dec 2021 17:15:54 +0000 (09:15 -0800)]
[funcattrs] Infer access attributes for vararg arguments

This change allows us to infer access attributes (readnone, readonly) on arguments passed to vararg functions. Since there isn't a formal argument corresponding to the parameter, they'll never be considered part of the speculative SCC, but they can still benefit from attributes on the call site or the callee function.

The main motivation here is just to simplify the code, and remove some special casing. Previously, an indirect vararg call could return more precise results than an direct vararg call which is just weird.

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

2 years ago[funcattrs] Fix incorrect readnone/readonly inference on captured arguments
Philip Reames [Tue, 21 Dec 2021 17:09:54 +0000 (09:09 -0800)]
[funcattrs] Fix incorrect readnone/readonly inference on captured arguments

This fixes a bug where we would infer readnone/readonly for a function which passed a value to a function which could capture it. With the value captured in memory, the function could reload the value from memory after the call, and write to it. Inferring the argument as readnone or readonly is unsound.

@jdoerfert apparently noticed this about two years ago, and tests were checked in with 76467c4, but the issue appears to have never gotten fixed.

Since this seems like this issue should break everything, let me explain why the case is actually fairly narrow. The main inference loop over the argument SCCs only analyzes nocapture arguments. As such, we can only hit this when construction the partial SCCs. Due to that restriction, we can only hit this when we have either a) a function declaration with a manually annotated argument, or b) an immediately self recursive call.

It's also worth highlighting that we do have cases we can infer readonly/readnone on a capturing argument validly. The easiest example is a function which simply returns its argument without ever accessing it.

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

2 years agoSimplify WPD test case for hybrid LTO and thinTLO.
minglotus-6 [Tue, 21 Dec 2021 02:59:22 +0000 (02:59 +0000)]
Simplify WPD test case for hybrid LTO and thinTLO.

1) remove verbose information (function linkage types, alignment, TBAA) 2) remove unused element or replace irrelevant element with null (as placeholders) in virtual table, remove unused definitions of deleted elements accordingly.

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

2 years ago[Clang] Fix build by restricting debug-info-objname.cpp test to x86.
Alexandre Ganea [Tue, 21 Dec 2021 17:22:25 +0000 (12:22 -0500)]
[Clang] Fix build by restricting debug-info-objname.cpp test to x86.

See: https://lab.llvm.org/buildbot/#/builders/188/builds/7188

2 years ago[Clang] debug-info-objname.cpp test: explictly encode a x86 target when using %clang_...
Alexandre Ganea [Tue, 21 Dec 2021 16:53:53 +0000 (11:53 -0500)]
[Clang] debug-info-objname.cpp test: explictly encode a x86 target when using %clang_cl to avoid falling back to a native CPU triple.

2 years ago[clang-format] Remove unnecessary qualifications. NFC.
Marek Kurdej [Tue, 21 Dec 2021 16:51:10 +0000 (17:51 +0100)]
[clang-format] Remove unnecessary qualifications. NFC.

2 years ago[Hexagon] Add ELF flags for Hexagon v69
Krzysztof Parzyszek [Tue, 21 Dec 2021 16:39:59 +0000 (08:39 -0800)]
[Hexagon] Add ELF flags for Hexagon v69

2 years ago[AArch64] Add a tablegen pattern for UZP2.
Alexandros Lamprineas [Tue, 21 Dec 2021 15:41:06 +0000 (15:41 +0000)]
[AArch64] Add a tablegen pattern for UZP2.

Converts concat_vectors((trunc (lshr)), (trunc (lshr))) to UZP2
when the shift amount is half the width of the vector element.

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

2 years ago[clangd] Return error for textdocument/outgoingCalls rather than success
Kadir Cetinkaya [Tue, 21 Dec 2021 16:06:40 +0000 (17:06 +0100)]
[clangd] Return error for textdocument/outgoingCalls rather than success

2 years ago[clang-format] Remove unnecessary qualifications. NFC.
Marek Kurdej [Tue, 21 Dec 2021 15:58:08 +0000 (16:58 +0100)]
[clang-format] Remove unnecessary qualifications. NFC.

2 years agoAMDGPU/GlobalISel: Regenerate test checks
Matt Arsenault [Tue, 21 Dec 2021 15:20:26 +0000 (10:20 -0500)]
AMDGPU/GlobalISel: Regenerate test checks

2 years ago[clang-format] Fix SplitEmptyRecord affecting SplitEmptyFunction.
Marek Kurdej [Tue, 21 Dec 2021 15:44:44 +0000 (16:44 +0100)]
[clang-format] Fix SplitEmptyRecord affecting SplitEmptyFunction.

Fixes https://github.com/llvm/llvm-project/issues/50051.

Given the style:
```
BraceWrapping
  AfterFunction: true
 SplitEmptyFunction: true
 SplitEmptyRecord: false
...
```

The code that should be like:
```
void f(int aaaaaaaaaaaaaaaaaaaaaaaaaaaa,
       int bbbbbbbbbbbbbbbbbbbbbbbb)
{
}
```

gets the braces merged together:
```
void f(int aaaaaaaaaaaaaaaaaaaaaaaaaaaa,
       int bbbbbbbbbbbbbbbbbbbbbbbb)
{}
```

Reviewed By: MyDeveloperDay

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

2 years agotsan: fix failures after multi-threaded fork
Dmitry Vyukov [Tue, 21 Dec 2021 07:52:19 +0000 (08:52 +0100)]
tsan: fix failures after multi-threaded fork

Creating threads after a multi-threaded fork is semi-supported,
we don't give particular guarantees, but we try to not fail
on simple cases and we have die_after_fork=0 flag that enables
not dying on creation of threads after a multi-threaded fork.
This flag is used in the wild:
https://github.com/mongodb/mongo/blob/23c052e3e321dbab90f1863d4d5539d7c1a1cf44/SConstruct#L3599

fork_multithreaded.cpp test started hanging in debug mode
after the recent "tsan: fix deadlock during race reporting" commit,
which added proactive ThreadRegistryLock check in SlotLock.

But the test broke earlier after "tsan: remove quadratic behavior in pthread_join"
commit which made tracking of alive threads based on pthread_t stricter
(CHECK-fail on 2 threads with the same pthread_t, or joining a non-existent thread).
When we start a thread after a multi-threaded fork, the new pthread_t
can actually match one of existing values (for threads that don't exist anymore).
Thread creation started CHECK-failing on this, but the test simply
ignored this CHECK failure in the child thread and "passed".
But after "tsan: fix deadlock during race reporting" the test started hanging dead,
because CHECK failures recursively lock thread registry.

Fix this purging all alive threads from thread registry on fork.

Also the thread registry mutex somehow lost the internal deadlock detector id
and was excluded from deadlock detection. If it would have the id, the CHECK
wouldn't hang because of the nested CHECK failure due to the deadlock.
But then again the test would have silently ignore this error as well
and the bugs wouldn't have been noticed.
Add the deadlock detector id to the thread registry mutex.

Also extend the test to check more cases and detect more bugs.

Reviewed By: melver

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

2 years ago[libc++][NFC] Fix links to https://llvm.org/PR20183 in the tests
Louis Dionne [Tue, 21 Dec 2021 15:33:57 +0000 (10:33 -0500)]
[libc++][NFC] Fix links to https://llvm.org/PR20183 in the tests

2 years ago[Clang] Disable debug-info-objname.cpp test on Unix until I sort out the issue.
Alexandre Ganea [Tue, 21 Dec 2021 15:32:35 +0000 (10:32 -0500)]
[Clang] Disable debug-info-objname.cpp test on Unix until I sort out the issue.

2 years ago[clang][NFC] Refactor coroutine_traits lookup
Nathan Sidwell [Tue, 21 Dec 2021 14:45:25 +0000 (09:45 -0500)]
[clang][NFC] Refactor coroutine_traits lookup

To allow transition from the TS-specified
std::experimental::coroutine_traits to the C++20-specified
std::coroutine_traits, we lookup in both places and provide helpful
diagnostics. This refactors the code to avoid separate paths to
std::experimental lookups.

Reviewed By: ChuanqiXu

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

2 years ago[LV] Ensure WidenCanonicalIVRecipe is always created in header (NFC).
Florian Hahn [Tue, 21 Dec 2021 15:13:18 +0000 (15:13 +0000)]
[LV] Ensure WidenCanonicalIVRecipe is always created in header (NFC).

The VPWidenCanonicalIVRecipe must always be created in the phi section
of the header block. Use that block as insert point.

2 years ago[libcxx][test] Verify customization point object properties
Joe Loser [Wed, 15 Dec 2021 02:19:10 +0000 (21:19 -0500)]
[libcxx][test] Verify customization point object properties

Add test for various customization point object properties as defined by
the Standard. Test various CPOs from `<ranges>`, `<iterator>`,
`<concepts>`, etc.

The test is mostly from https://reviews.llvm.org/D107036 and split up
into this.

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

2 years ago[Debugify] Use WeakWH map collected before Pass when checking loc drop
Djordje Todorovic [Tue, 21 Dec 2021 14:52:55 +0000 (15:52 +0100)]
[Debugify] Use WeakWH map collected before Pass when checking loc drop

This fixes a typo/bug when checking for pointer reuse when testing
DI location preservation in the Debugify original mode (when
checking -g generated Debug Info).

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

2 years ago[CodeGen] Avoid more pointer element type accesses
Nikita Popov [Tue, 21 Dec 2021 14:15:23 +0000 (15:15 +0100)]
[CodeGen] Avoid more pointer element type accesses

2 years ago[CodeView] Emit S_OBJNAME record
Alexandre Ganea [Tue, 21 Dec 2021 14:26:17 +0000 (09:26 -0500)]
[CodeView] Emit S_OBJNAME record

Thanks to @zturner for the initial patch!

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