platform/upstream/llvm.git
4 years ago[PowerPC] fold a bug for rlwinm folding when with full mask.
Chen Zheng [Mon, 15 Jun 2020 01:22:50 +0000 (21:22 -0400)]
[PowerPC] fold a bug for rlwinm folding when with full mask.

Reviewed By: steven.zhang

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

4 years ago[lld-macho] Properly handle & validate relocation r_length
Jez Ng [Sun, 14 Jun 2020 02:52:20 +0000 (19:52 -0700)]
[lld-macho] Properly handle & validate relocation r_length

Summary:
We should be reading / writing our addends / relocated addresses based on
r_length, and not just based on the type of the relocation. But since only
some r_length values are valid for a given reloc type, I've also added some
validation.

ld64 has code to allow for r_length = 0 in X86_64_RELOC_BRANCH relocs, but I'm
not sure how to create such a relocation...

Reviewed By: smeenai

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

4 years ago[lld-macho] No need to explicitly specify -arch in tests
Jez Ng [Sun, 14 Jun 2020 04:45:29 +0000 (21:45 -0700)]
[lld-macho] No need to explicitly specify -arch in tests

Summary: After {D81326} landed, some tests started failing if they did
not have `-arch` specified. I think one of the reasons happened was due
to the fact that we were taking a reference to a temporary value that
was freed too early. Fixing that got the error to go away on my local
Linux machine.

Reviewed By: MaskRay

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

4 years ago[X86][SSE] Fold BITOP(MOVMSK(X),MOVMSK(Y)) -> MOVMSK(BITOP(X,Y))
Simon Pilgrim [Sun, 14 Jun 2020 16:53:33 +0000 (17:53 +0100)]
[X86][SSE] Fold BITOP(MOVMSK(X),MOVMSK(Y)) -> MOVMSK(BITOP(X,Y))

Reduce XMM->GPR traffic by performing bitops on the vectors, and using a single MOVMSK call.

This requires us to use vectors of the same size and element width, but we can mix fp/int type equivalents with suitable bitcasting.

4 years ago[IR] Remove unused IndexAttrPair typedef (NFC)
Nikita Popov [Sun, 14 Jun 2020 20:27:17 +0000 (22:27 +0200)]
[IR] Remove unused IndexAttrPair typedef (NFC)

This was part of an older attributes implementation.

4 years ago[IR] Support efficient AssertingVH/PoisoningVH lookup
Nikita Popov [Sat, 13 Jun 2020 19:10:22 +0000 (21:10 +0200)]
[IR] Support efficient AssertingVH/PoisoningVH lookup

Currently, there doesn't seem to be any way to look up a Value*
in a map/set indexed by AssertingVH/PoisoningVH, without creating
a value handle -- which is fairly expensive, because it involves
adding the value handle to the use list and immediately removing
it again. Using find_as(Value *) does not work (and is in fact
worse than just using find(Value *)), because it will end up
creating multiple value handles during the lookup itself.

For AssertingVH, address this by simply using DenseMapInfo<T *>
instead of manually implementing something. The AssertingVH<T>
will now get coerced to T*, rather than the other way around.

For PoisoningVH, add extra overloads of getHashValue() and
isEqual() that accept a T* argument.

This allows using find_as(Value *) to perform efficient lookups
in assertion-enabled builds.

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

4 years ago[LAA] Do not set CanDoRT to false for AS that do not need RT checks.
Florian Hahn [Sat, 13 Jun 2020 13:24:50 +0000 (14:24 +0100)]
[LAA] Do not set CanDoRT to false for AS that do not need RT checks.

Alternative approach to D80570.

canCheckPtrAtRT already contains checks the figure out for which alias
sets runtime checks are needed. But it currently sets CanDoRT to false
for alias sets for which we cannot do RT checks but also do not need
any.

If we know that we do not need RT checks based on the number of
reads/writes in the alias set, we can skip processing the AS.

This patch also adds an assertion to ensure that DepCands does not
contain more than one write from the alias set.

Reviewers: Ayal, anemet, hfinkel, dmgreen

Reviewed By: dmgreen

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

4 years ago[LoopUnroll] Allow loops with multiple exiting blocks where loop latch
Whitney Tsang [Sun, 14 Jun 2020 18:42:24 +0000 (18:42 +0000)]
[LoopUnroll] Allow loops with multiple exiting blocks where loop latch
is not necessary one of them.

Summary: Currently LoopUnrollPass already allow loops with multiple
exiting blocks, but it is only allowed when the loop latch is one of the
exiting blocks.
When the loop latch is not an exiting block, then only single exiting
block is supported.
When possible, the single loop latch or the single exiting block
terminator is optimized to an unconditional branch in the unrolled loop.

This patch allows loops with multiple exiting blocks even if the loop
latch is not one of them. However, the optimization of exiting block
terminator to unconditional branch is not done when there exists more
than one exiting block.
Reviewer: dmgreen, Meinersbur, etiotto, fhahn, efriedma, bmahjour
Reviewed By: efriedma
Subscribers: hiraditya, zzheng, llvm-commits
Tag: LLVM
Differential Revision: https://reviews.llvm.org/D81053

4 years agoAMDGPU: Add some baseline immediate encoding test changes
Matt Arsenault [Sun, 14 Jun 2020 16:16:38 +0000 (12:16 -0400)]
AMDGPU: Add some baseline immediate encoding test changes

Add some encoding checks and add a few new cases.

4 years agoAMDGPU: Do not bundle inline asm
Matt Arsenault [Thu, 11 Jun 2020 20:09:41 +0000 (16:09 -0400)]
AMDGPU: Do not bundle inline asm

Fixes bug 46285

4 years agoGlobalISel: Add some basic getters to GISelKnownBits
Matt Arsenault [Wed, 10 Jun 2020 13:40:51 +0000 (09:40 -0400)]
GlobalISel: Add some basic getters to GISelKnownBits

4 years agoAMDGPU/GlobalISel: Select general case for G_PTRMASK
Matt Arsenault [Sat, 23 May 2020 21:10:58 +0000 (17:10 -0400)]
AMDGPU/GlobalISel: Select general case for G_PTRMASK

4 years agoAMDGPU: Fix spill/restore of 192-bit registers
Matt Arsenault [Fri, 12 Jun 2020 01:40:21 +0000 (21:40 -0400)]
AMDGPU: Fix spill/restore of 192-bit registers

I tried to use an IR inline asm test, but that doesn't work since the
inline asm handling asserts without an MVT to use.

4 years ago[X86][SSE] Add tests for missing BITOP(MOVMSK(X),MOVMSK(Y)) -> MOVMSK(BITOP(X,Y)...
Simon Pilgrim [Sun, 14 Jun 2020 15:24:18 +0000 (16:24 +0100)]
[X86][SSE] Add tests for missing BITOP(MOVMSK(X),MOVMSK(Y)) -> MOVMSK(BITOP(X,Y)) fold

This would help reduce XMM->GPR traffic for some reduction cases.

4 years ago[PowerPC] Support constrained rounding operations
Qiu Chaofan [Sun, 14 Jun 2020 15:43:31 +0000 (23:43 +0800)]
[PowerPC] Support constrained rounding operations

This patch adds handling of constrained FP intrinsics about round,
truncate and extend for PowerPC target, with necessary tests.

Reviewed By: steven.zhang

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

4 years ago[PowerPC] Exploit vnmsubfp instruction
Qiu Chaofan [Sun, 14 Jun 2020 15:19:17 +0000 (23:19 +0800)]
[PowerPC] Exploit vnmsubfp instruction

On PowerPC, we have vnmsubfp Altivec instruction for fnmsub operation on
v4f32 type. Default pattern for this instruction never works since we
don't have legal fneg for v4f32 when VSX disabled.

Reviewed By: steven.zhang

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

4 years ago[DAGCombiner] Require ninf for division estimation
Qiu Chaofan [Sun, 14 Jun 2020 14:58:22 +0000 (22:58 +0800)]
[DAGCombiner] Require ninf for division estimation

Current implementation of division estimation isn't correct for some
cases like 1.0/0.0 (result is nan, not expected inf).

And this change exposes a potential infinite loop: we use
isConstOrConstSplatFP in combineRepeatedFPDivisors to look up if the
divisor is some constant. But it doesn't work after legalized on some
platforms. This patch restricts the method to act before LegalDAG.

Reviewed By: spatel

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

4 years ago[PassManager] restore early-cse to vector cleanup
Sanjay Patel [Sun, 14 Jun 2020 13:50:10 +0000 (09:50 -0400)]
[PassManager] restore early-cse to vector cleanup

As noted in D80236 - the early-cse pass was included here before:
D75145 / rG71a316883d50
But it got moved outside of the "extra" option there, then it
got dropped while adjusting -vector-combine:
rG6438ea45e053
rG57bb4787d72f

So this is restoring the behavior and adding a test to prevent
accidental changes again. I don't see an equivalent option for
the new pass manager.

4 years ago[OpenMP][Tool] Extend reuse of OMPT testing
Joachim Protze [Wed, 11 Mar 2020 16:02:19 +0000 (17:02 +0100)]
[OpenMP][Tool] Extend reuse of OMPT testing

This patch allows to specify a prefix (default:empty) to be included into print-out
written by callback.h.
Also adding a cmake target to find the header file from other tests.

Reviewed by: jdoerfert

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

4 years ago[OpenMP] support alloc of serialized tasks
Joachim Protze [Wed, 10 Jun 2020 14:44:52 +0000 (16:44 +0200)]
[OpenMP] support alloc of serialized tasks

Reviewed by: AndreyChurbanov

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

4 years ago[LVI] Fix class indentation (NFC)
Nikita Popov [Sun, 14 Jun 2020 13:42:27 +0000 (15:42 +0200)]
[LVI] Fix class indentation (NFC)

This class uses a mix of different indentation levels, normalize it.

4 years ago[LVI] Cache lookup of experimental.guard intrinsic (NFC)
Nikita Popov [Sat, 13 Jun 2020 13:36:55 +0000 (15:36 +0200)]
[LVI] Cache lookup of experimental.guard intrinsic (NFC)

When LVI is performing assume intersections, it also checks for
llvm.experimental.guard intrinsics. To avoid unnecessary block
scans, it first checks whether this intrinsic is declared in the
module at all. I've noticed that we end up spending quite a lot
of time looking up that function again and again...

Avoid this by only looking it up once when LazyValueInfo is
constructed. This of course assumes that we don't introduce new
guard intrinsics (which is the case for all existing uses of LVI --
and even if it weren't, it would not introduce miscompiles, just
potentially lose optimization power.)

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

4 years ago[ARM] Additional cast cost tests.
David Green [Sun, 14 Jun 2020 11:05:20 +0000 (12:05 +0100)]
[ARM] Additional cast cost tests.

This adds additional cast cpst tests useful for MVE, notably around half
types.

4 years ago[InstCombine] reassociate FP diff of sums into sum of diffs
Sanjay Patel [Sun, 14 Jun 2020 13:09:03 +0000 (09:09 -0400)]
[InstCombine] reassociate FP diff of sums into sum of diffs

(a[0] + a[1] + a[2] + a[3]) - (b[0] + b[1] + b[2] +b[3]) -->
(a[0] - b[0]) + (a[1] - b[1]) + (a[2] - b[2]) + (a[3] - b[3])

This should be the last step in solving PR43953:
https://bugs.llvm.org/show_bug.cgi?id=43953

We started emitting reduction intrinsics with:
D80867/ rGe50059f6b6b3
So it's a relatively easy pattern match now to re-order those ops.
Also, I have not seen any complaints for the switch to intrinsics
yet, so I'll propose to remove the "experimental" tag from the
intrinsics soon.

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

4 years ago[InstCombine] allow undef elements when comparing vector constants for min/max bailout
Sanjay Patel [Sun, 14 Jun 2020 13:01:33 +0000 (09:01 -0400)]
[InstCombine] allow undef elements when comparing vector constants for min/max bailout

This is a hacky, but low-risk fix to avoid the infinite loop in PR46271:
https://bugs.llvm.org/show_bug.cgi?id=46271

As discussed there, the problem is that FoldOpIntoSelect() can get into a conflict
with a transform that wants to pull a 'not' op through min/max via
SimplifyDemandedVectorElts(). We need to relax our matching of min/max to include
undefined elements in vector constants to avoid that. Alternatively, we could
improve or cripple the demanded elements analysis, but that could create even
more problems.

The likely better, safer alternative will be to create min/max intrinsics, so
we can remove all of the hacks related to min/max matching in instcombine.

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

4 years ago[X86][SSE] LowerVectorAllZeroTest - add support for pre-SSE41 targets
Simon Pilgrim [Sun, 14 Jun 2020 12:10:33 +0000 (13:10 +0100)]
[X86][SSE] LowerVectorAllZeroTest - add support for pre-SSE41 targets

Even without PTEST, we can still efficiently perform an OR reduction as PMOVMSKB(PCMPEQB(X,0)) == 0, avoiding xmm->gpr extractions.

4 years ago[MLIR][NFC] Update vim syntax file
Uday Bondhugula [Sun, 14 Jun 2020 12:29:06 +0000 (17:59 +0530)]
[MLIR][NFC] Update vim syntax file

Add a few more commonly used ops and missing keywords.

4 years ago[clangd] Fix windows builds failing on check-clangd
njames93 [Sun, 14 Jun 2020 12:29:17 +0000 (13:29 +0100)]
[clangd] Fix windows builds failing on check-clangd

4 years ago[X86][SSE] Add non-SSE41 target PTEST tests
Simon Pilgrim [Sun, 14 Jun 2020 11:20:48 +0000 (12:20 +0100)]
[X86][SSE] Add non-SSE41 target PTEST tests

Ensure codegen is still reasonable - ideally we'd make use of MOVMSK for this.

4 years ago[NFC] mv llvm/test/tools/obj2yaml/macho-DWARF-debug-ranges.yaml llvm/test/ObjectYAML...
Xing GUO [Sun, 14 Jun 2020 08:39:15 +0000 (16:39 +0800)]
[NFC] mv llvm/test/tools/obj2yaml/macho-DWARF-debug-ranges.yaml llvm/test/ObjectYAML/MachO/DWARF-debug_ranges.yaml

4 years ago[ObjectYAML][DWARF] Let the target address size be inferred from FileHeader.
Xing GUO [Sun, 14 Jun 2020 04:00:46 +0000 (12:00 +0800)]
[ObjectYAML][DWARF] Let the target address size be inferred from FileHeader.

This patch adds a new field `bool Is64bit` in `DWARFYAML::Data` to indicate the address size of target. It's helpful for inferring the `AddrSize` in some DWARF sections.

Reviewed By: MaskRay

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

4 years ago[IteratedDominanceFrontier] Decrease number of SmallPtrSet::insert and delete unneede...
Fangrui Song [Sun, 14 Jun 2020 02:48:50 +0000 (19:48 -0700)]
[IteratedDominanceFrontier] Decrease number of SmallPtrSet::insert and delete unneeded SmallVector::clear

Also, fix the argument name to be consistent with the declaration.

4 years ago[X86] Add mayLoad flag to FARCALL*m/FARJMP memory instrutions. Add 'm' to the end...
Craig Topper [Sat, 13 Jun 2020 22:40:51 +0000 (15:40 -0700)]
[X86] Add mayLoad flag to FARCALL*m/FARJMP memory instrutions. Add 'm' to the end of FARJMP64/FARCALL64 instruction names.

We never codegen them so this doesn't matter in practice. But
sometimes someone comes along and tries to use these flags
for something else. LIke the Load Value Inject inline assembly
handling.

4 years ago[X86] Automatically harden inline assembly RET instructions against Load Value Inject...
Craig Topper [Sat, 13 Jun 2020 22:16:00 +0000 (15:16 -0700)]
[X86] Automatically harden inline assembly RET instructions against Load Value Injection (LVI)

Previously, the X86AsmParser would issue a warning whenever a ret instruction is encountered. This patch changes the behavior to automatically transform each ret instruction in an inline assembly stream into:

shlq $0, (%rsp)
lfence
ret

which is secure, according to https://software.intel.com/security-software-guidance/insights/deep-dive-load-value-injection#specialinstructions.

Patch by Scott Constable with some minor changes by Craig Topper.

4 years ago[X86] Teach combineBitcastvxi1 to prefer movmsk on avx512 in more cases
Craig Topper [Sat, 13 Jun 2020 21:50:06 +0000 (14:50 -0700)]
[X86] Teach combineBitcastvxi1 to prefer movmsk on avx512 in more cases

If the input to the bitcast is a sign bit test, it makes sense to
directly use vpmovmskb or vmovmskps/pd. This removes the need to
copy the sign bits to a k-register and then to a GPR.

Fixes PR46200.

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

4 years ago[X86] Move -x86-use-vzeroupper command line flag into runOnMachineFunction for the...
Craig Topper [Sat, 13 Jun 2020 21:40:56 +0000 (14:40 -0700)]
[X86] Move -x86-use-vzeroupper command line flag into runOnMachineFunction for the pass itself rather than the pass pipeline construction

This pass has no dependencies on other passes so conditionally
including it in the pipeline doens't do much. Just move it the
pass itself to keep it isolated.

4 years ago[NFCI][AggressiveInstCombiner] Add `STATISTIC()`s for transforms
Roman Lebedev [Sat, 13 Jun 2020 12:24:53 +0000 (15:24 +0300)]
[NFCI][AggressiveInstCombiner] Add `STATISTIC()`s for transforms

4 years agoRevert "[libc++] Migrate Lit platform detection to the DSL"
Vladimir Vereschaka [Sat, 13 Jun 2020 19:50:43 +0000 (12:50 -0700)]
Revert "[libc++] Migrate Lit platform detection to the DSL"

This reverts commit 3ea9450bda902574426a847e290567ffaf6a6c40.

The commit fails the remote library tests on the toolchain builders:

http://lab.llvm.org:8011/builders/llvm-clang-win-x-armv7l
http://lab.llvm.org:8011/builders/llvm-clang-win-x-aarch64

4 years ago[DSE,MSSA] Fix location order in isOverwrite call.
Florian Hahn [Sat, 13 Jun 2020 19:24:57 +0000 (20:24 +0100)]
[DSE,MSSA] Fix location order in isOverwrite call.

isOverwrite expects the later location as first argument and the earlier
result later. The adjusted call is intended to check whether CC
overwrites DefLoc.

4 years ago[X86] Enable the EVEX->VEX compression pass at -O0.
Craig Topper [Sat, 13 Jun 2020 19:28:46 +0000 (12:28 -0700)]
[X86] Enable the EVEX->VEX compression pass at -O0.

A lot of what EVEX->VEX does is equivalent to what the
prioritization in the assembly parser does. When an AVX mnemonic
is used without any EVEX features or XMM16-31, the parser will
pick the VEX encoding.

Since codegen doesn't go through the parser, we should also
use VEX instructions when we can so that the code coming out of
integrated assembler matches what you'd get from outputing an
assembly listing and parsing it.

The pass early outs if AVX isn't enabled and uses TSFlags to
check for EVEX instructions before doing the more costly table
lookups. Hopefully that's enough to keep this from impacting
-O0 compile times.

4 years ago[X86] Separate imm from relocImm handling.
Craig Topper [Sat, 13 Jun 2020 18:29:28 +0000 (11:29 -0700)]
[X86] Separate imm from relocImm handling.

relocImm was a complexPattern that handled both ConstantSDNode
and X86Wrapper. But it was only applied selectively because using
it would cause patterns to be not importable into FastISel or
GlobalISel. So it only got applied to flag setting instructions,
stores, RMW arithmetic instructions, and rotates.

Most of the test changes are a result of making patterns available
to GlobalISel or FastISel. The absolute-cmp.ll change is due to
this fixing a pattern ordering issue to make an absolute symbol
match to an 8-bit immediate before trying a 32-bit immediate.

I tried to use PatFrags to reduce the repetition, but I was getting
errors from TableGen.

4 years agoFix FastISel dropping srcloc metadata from InlineAsm
Amanieu d'Antras [Sat, 13 Jun 2020 07:16:58 +0000 (08:16 +0100)]
Fix FastISel dropping srcloc metadata from InlineAsm

Summary:
Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=46060

I've also added the Extra_IsConvergent flag which was missing from FastISel.

Reviewers: echristo

Reviewed By: echristo

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[lldb][test] Trying to fix build bot after 0431e4bcb27bba30156ac49be4c09ac632c5a03a
Xing GUO [Sat, 13 Jun 2020 15:53:13 +0000 (23:53 +0800)]
[lldb][test] Trying to fix build bot after 0431e4bcb27bba30156ac49be4c09ac632c5a03a

4 years agoRecommit "[DWARFYAML][debug_line] Replace `InitialLength` with `Format` and `Length`."
Xing GUO [Sat, 13 Jun 2020 14:04:51 +0000 (22:04 +0800)]
Recommit "[DWARFYAML][debug_line] Replace `InitialLength` with `Format` and `Length`."

This recommits fcc0c186e9cea0af644581069058f0e00469d20e

4 years ago[clang][NFC] Pack LambdaExpr
Bruno Ricci [Sat, 13 Jun 2020 13:17:03 +0000 (14:17 +0100)]
[clang][NFC] Pack LambdaExpr

This saves sizeof(void *) bytes per LambdaExpr.

Review-after-commit since this is a straightforward change similar
to the work done on other nodes. NFC.

4 years ago[clang-format] Fix short block when braking after control statement
mydeveloperday [Sat, 13 Jun 2020 13:17:01 +0000 (14:17 +0100)]
[clang-format] Fix short block when braking after control statement

Summary:
This patch fixes bug #44192

When clang-format is run with option AllowShortBlocksOnASingleLine, it is expected to either succeed in putting the short block with its control statement on a single line or fail and leave the block as is. When brace wrapping after control statement is activated, if the block + the control statement length is superior to column limit but the block alone is not, clang-format puts the block in two lines: one for the control statement and one for the block. This patch removes this unexpected behaviour. Current unittests are updated to check for this behaviour.

Patch By: Bouska

Reviewed By: MyDeveloperDay

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

4 years ago[clang][NFC] Add an AST dump test for LambdaExpr
Bruno Ricci [Sat, 13 Jun 2020 13:03:25 +0000 (14:03 +0100)]
[clang][NFC] Add an AST dump test for LambdaExpr

This test illustrate the bug fixed in D81787.

4 years ago[clang][NFC] Mark CWG 1443 (Default arguments and non-static data members)...
Bruno Ricci [Sat, 13 Jun 2020 12:59:54 +0000 (13:59 +0100)]
[clang][NFC] Mark CWG 1443 (Default arguments and non-static data members)...

...as done. This is a NAD which has always been implemented correctly.

4 years ago[clang][NFC] Mark CWG 974 and 1814 (default argument in a...
Bruno Ricci [Sat, 13 Jun 2020 12:49:07 +0000 (13:49 +0100)]
[clang][NFC] Mark CWG 974 and 1814 (default argument in a...

...lambda-expression) as done. They have been allowed since at least clang 3.3.

4 years agoRevert "[DWARFYAML][debug_line] Replace `InitialLength` with `Format` and `Length`."
Xing GUO [Sat, 13 Jun 2020 09:57:02 +0000 (17:57 +0800)]
Revert "[DWARFYAML][debug_line] Replace `InitialLength` with `Format` and `Length`."

This reverts commit fcc0c186e9cea0af644581069058f0e00469d20e.

4 years ago[DWARFYAML][debug_line] Replace `InitialLength` with `Format` and `Length`.
Xing GUO [Sat, 13 Jun 2020 09:45:09 +0000 (17:45 +0800)]
[DWARFYAML][debug_line] Replace `InitialLength` with `Format` and `Length`.

4 years agoReapply [LVI] Restructure caching to fix non-determinism
Nikita Popov [Sat, 16 Nov 2019 15:22:18 +0000 (16:22 +0100)]
Reapply [LVI] Restructure caching to fix non-determinism

This was reverted due to a reported memory usage increase. However,
a test case was never provided, and I wasn't able to reproduce it
myself.

Relative to the original patch, I have moved the block cache
structure behind a unique_ptr, to avoid storing a huge structure
inside a DenseMap.

---

Variant on D70103 to fix https://bugs.llvm.org/show_bug.cgi?id=43909.
The caching is switched to always use a BB to cache entry map, which
then contains per-value caches. A separate set contains value handles
with a deletion callback. This allows us to properly invalidate
overdefined values.

A possible alternative would be to always cache by value first and
have per-BB maps/sets in the each cache entry. In that case we could
use a ValueMap and would avoid the separate value handle set. I went
with the BB indexing at the top level to make it easier to integrate
D69914, but possibly that's not the right choice.

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

4 years ago[libunwind][RISCV] Track PC separately from RA
Amanieu d'Antras [Sat, 13 Jun 2020 06:57:48 +0000 (07:57 +0100)]
[libunwind][RISCV] Track PC separately from RA

Summary:
This allows unwinding to work across signal handler frames where the IP of the previous frame is not the same as the current value of the RA register. This is particularly useful for acquiring backtraces from signal handlers.

I kept the size of the context structure the same to avoid ABI breakage; the PC is stored in the previously unused slot for register 0.

Reviewers: #libunwind, mhorne, lenary, luismarques, arichardson, compnerd

Reviewed By: #libunwind, mhorne, lenary, compnerd

Subscribers: kamleshbhalui, jrtc27, bsdjhb, arichardson, compnerd, simoncook, kito-cheng, shiva0217, rogfer01, rkruppe, psnobl, benna, Jim, s.egerton, sameer.abuasal, evandro, llvm-commits, libcxx-commits

Tags: #libunwind, #llvm

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

4 years ago[lldb] Remove unnecessary c_str() in OutputFormattedHelpText calls (NFC)
Jonas Devlieghere [Sat, 13 Jun 2020 04:13:20 +0000 (21:13 -0700)]
[lldb] Remove unnecessary c_str() in OutputFormattedHelpText calls (NFC)

4 years ago[lldb] Small improvements in ValueObjectPrinter::PrintDecl (NFC)
Jonas Devlieghere [Sat, 13 Jun 2020 04:01:37 +0000 (21:01 -0700)]
[lldb] Small improvements in ValueObjectPrinter::PrintDecl (NFC)

Remove unused argument, simply code and reformat.

4 years ago[X86] Remove brand_id check from getHostCPUName.
Craig Topper [Sat, 13 Jun 2020 03:38:30 +0000 (20:38 -0700)]
[X86] Remove brand_id check from getHostCPUName.

Brand index was a feature some Pentium III and Pentium 4 CPUs.
It provided an index into a software lookup table to provide a
brand name for the CPU. This is separate from the family/model.

It's unclear to me why this index being non-zero was used to
block checking family/model. I think the effect of this is that
-march=native was not working correctly on the CPUs that have a
non-zero brand index. They are all about 20 years old so this
probably hasn't affected many users.

4 years ago[X86] Remove brand_id check from cpu_indicator_init.
Craig Topper [Sat, 13 Jun 2020 03:35:47 +0000 (20:35 -0700)]
[X86] Remove brand_id check from cpu_indicator_init.

Brand index was a feature some Pentium III and Pentium 4 CPUs.
It provided an index into a software lookup table to provide a
brand name for the CPU. This is separate from the family/model.

It's unclear to me why this index being non-zero was used to
block checking family/model. None of the CPUs that had a non-zero
brand index are supported by __builtin_cpu_is or target
multi-versioning so this should have no real effect.

4 years agoFix GCC5 build by renaming variable used in 'auto' deduction (NFC)
Mehdi Amini [Sat, 13 Jun 2020 02:52:55 +0000 (02:52 +0000)]
Fix GCC5 build by renaming variable used in 'auto' deduction (NFC)

GCC5 errors out with:

llvm/lib/Analysis/StackSafetyAnalysis.cpp:935:21: error: use of 'KV' before deduction of 'auto'
     for (auto &KV : KV.second.Params) {
                     ^

4 years ago[WebAssembly] WebAssembly doesn't support "protected" visibility
Dan Gohman [Wed, 10 Jun 2020 00:34:55 +0000 (17:34 -0700)]
[WebAssembly] WebAssembly doesn't support "protected" visibility

Implement the `hasProtectedVisibility()` hook to indicate that, like
Darwin, WebAssembly doesn't support "protected" visibility.

On ELF, "protected" visibility is intended to be an optimization, however
in practice it often [isn't], and ELF documentation generally ranges from
[not mentioning it at all] to [strongly discouraging its use].

[isn't]: https://www.airs.com/blog/archives/307
[not mentioning it at all]: https://gcc.gnu.org/wiki/Visibility
[strongly discouraging its use]: https://www.akkadia.org/drepper/dsohowto.pdf

While here, also mention the new Reactor support in the release notes.

4 years ago[X86] Combine the three feature variables in getHostCPUName into an array and pass...
Craig Topper [Sat, 13 Jun 2020 00:13:49 +0000 (17:13 -0700)]
[X86] Combine the three feature variables in getHostCPUName into an array and pass it around as an array reference.

This makes the setting and clearing of bits simpler.

4 years ago[X86] Combine to two feature variables in __cpu_indicator_init into an array and...
Craig Topper [Sat, 13 Jun 2020 00:13:04 +0000 (17:13 -0700)]
[X86] Combine to two feature variables in __cpu_indicator_init into an array and pass them around as pointer we can treat as an array.

This simplifies the indexing code to set and test bits.

4 years ago[X86] Explicitly initialize __cpu_features2 global in compiler-rt to 0.
Craig Topper [Sat, 13 Jun 2020 00:09:17 +0000 (17:09 -0700)]
[X86] Explicitly initialize __cpu_features2 global in compiler-rt to 0.

Seems like this may be needed in order for the linker to find the
symbol. At least on my Mac.

4 years ago[StackSafety] Run ThinLTO
Vitaly Buka [Fri, 5 Jun 2020 08:11:35 +0000 (01:11 -0700)]
[StackSafety] Run ThinLTO

Summary:
ThinLTO linking runs dataflow processing on collected
function parameters. Then StackSafetyGlobalInfoWrapperPass
in ThinLTO backend will run as usual looking up to external
symbol in the summary if needed.

Depends on D80985.

Reviewers: eugenis, pcc

Reviewed By: eugenis

Subscribers: inglorion, hiraditya, steven_wu, dexonsmith, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

4 years ago[StackSafety,NFC] Extract addOverflowNever
Vitaly Buka [Sat, 13 Jun 2020 00:41:28 +0000 (17:41 -0700)]
[StackSafety,NFC] Extract addOverflowNever

4 years ago[flang] Add the helper class for building fir.do_loop operations. A fir.do_loop model...
Eric Schweitz [Thu, 11 Jun 2020 20:56:12 +0000 (13:56 -0700)]
[flang] Add the helper class for building fir.do_loop operations. A fir.do_loop models the semantics of a Fortran DO loop construct. One can use this operation to explicitly capture a DO loop for passing into the high-level optimizer.

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

4 years ago[MLIR][SPIRVToLLVM] Implemented shift conversion pattern
George Mitenkov [Fri, 12 Jun 2020 23:04:17 +0000 (19:04 -0400)]
[MLIR][SPIRVToLLVM] Implemented shift conversion pattern

This patch has shift ops conversion implementation. In SPIR-V dialect,
`Shift` and `Base` may have different bit width. On the contrary,
in LLVM dialect both `Base` and `Shift` have to be of the same bit width.
This leads to the following cases:
- if `Base` has the same bit width as `Shift`, the conversion is
  straightforward.
- if `Base` has a greater bit width than `Shift`, shift is sign/zero
  extended first. Then the extended value is passed to the shift.
- otherwise the conversion is considered to be illegal.

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

4 years ago[lldb/Test] Assert that no targets or modules remain after a test completes.
Jonas Devlieghere [Fri, 12 Jun 2020 22:12:55 +0000 (15:12 -0700)]
[lldb/Test] Assert that no targets or modules remain after a test completes.

The reproducer intentionally leak every object allocated during replay,
which means that modules never get orphaned. If this were to happen for
another reason, we might not be testing what we think we are. Assert
that there are no targets left at the end of a test and that the global
module cache is empty in the non-reproducer scenario.

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

4 years ago[flang] Added test for specification expressions
Pete Steinfeld [Fri, 12 Jun 2020 19:42:51 +0000 (12:42 -0700)]
[flang] Added test for specification expressions

I added a test the exercises all of the cases instances of specification expressions as defined in section 10.1.11.

Summary: [flang] Added test for specification expressions

Reviewers: tskeith, klausler, DavidTruby

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[mlir][spirv] Enhance structure type member decoration handling
HazemAbdelhafez [Wed, 10 Jun 2020 23:15:55 +0000 (19:15 -0400)]
[mlir][spirv] Enhance structure type member decoration handling

Modify structure type in SPIR-V dialect to support:
1) Multiple decorations per structure member
2) Key-value based decorations (e.g., MatrixStride)

This commit kept the Offset decoration separate from members'
decorations container for easier implementation and logical clarity.
As such, all references to Structure layoutinfo are now offsetinfo,
and any member layout defining decoration (e.g., RowMajor for Matrix)
will be add to the members' decorations container along with its
value if any.

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

4 years ago[libcxx][test] Silence MSVC signed-to-unsigned implicit conversion warnings
Casey Carter [Fri, 12 Jun 2020 21:54:51 +0000 (14:54 -0700)]
[libcxx][test] Silence MSVC signed-to-unsigned implicit conversion warnings

4 years ago[lldb/Test] Fix unit test suffixes and add a CMake error.
Jonas Devlieghere [Fri, 12 Jun 2020 21:17:20 +0000 (14:17 -0700)]
[lldb/Test] Fix unit test suffixes and add a CMake error.

Lit will only look for unittest targets ending in `Tests`. Add an error
when the target doesn't have the `Tests` suffix.

4 years ago[WebAssembly] Add intrinsic for i64x2.mul
Thomas Lively [Fri, 12 Jun 2020 21:08:18 +0000 (14:08 -0700)]
[WebAssembly] Add intrinsic for i64x2.mul

Summary:
This instruction was implemented in 3181273be7, but that commit did
not add an intrinsic for it.

Reviewers: aheejin

Subscribers: dschuff, sbc100, jgravelle-google, sunfish, cfe-commits

Tags: #clang

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

4 years agoTemporarily revert "[MemCpyOptimizer] Simplify API of processStore and processMem...
Eric Christopher [Fri, 12 Jun 2020 21:00:32 +0000 (14:00 -0700)]
Temporarily revert "[MemCpyOptimizer] Simplify API of processStore and processMem* functions"
as it seems to be causing some internal crashes in AA after
email with the author.

This reverts commit f79e6a8847aa330cac6837168d02f6b319024858.

4 years ago[lldb/Test] Fix unittest name
Jonas Devlieghere [Fri, 12 Jun 2020 21:00:57 +0000 (14:00 -0700)]
[lldb/Test] Fix unittest name

Lit looks for the Tests prefix in the unit test name.

4 years ago[NFCI][MachineCopyPropagation] invalidateRegister(): use SmallSet<8> instead of DenseSet.
Roman Lebedev [Fri, 12 Jun 2020 16:08:01 +0000 (19:08 +0300)]
[NFCI][MachineCopyPropagation] invalidateRegister(): use SmallSet<8> instead of DenseSet.

This decreases the time consumed by the pass [during RawSpeed unity build]
by 25% (0.0586 s -> 0.04388 s).

While that isn't really impressive overall, that wasn't the goal here.
The memory results here are noticeable.
The baseline results are:
```
total runtime: 55.65s.
calls to allocation functions: 19754254 (354960/s)
temporary memory allocations: 4951609 (88974/s)
peak heap memory consumption: 239.13MB
peak RSS (including heaptrack overhead): 463.79MB
total memory leaked: 198.01MB
```
While with this patch the results are:
```
total runtime: 55.37s.
calls to allocation functions: 19068237 (344403/s)   # -3.47 %
temporary memory allocations: 4261772 (76974/s)      # -13.93 % (!!!)
peak heap memory consumption: 239.13MB
peak RSS (including heaptrack overhead): 463.73MB
total memory leaked: 198.01MB
```

So we get rid of *a lot* of temporary allocations.

Using `SmallSet<8>` makes sense to me because at least here
for x86 BdVer2, the size of that set is *never* more than 3,
over all of llvm test-suite + RawSpeed.

The story might be different on other targets,
not sure if it will ever justify whole DenseSet,
but if it does SmallDenseSet might be a compromise.

4 years ago[NFCI] VectorCombine: add statistic for bitcast(shuf()) -> shuf(bitcast()) xform
Roman Lebedev [Fri, 12 Jun 2020 17:49:38 +0000 (20:49 +0300)]
[NFCI] VectorCombine: add statistic for bitcast(shuf()) -> shuf(bitcast()) xform

4 years ago[NFC] OpenMPOpt: add a statistic for num of parallel regions deleted
Roman Lebedev [Fri, 12 Jun 2020 15:11:34 +0000 (18:11 +0300)]
[NFC] OpenMPOpt: add a statistic for num of parallel regions deleted

4 years agoAdd GNU idutils tag filename to .gitignore.
Kazushi (Jam) Marukawa [Fri, 12 Jun 2020 20:05:08 +0000 (16:05 -0400)]
Add GNU idutils tag filename to .gitignore.

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

4 years ago[MC] Changes to help improve target specific symbol disassembly
Ronak Chauhan [Fri, 12 Jun 2020 18:00:33 +0000 (14:00 -0400)]
[MC] Changes to help improve target specific symbol disassembly

Summary:
This commit slightly modifies the MCDisassembler, and llvm-objdump to
allow targets to also decode entire symbols.

WebAssembly uses the onSymbolStart hook it to decode preludes.
WebAssembly partially disassembles the symbol in its target specific
way; and then falls back to the normal flow of llvm-objdump.

AMDGPU needs it to decode kernel descriptors entirely, and move to the
next symbol.

This commit is to split the above task into 2.
- Changes to llvm-objdump and MC-layer without breaking WebAssembly code
  [ this commit ]
- AMDGPU's implementation of onSymbolStart that decodes kernel
  descriptors. [ https://reviews.llvm.org/D80713 ]

Reviewers: scott.linder, t-tye, sunfish, arsenm, jhenderson, MaskRay, aardappel

Reviewed By: scott.linder, jhenderson, aardappel

Subscribers: bcain, dschuff, wdng, tpr, sbc100, jgravelle-google, hiraditya, aheejin, MaskRay, rupprecht, llvm-commits

Tags: #llvm

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

4 years ago[SVE] Break dependency of Type.h on DerivedTypes.h
Christopher Tetreault [Fri, 12 Jun 2020 18:02:07 +0000 (11:02 -0700)]
[SVE] Break dependency of Type.h on DerivedTypes.h

Summary:
Inline functions in Type.h depended upon inline functions isVectorTy and
getScalarType defined in DerivedTypes.h. Reimplement these functions in
Type.h in terms of Type

Reviewers: rengolin, efriedma, echristo, c-rhodes, david-arm

Reviewed By: echristo

Subscribers: tschuett, rkruppe, psnobl, llvm-commits

Tags: #llvm

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

4 years agollvm-dwarfdump: Include unit count in DWP index header dumping
David Blaikie [Fri, 12 Jun 2020 19:39:08 +0000 (12:39 -0700)]
llvm-dwarfdump: Include unit count in DWP index header dumping

And add comma separators (to be consistent with recent
changes/improvements to the dumping of other section headers) while I'm
here.

4 years ago[CMake] Use 'ssh.py' executor to run the remote library tests.
Vladimir Vereschaka [Fri, 12 Jun 2020 18:16:02 +0000 (11:16 -0700)]
[CMake] Use 'ssh.py' executor to run the remote library tests.

In order to support the libcxx new format changes SSHExecutor was
replaced with ssh.py script in the following way:

LIBxxx_EXECUTOR="<llvm-root>/libcxx/utils/ssh.py --host <username>@<host>"

See 96e6cbbf941d0f937b7e823433d4c222967a1817 commit for details.

4 years ago[amdgpu] Skip OR combining on 64-bit integer before legalizing ops.
Michael Liao [Thu, 4 Jun 2020 06:00:06 +0000 (02:00 -0400)]
[amdgpu] Skip OR combining on 64-bit integer before legalizing ops.

Reviewers: arsenm, rampitec

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits

Tags: #llvm

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

4 years agoRevert "[analyzer][NFC] Don't allow dependency checkers to emit diagnostics"
Sterling Augustine [Fri, 12 Jun 2020 18:11:20 +0000 (11:11 -0700)]
Revert "[analyzer][NFC] Don't allow dependency checkers to emit diagnostics"

Summary:
This reverts commit 33fb9cbe211d1b43d4b84edf34e11001f04cddf0.

That commit violates layering by adding a dependency from StaticAnalyzer/Core
back to StaticAnalyzer/FrontEnd, creating a circular dependency.

I can't see a clean way to fix it except refactoring.

Reviewers: echristo, Szelethus, martong

Subscribers: xazax.hun, baloghadamsoftware, szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp, Charusso, ASDenysPetrov, cfe-commits

Tags: #clang

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

4 years agoUpdate Kaleidoscope tutorial inline code
Erich Keane [Fri, 12 Jun 2020 19:01:21 +0000 (12:01 -0700)]
Update Kaleidoscope tutorial inline code

Reported on IRC, the tutorial code at the bottom of the page correctly
namespaces the FunctionPassManager, but the as-you-go code does not.
This patch adds the namespace to those.

4 years ago[libc++] Add missing sitedir to local Lit config
Louis Dionne [Fri, 12 Jun 2020 18:57:03 +0000 (14:57 -0400)]
[libc++] Add missing sitedir to local Lit config

It relied on the site dir being added by a previous config file.

4 years ago[AMDGPU] Sorted targets in amdgpu-features.cl. NFC.
Stanislav Mekhanoshin [Fri, 12 Jun 2020 18:54:12 +0000 (11:54 -0700)]
[AMDGPU] Sorted targets in amdgpu-features.cl. NFC.

4 years ago[libcxx][test] include <algorithm> for is_permutation
Casey Carter [Fri, 12 Jun 2020 18:53:53 +0000 (11:53 -0700)]
[libcxx][test] include <algorithm> for is_permutation

4 years ago[AArch64][GlobalISel] Legalize vector G_PTR_ADD and enable selection.
Amara Emerson [Mon, 8 Jun 2020 19:02:04 +0000 (12:02 -0700)]
[AArch64][GlobalISel] Legalize vector G_PTR_ADD and enable selection.

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

4 years ago[ARM] Always use reductions intrinsics under MVE
David Green [Fri, 12 Jun 2020 10:35:03 +0000 (11:35 +0100)]
[ARM] Always use reductions intrinsics under MVE

Similar to a recent change to the X86 backend, this changes things so
that we always produce a reduction intrinsics for all reduction types,
not just the legal ones. This gives a better chance in the backend to
custom lower them to something more suitable for MVE. Especially for
something like fadd the in-order reduction produced during DAG lowering
is already better than the shuffles produced in the midend, and we can
do even better with a bit of custom lowering.

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

4 years ago[TableGen] Make behavior of getValueAsListOfStrings consistent with getValueAsString
Daniel Grumberg [Wed, 10 Jun 2020 17:05:10 +0000 (18:05 +0100)]
[TableGen] Make behavior of getValueAsListOfStrings consistent with getValueAsString

4 years ago[libc++] Remove obsolete 'newlib' Lit Feature
Louis Dionne [Fri, 12 Jun 2020 15:04:42 +0000 (11:04 -0400)]
[libc++] Remove obsolete 'newlib' Lit Feature

The feature isn't defined anywhere, so it's effectively dead.

4 years ago[libc++] Migrate Lit platform detection to the DSL
Louis Dionne [Fri, 17 Apr 2020 20:00:58 +0000 (16:00 -0400)]
[libc++] Migrate Lit platform detection to the DSL

As an important fly-by fix, also make sure we set those features to their
value on the target we run on, not on the host compiling the test suite.

4 years ago[Lit] Pass through SSH_AUTH_SOCK from the surrounding environment
Louis Dionne [Fri, 12 Jun 2020 17:58:09 +0000 (13:58 -0400)]
[Lit] Pass through SSH_AUTH_SOCK from the surrounding environment

This allows running Lit tests that run ssh without having to manually
enter a password (which is inconvenient), by just having ssh-agent
setup properly when running the test suite.

4 years ago[DAGCombine] Generalize the case (add (or x, c1), c2) -> (add x, (c1 + c2))
Michael Liao [Thu, 4 Jun 2020 06:01:49 +0000 (02:01 -0400)]
[DAGCombine] Generalize the case (add (or x, c1), c2) -> (add x, (c1 + c2))

Reviewers: arsenm

Subscribers: sdardis, wdng, hiraditya, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, Jim, lenary, s.egerton, pzheng, sameer.abuasal, apazos, luismarques, ecnelises, llvm-commits

Tags: #llvm

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

4 years agoDon't diagnose a redeclaration of a deduction guide if the prior
Richard Smith [Fri, 12 Jun 2020 17:27:48 +0000 (10:27 -0700)]
Don't diagnose a redeclaration of a deduction guide if the prior
declaration is not visible.

In passing, add a test for a similar case of conflicting redeclarations
of internal-linkage structured bindings. (This case already works).

4 years ago[flang] Dodge bogus uninitialized data warning from gcc 10.1 via code cleanup
peter klausler [Fri, 12 Jun 2020 17:05:04 +0000 (10:05 -0700)]
[flang] Dodge bogus uninitialized data warning from gcc 10.1 via code cleanup

G++ 10.1 emits inappropriate "use of uninitialized data" warnings when
compiling f18.  The warnings stem from two sites in templatized code
whose multiple instantiations magnified the number of warnings.

These changes dodge those warnings by making some innocuous changes to
the code.  In the parser, the idiom defaulted(cut >> x), which yields a
parser that always succeeds, has been replaced with a new equivalent
pass<T>() parser that returns a default-constructed value T{} in an
arguably more readable fashion.  This idiom was the only attestation of
the basic parser cut, so it has been removed and the remaining code
simplified.  In Evaluate/traverse.h, a return {}; was replaced with a
return of a default-constructed member.

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

4 years ago[analyzer] Avoid unused variable warning in opt build
Jacques Pienaar [Fri, 12 Jun 2020 16:48:49 +0000 (09:48 -0700)]
[analyzer] Avoid unused variable warning in opt build

4 years ago[AArch64][GlobalISel] Allow G_DUP for elements smaller than 32 B.
Jessica Paquette [Fri, 5 Jun 2020 23:59:27 +0000 (16:59 -0700)]
[AArch64][GlobalISel] Allow G_DUP for elements smaller than 32 B.

We select all of these via patterns now, so there's no reason to disallow this.

Update select-dup.mir to show that we correctly select the smaller types.

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

4 years ago[AArch64][GlobalISel] Set hasSideEffects = 0 on custom shuffle opcodes
Jessica Paquette [Tue, 9 Jun 2020 18:27:28 +0000 (11:27 -0700)]
[AArch64][GlobalISel] Set hasSideEffects = 0 on custom shuffle opcodes

This was making it so that the instructions weren't eliminated in
select-rev.mir and select-trn.mir despite not being used.

Update the tests accordingly.

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