platform/upstream/llvm.git
3 years ago[AMDGPU] Rename "LDS lowering" pass name.
hsmahesha [Wed, 14 Apr 2021 14:49:25 +0000 (20:19 +0530)]
[AMDGPU] Rename "LDS lowering" pass name.

Rename the name of "LDS lowering" pass from `amdgpu-disable-lower-module-lds` to
`amdgpu-enable-lower-module-lds` as later is consistent and reads better.

Reviewed By: JonChesterfield

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

3 years ago[X86][SSE] canonicalizeShuffleWithBinOps - check for more combos of merge-able binary...
Simon Pilgrim [Wed, 14 Apr 2021 14:07:43 +0000 (15:07 +0100)]
[X86][SSE] canonicalizeShuffleWithBinOps - check for more combos of merge-able binary shuffles.

In the fold SHUFFLE(BINOP(X,Y),BINOP(Z,W)) -> BINOP(SHUFFLE(X,Z),SHUFFLE(Y,W)), check if both X/Z AND Y/W have at least one merge-able shuffle in which case the total number of shuffle should still fall.

Helps with instruction count regressions we saw while fixing PR48823

3 years ago[SLP] createOp - fix null dereference warning. NFCI.
Simon Pilgrim [Wed, 14 Apr 2021 10:33:41 +0000 (11:33 +0100)]
[SLP] createOp - fix null dereference warning. NFCI.

Only attempt to propagateIRFlags if we have both SelectInst - afaict we shouldn't have matched a min/max reduction without both SelectInst, but static analyzer doesn't know that.

3 years ago[AArch64][v8.5A] Add BTI to all function starts
Pablo Barrio [Wed, 24 Mar 2021 11:03:05 +0000 (11:03 +0000)]
[AArch64][v8.5A] Add BTI to all function starts

The existing BTI placement pass avoids inserting "BTI c" when the
function has local linkage and is only directly called. However,
even in this case, there is a (small) chance that the linker later
adds a hunk with an indirect call to the function, e.g. if the
function is placed in a separate section and moved far away from
its callers. Make sure to add BTI for these functions too.

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

3 years ago[mlir][StandardToSPIRV] Add support for lowering memref<?xi1> to SPIR-V
Hanhan Wang [Wed, 14 Apr 2021 14:22:41 +0000 (07:22 -0700)]
[mlir][StandardToSPIRV] Add support for lowering memref<?xi1> to SPIR-V

Reviewed By: antiagainst

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

3 years ago[gn build] Port bbab9f986c6d
LLVM GN Syncbot [Wed, 14 Apr 2021 13:59:02 +0000 (13:59 +0000)]
[gn build] Port bbab9f986c6d

3 years ago[SCCP] Create SCCP Solver
Sjoerd Meijer [Mon, 12 Apr 2021 18:10:15 +0000 (19:10 +0100)]
[SCCP] Create SCCP Solver

This refactors SCCP and creates a SCCPSolver interface and class so that it can
be used by other passes and transformations. We will use this in D93838, which
adds a function specialisation pass.

This is based on an early version by Vinay Madhusudan.

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

3 years ago[llvm-symbolizer] remove unused variable
Nico Weber [Wed, 14 Apr 2021 13:24:45 +0000 (09:24 -0400)]
[llvm-symbolizer] remove unused variable

This should've been removed in D83530.

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

3 years agoCPUDispatch- allow out of line member definitions
Erich Keane [Tue, 13 Apr 2021 19:44:09 +0000 (12:44 -0700)]
CPUDispatch- allow out of line member definitions

ICC permits this, and after some extensive testing it looks like we can
support this with very little trouble.  We intentionally don't choose to
do this with attribute-target (despite it likely working as well!)
  because GCC does not support that, and introducing said
  incompatibility doesn't seem worth it.

3 years ago[InstSimplify] improve efficiency for detecting non-zero value
Sanjay Patel [Wed, 14 Apr 2021 13:04:15 +0000 (09:04 -0400)]
[InstSimplify] improve efficiency for detecting non-zero value

Stepping through callstacks in the example from D99759 reveals
this potential compile-time improvement.

The savings come from avoiding ValueTracking's computing known
bits if we have already dealt with special-case patterns.

Further improvements in this direction seem possible.

This makes a degenerate test based on PR49785 about 40x faster
(25 sec -> 0.6 sec), but it does not address the larger question
of how to limit computeKnownBitsFromAssume(). Ie, the original
test there is still infinite-time for all practical purposes.

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

3 years ago[ValueTracking] match negative-stepping non-zero recurrence
Sanjay Patel [Wed, 14 Apr 2021 12:48:47 +0000 (08:48 -0400)]
[ValueTracking] match negative-stepping non-zero recurrence

This is pulled out of D100408.

This avoids a regression that would be exposed by making the
calling code from InstSimplify more efficient.

3 years ago[OpenCL][Docs] Update OpenCL 3.0 implementation status
Sven van Haastregt [Wed, 14 Apr 2021 12:56:26 +0000 (13:56 +0100)]
[OpenCL][Docs] Update OpenCL 3.0 implementation status

Reviewed-By: Anastasia Stulova
3 years ago[OpenMP] Fix printing routine for OMP_TOOL_VERBOSE_INIT
Hansang Bae [Mon, 12 Apr 2021 18:26:14 +0000 (13:26 -0500)]
[OpenMP] Fix printing routine for OMP_TOOL_VERBOSE_INIT

Also fixed typo in the verbose message.

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

3 years ago[AMDGPU] Mark scavenged SGPR as used
Sebastian Neubauer [Wed, 14 Apr 2021 12:55:01 +0000 (14:55 +0200)]
[AMDGPU] Mark scavenged SGPR as used

Otherwise it reuses the same register for storing the stack slot
offset if the stack slot offset is big.

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

3 years ago[ValueTracking] reduce code duplication; NFC
Sanjay Patel [Wed, 14 Apr 2021 12:30:42 +0000 (08:30 -0400)]
[ValueTracking] reduce code duplication; NFC

The start value can't be null for something to be a non-zero
recurrence, so hoist that common check out of the switch.

Subsequent checks may be incomplete or over-specified as noted in:
D100408

3 years ago[Test] Account for possibility to free memory in loop load PRE test
Max Kazantsev [Wed, 14 Apr 2021 12:14:54 +0000 (19:14 +0700)]
[Test] Account for possibility to free memory in loop load PRE test

3 years ago[AIX] Allow safe for 32bit P8 VSX pattern matching
Zarko Todorovski [Wed, 14 Apr 2021 11:25:07 +0000 (07:25 -0400)]
[AIX] Allow safe for 32bit P8 VSX pattern matching

Pull some of the safe for 32bit pattern matching for Pwr8 and above.

Reviewed By: nemanjai

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

3 years ago[lit] Remove unnecessary testcases from lit-quoting.txt that fail on macOS
Martin Storsjö [Wed, 14 Apr 2021 11:59:37 +0000 (14:59 +0300)]
[lit] Remove unnecessary testcases from lit-quoting.txt that fail on macOS

These were added in 37935405efbebc4bd9f1ffac9152571c6a8469dc,
but they fail on macOS (and on Windows with MSYS based tools, before
relanding D98859). Remove the tests that exercise "not not echo", as
the primary thing to test is the plain echo patterns above.

3 years ago[ValueTracking] add unit test for isKnownNonZero(); NFC
Sanjay Patel [Tue, 13 Apr 2021 18:46:21 +0000 (14:46 -0400)]
[ValueTracking] add unit test for isKnownNonZero(); NFC

We call various value tracking APIs from within -instsimplify,
so I don't think this is visible in a larger test.

3 years ago[clang] [AArch64] Fix Windows va_arg handling for larger structs
Martin Storsjö [Sun, 11 Apr 2021 09:38:40 +0000 (12:38 +0300)]
[clang] [AArch64] Fix Windows va_arg handling for larger structs

Aggregate types over 16 bytes are passed by reference.

Contrary to the x86_64 ABI, smaller structs with an odd (non power
of two) are padded and passed in registers.

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

3 years ago[lldb][AArch64] Simplify MTE memory region test
David Spickett [Mon, 1 Mar 2021 10:55:49 +0000 (10:55 +0000)]
[lldb][AArch64] Simplify MTE memory region test

By checking for cpu and toolchain features ahead
of time we don't need the custom return codes.

Reviewed By: omjavaid

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

3 years agoSDAG: constant fold bf16 -> i16 casts
Tim Northover [Wed, 14 Apr 2021 10:04:36 +0000 (11:04 +0100)]
SDAG: constant fold bf16 -> i16 casts

This direction is particularly useful because i16 constants are much more
likely to be legal than bf16.

3 years ago[Passes] Enable the relative lookup table converter pass on aarch64
Martin Storsjö [Wed, 14 Apr 2021 09:59:29 +0000 (12:59 +0300)]
[Passes] Enable the relative lookup table converter pass on aarch64

After d5c5cf5ce8d921fc8c5e1b608c298a1ffa688d37, it should work fine
for aarch64 on COFF too. (It was disabled when the patch was
(re)applied in e96df3e531f506eea75da0f13d0f8aa9a267f975, pending
that fix.)

3 years ago[InstCombine] tmp alloca bypass: ensure that the replacement dominates all alloca...
Roman Lebedev [Wed, 14 Apr 2021 10:02:20 +0000 (13:02 +0300)]
[InstCombine] tmp alloca bypass: ensure that the replacement dominates all alloca uses

After 077bff39d46364035a5dcfa32fc69910ad0975d0,
isDereferenceableForAllocaSize() can recurse into selects,
which is causing a problem for the new test case,
reduced from https://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20210412/904154.html
because the replacement (the select) is defined after the first use
of an alloca, so we'd end up with a verifier error.

Now, this new check is too restrictive.
We likely can handle *some* cases, by trying to sink all uses of an alloca
to after the the def.

3 years ago[X86] Fold cmpeq/ne(trunc(x),0) --> cmpeq/ne(x,0)
Simon Pilgrim [Wed, 14 Apr 2021 09:54:18 +0000 (10:54 +0100)]
[X86] Fold cmpeq/ne(trunc(x),0) --> cmpeq/ne(x,0)

Relax the fold from rGbaadbe04bf75 to compare any op, not just logic ops, now that the movmsk regressions have been handled.

3 years ago[X86] Regenerate PR32284.ll test case prefixes. NFC.
Simon Pilgrim [Tue, 13 Apr 2021 17:54:00 +0000 (18:54 +0100)]
[X86] Regenerate PR32284.ll test case prefixes. NFC.

Use X64 for 64-bit targets and X86 for 32-bit targets

3 years ago[X86][SSE] combineSetCCMOVMSK - allow comparison with upper (known zero) bits in...
Simon Pilgrim [Tue, 13 Apr 2021 17:29:15 +0000 (18:29 +0100)]
[X86][SSE] combineSetCCMOVMSK - allow comparison with upper (known zero) bits in MOVMSK(SHUFFLE(X,u)) -> MOVMSK(X) fold

Extension to rG74f98391a7a4, we can also include any of the upper (known zero) bits in the comparison in the shuffle removal fold, just as long as we demand all the elements of the movmsk source vector.

3 years ago[PowerPC] Fix incorrect subreg typo from 0148bf53f0a0
Nemanja Ivanovic [Wed, 14 Apr 2021 10:00:17 +0000 (05:00 -0500)]
[PowerPC] Fix incorrect subreg typo from 0148bf53f0a0

3 years ago[lit] Always quote arguments containing '[' on windows
Martin Storsjö [Tue, 6 Apr 2021 10:33:14 +0000 (13:33 +0300)]
[lit] Always quote arguments containing '[' on windows

This avoids breaking clang-tidy/infrastructure/validate-check-names.cpp
if 'not' is evaluated as a lit internal tool (making TestRunner
invoke 'grep' directly in that test, instead of invoking 'not', which
then invokes 'grep').

The quoting of arguments is still brittle if the executable is an
MSYS based tool though, as MSYS based tools incorrectly unescape
backslashes in quoted arguments (contrary to regular win32 argument
parsing rules), see D99406 and
https://github.com/msys2/msys2-runtime/issues/36 for more examples
of the issues.

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

3 years ago[ARM] [COFF] Properly produce cross-section relative relocations
Martin Storsjö [Tue, 30 Mar 2021 09:28:47 +0000 (12:28 +0300)]
[ARM] [COFF] Properly produce cross-section relative relocations

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

3 years ago[AArch64] [COFF] Properly produce cross-section relative relocations
Martin Storsjö [Tue, 30 Mar 2021 09:28:33 +0000 (12:28 +0300)]
[AArch64] [COFF] Properly produce cross-section relative relocations

This fixes breakage on Windows/ARM64 after D94355.

Modelled after the corresponding code for X86; not entirely familiar
with those aspects of that layer otherwise.

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

3 years ago[lldb] Silence GCC warnings about control reaching the end of non-void functions...
Martin Storsjö [Wed, 14 Apr 2021 06:05:43 +0000 (09:05 +0300)]
[lldb] Silence GCC warnings about control reaching the end of non-void functions. NFC.

Also remove a superfluous semicolon after the braces for a switch
statement (that wasn't warned about).

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

3 years ago[i386] Modify the alignment of __m128/__m256/__m512 vector type according i386 abi.
Liu, Chen3 [Fri, 2 Apr 2021 00:45:26 +0000 (08:45 +0800)]
[i386] Modify the alignment of __m128/__m256/__m512 vector type according i386 abi.

According to i386 System V ABI:

1. when __m256 are required to be passed on the stack, the stack pointer must be aligned on a 0 mod 32 byte boundary at the time of the call.
2. when __m512 are required to be passed on the stack, the stack pointer must be aligned on a 0 mod 64 byte boundary at the time of the call.

The current method of clang passing __m512 parameter are as follow:

1. when target supports avx512, passing it with 64 byte alignment;
2. when target supports avx, passing it with 32 byte alignment;
3. Otherwise, passing it with 16 byte alignment.

Passing __m256 parameter are as follow:

1. when target supports avx or avx512, passing it with 32 byte alignment;
2. Otherwise, passing it with 16 byte alignment.

This pach will passing __m128/__m256/__m512 following i386 System V ABI and
apply it to Linux only since other System V OS (e.g Darwin, PS4 and FreeBSD) don't
want to spend any effort dealing with the ramifications of ABI breaks at present.

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

3 years ago[clang-tidy] Add exception flag to bugprone-unhandled-exception-at-new test.
Balázs Kéri [Wed, 14 Apr 2021 08:01:05 +0000 (10:01 +0200)]
[clang-tidy] Add exception flag to bugprone-unhandled-exception-at-new test.

3 years ago[NFC] Fix unused variable warning.
Bogdan Graur [Wed, 14 Apr 2021 07:35:25 +0000 (09:35 +0200)]
[NFC] Fix unused variable warning.

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

3 years ago[mlir] Change verification order to prevent null dereference
Tres Popp [Tue, 13 Apr 2021 15:31:41 +0000 (17:31 +0200)]
[mlir] Change verification order to prevent null dereference

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

3 years ago[gn build] Port 530456caf908
LLVM GN Syncbot [Wed, 14 Apr 2021 07:28:18 +0000 (07:28 +0000)]
[gn build] Port 530456caf908

3 years ago[GreedyRA ORE] Separate Folder Reloads and Zero Cost Folder Reloads
Serguei Katkov [Wed, 14 Apr 2021 06:30:58 +0000 (13:30 +0700)]
[GreedyRA ORE] Separate Folder Reloads and Zero Cost Folder Reloads

Patchpoint instructions have operands which is actually zero cost
(or the same as register) to use the value from the stack.
In terms of statistic it makes same to separate them.

Move from computation instructions related to stack spill/reload to
number of stack slot referenced.

Reviewers: reames, MatzeB, anemet, thegameg
Reviewed By: reames
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D100016

3 years ago[clang-tidy] Add new check 'bugprone-unhandled-exception-at-new'.
Balázs Kéri [Wed, 14 Apr 2021 06:47:08 +0000 (08:47 +0200)]
[clang-tidy] Add new check 'bugprone-unhandled-exception-at-new'.

Reviewed By: aaron.ballman

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

3 years ago[clang] Fix copy constructor of CompilerInvocation
Jan Svoboda [Tue, 30 Mar 2021 08:45:04 +0000 (10:45 +0200)]
[clang] Fix copy constructor of CompilerInvocation

The `CompilerInvocationBase` class factors out members of `CompilerInvocation` that need special handling (initialization or copy constructor), so that `CompilerInvocation` can be implemented as a simple value object.

Currently, the `AnalyzerOpts` member of `CompilerInvocation` violates that setup. This patch extracts the member to `CompilerInvocationBase` and handles it in the copy constructor the same way other it handles other members.

Reviewed By: dexonsmith

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

3 years ago[NFC] Fix unused warning.
Bogdan Graur [Wed, 14 Apr 2021 07:08:28 +0000 (09:08 +0200)]
[NFC] Fix unused warning.

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

3 years ago[LLD] Implement /guard:[no]ehcont
Pengfei Wang [Wed, 14 Apr 2021 06:21:52 +0000 (14:21 +0800)]
[LLD] Implement /guard:[no]ehcont

Reviewed By: rnk

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

3 years agoRevert "Title: [RISCV] Add missing part of instruction vmsge {u}. VX Review By: craig...
Harald van Dijk [Wed, 14 Apr 2021 07:04:37 +0000 (08:04 +0100)]
Revert "Title: [RISCV] Add missing part of instruction vmsge {u}. VX Review By: craig.topper  Differential Revision : https://reviews.llvm.org/D100115"

This reverts commit 4d9ccb18f50803a1aa9c0332dc72472bdfec8bc4.

3 years ago[gn build] Port cbc9c4ea90e1
LLVM GN Syncbot [Wed, 14 Apr 2021 06:32:13 +0000 (06:32 +0000)]
[gn build] Port cbc9c4ea90e1

3 years ago[clangd] Add support for inline parameter hints
Nathan Ridge [Mon, 22 Feb 2021 07:55:13 +0000 (02:55 -0500)]
[clangd] Add support for inline parameter hints

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

3 years ago[Live Intervals] Teach Greedy RA to recognize special case live-through
Serguei Katkov [Mon, 12 Apr 2021 08:12:28 +0000 (15:12 +0700)]
[Live Intervals] Teach Greedy RA to recognize special case live-through

Statepoint instruction has a deopt section which is actually live-through the call.
Currently this is handled by special post pass after RA - fixup-statepoint-caller-saved.

This change teaches Greedy RA that if segment of live interval is ended with statepoint
instruction and its reg is used in deopt bundle then this live interval interferes regmask of this statepoint
and as a result caller-saved register cannot be assigned to this live interval.

Reviewers: reames, dantrushin
Reviewed By: reames
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D100296

3 years ago[mlir][StandardToSPIRV] Add support for lowering math.powf to SPIR-V.
Hanhan Wang [Wed, 14 Apr 2021 05:36:41 +0000 (22:36 -0700)]
[mlir][StandardToSPIRV] Add support for lowering math.powf to SPIR-V.

Reviewed By: antiagainst

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

3 years ago[M68k] Put M68kInfo as the direct library dependency for AsmParser
Min-Yih Hsu [Wed, 14 Apr 2021 04:15:47 +0000 (21:15 -0700)]
[M68k] Put M68kInfo as the direct library dependency for AsmParser

M68kAsmParser uses `llvm::getTheM68kTarget` from M68kInfo, therefore we
should put M68kInfo as its direct dependency. Otherwise the build will
fail when building LLVM libraries as shared objects (building LLVM
libraries statically won't have this problem though).

3 years ago[Live Intervals] Factor-out unionBitMask. NFC.
Serguei Katkov [Wed, 14 Apr 2021 03:37:54 +0000 (10:37 +0700)]
[Live Intervals] Factor-out unionBitMask. NFC.

For further re-usage in other place.

3 years ago[lldb] Disable TestClangModulesUpdate.py because it's flaky
Jonas Devlieghere [Wed, 14 Apr 2021 03:36:02 +0000 (20:36 -0700)]
[lldb] Disable TestClangModulesUpdate.py because it's flaky

The test is failing intermittently on GreenDragon.

rdar://76540904

3 years ago[lldb] Build debugserver 2-way fat on AS
Jonas Devlieghere [Wed, 14 Apr 2021 02:04:06 +0000 (19:04 -0700)]
[lldb] Build debugserver 2-way fat on AS

When compiling for arm, build debugserver 2 way fat with an arm64 and
arm64e slice. You can only debug arm64e processes using an arm64e
debugserver.

3 years ago[X86][AMX] Refactor for PostRA ldtilecfg pass.
Wang, Pengfei [Wed, 14 Apr 2021 01:32:48 +0000 (09:32 +0800)]
[X86][AMX] Refactor for PostRA ldtilecfg pass.

This is a follow up of D99010. We didn't consider the live range of shape registers when hoist ldtilecfg. There maybe risks, e.g. we happen to insert it to an invalid range of some registers and get unexpected error.

This patch fixes this problem by storing the value to corresponding stack place of ldtilecfg after all its definition immediately.

This patch also fix a problem in previous code: If we don't have a ldtilecfg which dominates all AMX instructions, we cannot initialize shapes for other ldtilecfg.

There're still some optimization points left. E.g. eliminate unused mov instructions, break the def-use dependency before RA etc.

Reviewed By: LuoYuanke, xiangzhangllvm

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

3 years agoExpose parseXInDimensionList() to the `DialectAsmParser`
Mehdi Amini [Wed, 14 Apr 2021 01:25:07 +0000 (01:25 +0000)]
Expose parseXInDimensionList() to the `DialectAsmParser`

This allows custom types and attribute to parse a dimension list that
isn't necessarily terminated with `xtype`, for example something like:

#tf.shape<4x5>

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

3 years agofix whitespace type
Philip Reames [Wed, 14 Apr 2021 02:02:11 +0000 (19:02 -0700)]
fix whitespace type

3 years ago[lldb] Pretend host architecture is arm64 on AS
Jonas Devlieghere [Wed, 14 Apr 2021 01:56:05 +0000 (18:56 -0700)]
[lldb] Pretend host architecture is arm64 on AS

The arm64e architecture is a preview. On Apple Silicon, pretend the host
architecture is arm64.

3 years ago[RISCV] Implement COPY for Zvlsseg registers
ShihPo Hung [Mon, 12 Apr 2021 02:34:10 +0000 (19:34 -0700)]
[RISCV] Implement COPY for Zvlsseg registers

When copying Zvlsseg register tuples, we split the COPY to NF whole register moves
as below:

  $v10m2_v12m2 = COPY $v4m2_v6m2 # NF = 2
=>
  $v10m2 = PseudoVMV2R_V $v4m2
  $v12m2 = PseudoVMV2R_V $v6m2

This patch copies forwardCopyWillClobberTuple from AArch64 to check
register overlapping.

Reviewed By: frasercrmck

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

3 years ago[scudo] Make MTE inline asm compatible with GNU assembler
Roland McGrath [Tue, 13 Apr 2021 22:03:54 +0000 (15:03 -0700)]
[scudo] Make MTE inline asm compatible with GNU assembler

The GNU assembler can't parse `.arch_extension ...` before a `;`.
So instead uniformly use raw string syntax with separate lines
instead of `;` separators in the assembly code.

Reviewed By: pcc

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

3 years ago[libc++][docs] Add status docs for ranges.
Zoe Carver [Wed, 14 Apr 2021 00:56:55 +0000 (17:56 -0700)]
[libc++][docs] Add status docs for ranges.

The added documents have two tables: 1 containing links to issues and papers related to ranges. And the other contains most of the sections from the One Ranges Proposal, with their dependencies linked. This will allow us to assign work that can be done in parallel.

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

3 years ago[PowerPC] Use correct node to get a super register from a subreg
Nemanja Ivanovic [Wed, 14 Apr 2021 00:40:36 +0000 (19:40 -0500)]
[PowerPC] Use correct node to get a super register from a subreg

The VSX tablegen file has some rather eggregious uses of
COPY_TO_REGCLASS even in situations where it needs to use
SUBREG_TO_REG. While this produces correct code, it often doesn't
allow the register coalescer to coalesce copies and the resulting
code ends up being suboptimal. This patch just changes over
patterns that should use SUBREG_TO_REG.

3 years agoRevert "[GlobalOpt] Revert valgrind hacks"
Sterling Augustine [Wed, 14 Apr 2021 00:42:46 +0000 (17:42 -0700)]
Revert "[GlobalOpt] Revert valgrind hacks"

This reverts commit dbc16ed199dce2598f0e49943bf8354ef92a0ecc.

3 years ago[mlir] Fix return values of AMX tests
Matthias Springer [Tue, 13 Apr 2021 23:10:10 +0000 (08:10 +0900)]
[mlir] Fix return values of AMX tests

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

3 years ago[MLIR] PresburgerSet subtraction: add documentation and assertion saying we don't...
Arjun P [Mon, 12 Apr 2021 15:08:27 +0000 (20:38 +0530)]
[MLIR] PresburgerSet subtraction: add documentation and assertion saying we don't support divisions yet

Reviewed By: ftynse

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

3 years ago[CSSPGO] Fix a test issue due to portablity of std::hash
Hongtao Yu [Tue, 13 Apr 2021 00:11:38 +0000 (17:11 -0700)]
[CSSPGO] Fix a test issue due to portablity of std::hash

As a follow-up to D99815, this patch enables the test by using a DAG order instead of a sequential order to mitigate the platform portability issue due to `std:: _Hash_bytes`.

Reviewed By: wenlei, jsji

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

3 years agoFix resolution-err.ll
Stella Stamenova [Tue, 13 Apr 2021 23:11:58 +0000 (16:11 -0700)]
Fix resolution-err.ll

chmod tries to be very helpful on some platforms and prevent naive mistakes, by warning the user. This results in the following error during the test:

```chmod: ...resolution-err.ll.tmp.resolution.txt: new permissions are r--rw-rw-, not r--r--r--```

To fix the test, call chmod with u.

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

3 years ago[Sema] Move 'char-expression-as-unsigned < 0' into a separate diagnostic
Anton Bikineev [Fri, 2 Apr 2021 18:14:44 +0000 (20:14 +0200)]
[Sema] Move 'char-expression-as-unsigned < 0' into a separate diagnostic

This change splits '-Wtautological-unsigned-zero-compare' by reporting
char-expressions-interpreted-as-unsigned under a separate diagnostic
'-Wtautological-unsigned-char-zero-compare'. This is beneficial for
projects that want to enable '-Wtautological-unsigned-zero-compare' but at
the same time want to keep code portable for platforms with char being
signed or unsigned, such as Chromium.

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

3 years ago[flang] More precise enforcement of runtime constraint
peter klausler [Tue, 13 Apr 2021 00:05:05 +0000 (17:05 -0700)]
[flang] More precise enforcement of runtime constraint

An OPEN statement that affects an already connected unit
without changing its external file is required to have
STATUS="OLD" or default STATUS=.  The code was eliciting
spurious runtime errors in situations where an OPEN statement
pertained to an existing unit number but did not need to have
STATUS="OLD'.

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

3 years agoTitle: [RISCV] Add missing part of instruction vmsge {u}. VX Review By: craig.topper...
root [Tue, 13 Apr 2021 22:06:07 +0000 (06:06 +0800)]
Title: [RISCV] Add missing part of instruction vmsge {u}. VX Review By: craig.topper  Differential Revision : https://reviews.llvm.org/D100115

3 years agoTitle: [RISCV] Add missing part of instruction vmsge {u}. VX Review By: craig.topper...
root [Tue, 13 Apr 2021 22:02:07 +0000 (06:02 +0800)]
Title: [RISCV] Add missing part of instruction vmsge {u}. VX Review By: craig.topper  Differential Revision : https://reviews.llvm.org/D100115

3 years agoTitle: [RISCV] Add missing part of instruction vmsge {u}. VX Review By: craig.topper...
root [Tue, 13 Apr 2021 21:52:16 +0000 (05:52 +0800)]
Title: [RISCV] Add missing part of instruction vmsge {u}. VX Review By: craig.topper  Differential Revision : https://reviews.llvm.org/D100115

3 years ago[mlir] Prevent operations with users from being hoisted
Sumesh Udayakumaran [Tue, 13 Apr 2021 19:11:25 +0000 (12:11 -0700)]
[mlir] Prevent operations with users from being hoisted

This patch collects operations that have users in a for loop and uses
them  when loop invariant operations are detected and hoisted.

Reviewed By: bondhugula, vinayaka-polymage

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

3 years ago[TableGen] Resolve concrete but not complete field access initializers
Daniel Sanders [Tue, 13 Apr 2021 18:14:30 +0000 (11:14 -0700)]
[TableGen] Resolve concrete but not complete field access initializers

This fixes the resolution of Rec10.Zero in ListSlices.td.

As part of this, correct the definition of complete for ListInit such that
it's complete iff all the elements in the list are complete rather than
always being complete regardless of the elements. This is the reason
Rec10.TwoFive from ListSlices.td previously resolved despite being
incomplete like Rec10.Zero was

Depends on D100247

Reviewed By: Paul-C-Anagnostopoulos

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

3 years ago[Driver] Make the findVCToolChainViaEnvironment case-insensitive
Artur Gainullin [Tue, 13 Apr 2021 04:39:57 +0000 (21:39 -0700)]
[Driver] Make the findVCToolChainViaEnvironment case-insensitive

PATH usage on Windows is case-insensitive. There could be situations
when toolchain path can't be obtained from PATH because of
case-sensitivity of the findVCToolChainViaEnvironment.

Reviewed By: rnk

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

3 years ago[mlir][tosa] Add conv2d lowering to linalg.conv2d operator for FP
Rob Suderman [Wed, 7 Apr 2021 01:31:51 +0000 (18:31 -0700)]
[mlir][tosa] Add conv2d lowering to linalg.conv2d operator for FP

Handles lowering conv2d to linalg's convolution operator. This implementation
only supports floating point values but handles all strides, dilations, and
padding values.

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

3 years ago[AArch64][SVE] Always use overloaded methods instead of preprocessor macro.
Sander de Smalen [Tue, 13 Apr 2021 15:04:02 +0000 (16:04 +0100)]
[AArch64][SVE] Always use overloaded methods instead of preprocessor macro.

This fixes a subtle issue where:

  svprf(pg, ptr, SV_ALL /*is sv_pattern instead of sv_prfop*/)

would be quietly accepted. With this change, the function declaration
guards that the third parameter is a `enum sv_prfop`. Previously `svprf`
would map directly to `__builtin_sve_svprfb`, which accepts the enum
operand as a signed integer and only checks that the incoming range is
valid, meaning that SV_ALL would be discarded as being outside the valid
immediate range, but would have allowed SV_VL1 without issuing a warning
(C) or error (C++).

Reviewed By: c-rhodes

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

3 years agoRemove warning "suggest braces" for aggregate initialization of an empty class with...
Hana Dusíková [Tue, 13 Apr 2021 19:45:09 +0000 (15:45 -0400)]
Remove warning "suggest braces" for aggregate initialization of an empty class with an aggregate base class.

I recently ran into issues with aggregates and inheritance, I'm using
it for creating a type-safe library where most of the types are build
over "tagged" std::array. After bit of cleaning and enabling -Wall
-Wextra -pedantic I noticed clang only in my pipeline gives me warning.
After a bit of focusing on it I found it's not helpful, and contemplate
disabling the warning all together. After a discussion with other
library authors I found it's bothering more people and decided to fix
it.

Removes this warning:

template<typename T, int N> struct StdArray {
    T contents[N];
  };

template<typename T, int N> struct AggregateAndEmpty : StdArray<T,N> { };

AggregateAndEmpty<int, 3> p = {1, 2, 3}; // <-- warning here about omitted braces

3 years ago[mlir][spirv] Only attach struct offset for required storage classes
Lei Zhang [Tue, 13 Apr 2021 19:18:32 +0000 (15:18 -0400)]
[mlir][spirv] Only attach struct offset for required storage classes

Per the SPIR-V spec "2.16.2. Validation Rules for Shader Capabilities":

  Composite objects in the StorageBuffer, PhysicalStorageBuffer,
  Uniform, and PushConstant Storage Classes must be explicitly
  laid out.

For other cases we don't need to attach the struct offsets.

Reviewed By: hanchung

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

3 years ago[AsmParser][SystemZ][z/OS] Add support to AsmLexer to accept HLASM style integers
Anirudh Prasad [Tue, 13 Apr 2021 19:25:00 +0000 (15:25 -0400)]
[AsmParser][SystemZ][z/OS] Add support to AsmLexer to accept HLASM style integers

- Add support for HLASM style integers. These are the decimal integers [0-9].
- HLASM does not support the additional prefixed integers like, `0b`, `0x`, octal integers and Masm style integers.
- To achieve this, a field `LexHLASMStyleIntegers` (similar to the `LexMasmStyleIntegers` field) is introduced in `MCAsmLexer.h` as well as a corresponding setter.

Note: This field could also go into MCAsmInfo.h. I used the previous precedent set by the `LexMasmIntegers` field.

Depends on https://reviews.llvm.org/D99286

Reviewed By: epastor

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

3 years agoCorrect the tablegen for checking mutually exclusive stmt attrs
Aaron Ballman [Tue, 13 Apr 2021 19:18:13 +0000 (15:18 -0400)]
Correct the tablegen for checking mutually exclusive stmt attrs

The previous implementation was insufficient for checking statement
attribute mutual exclusion because attributed statements do not collect
their attributes one-at-a-time in the same way that declarations do. So
the design that was attempting to check for mutual exclusion as each
attribute was processed would not ever catch a mutual exclusion in a
statement. This was missed due to insufficient test coverage, which has
now been added for the [[likely]] and [[unlikely]] attributes.

The new approach is to check all of attributes that are to be applied
to the attributed statement in a group. This required generating
another DiagnoseMutualExclusions() function into AttrParsedAttrImpl.inc.

3 years ago[RISCV] Add a generic PatGprImm class and use it to simplify patterns in RISCVInstrIn...
Craig Topper [Tue, 13 Apr 2021 18:57:10 +0000 (11:57 -0700)]
[RISCV] Add a generic PatGprImm class and use it to simplify patterns in RISCVInstrInfoB.td. NFC

3 years ago[RISCV] Make use of PatGprGpr and PatGpr in RISCVInstrInfoB.td. NFC
Craig Topper [Tue, 13 Apr 2021 18:29:34 +0000 (11:29 -0700)]
[RISCV] Make use of PatGprGpr and PatGpr in RISCVInstrInfoB.td. NFC

3 years agoShip `llvm-cxxfilt` in the toolchain.
Dan Liew [Tue, 13 Apr 2021 18:53:39 +0000 (11:53 -0700)]
Ship `llvm-cxxfilt` in the toolchain.

Originally done for rdar://problem/57155465.

rdar://76602859

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

3 years ago[gn build] Port 8ca366935b05
LLVM GN Syncbot [Tue, 13 Apr 2021 18:49:06 +0000 (18:49 +0000)]
[gn build] Port 8ca366935b05

3 years ago[gn build] Port 46b8ea2fff90
LLVM GN Syncbot [Tue, 13 Apr 2021 18:49:05 +0000 (18:49 +0000)]
[gn build] Port 46b8ea2fff90

3 years ago[lld-macho] rm old test directory for segments.s
Jez Ng [Tue, 13 Apr 2021 18:45:26 +0000 (14:45 -0400)]
[lld-macho] rm old test directory for segments.s

This should unbreak incremental builds after https://github.com/llvm/llvm-project/commit/8ca366935b055283b571ba0893f53a7a18ac59bb

3 years ago[mlir] Convert async dialect passes from function passes to op agnostic passes
Eugene Zhulenev [Tue, 13 Apr 2021 18:40:04 +0000 (11:40 -0700)]
[mlir] Convert async dialect passes from function passes to op agnostic passes

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

3 years ago[clang-tidy] Add check for implicit widening of multiplication result
Roman Lebedev [Tue, 13 Apr 2021 18:21:19 +0000 (21:21 +0300)]
[clang-tidy] Add check for implicit widening of multiplication result

Overflows are never fun.
In most cases (in most of the code), they are rare,
because usually you e.g. don't have as many elements.

However, it's exceptionally easy to fall into this pitfail
in code that deals with images, because, assuming 4-channel 32-bit FP data,
you need *just* ~269 megapixel image to case an overflow
when computing at least the total byte count.

In [[ https://github.com/darktable-org/darktable | darktable ]], there is a *long*, painful history of dealing with such bugs:
* https://github.com/darktable-org/darktable/pull/7740
* https://github.com/darktable-org/darktable/pull/7419
* https://github.com/darktable-org/darktable/commit/eea1989f2c9fa76710db07baaec4c19c1e40e81c
* https://github.com/darktable-org/darktable/commit/70626dd95bf0fab36f2d011dab075e3ebbf7aa28
* https://github.com/darktable-org/darktable/pull/670
* https://github.com/darktable-org/darktable/commit/38c69fb1b2bc90057c569242cb9945a10be0b583

and yet they clearly keep resurfacing still.

It would be immensely helpful to have a diagnostic for those patterns,
which is what this change proposes.

Currently, i only diagnose the most obvious case, where multiplication
is directly widened with no other expressions inbetween,
(i.e. `long r = (int)a * (int)b` but not even e.g. `long r = ((int)a * (int)b)`)
however that might be worth relaxing later.

Reviewed By: aaron.ballman

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

3 years ago[libc][Obvious] Fix nextafter* implementation.
Siva Chandra Reddy [Tue, 13 Apr 2021 18:35:41 +0000 (11:35 -0700)]
[libc][Obvious] Fix nextafter* implementation.

It broke when FPBits was converted to a union.

3 years agoBPF: remove default .extern data section
Yonghong Song [Tue, 13 Apr 2021 16:15:21 +0000 (09:15 -0700)]
BPF: remove default .extern data section

Currently, for any extern variable, if it doesn't have
section attribution, it will be put into a default ".extern"
btf DataSec. The initial design is to put every extern
variable in a DataSec so libbpf can use it.

But later on, libbpf actually requires extern variables
to put into special sections, e.g., ".kconfig", ".ksyms", etc.
so they can be used properly based on section name.

Andrii mentioned since ".extern" variables are
not actually used, it makes sense to remove it from
the compiler so libbpf does not need to deal with it,
esp. for static linking. The BTF for these extern variables
is still generated.

With this patch, I tested kernel selftests/bpf and all tests
passed. Indeed, removing ".extern" DataSec seems having no
impact.

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

3 years ago[libFuzzer] Fix fuzzer-oom.test.
Matt Morehouse [Tue, 13 Apr 2021 18:12:05 +0000 (11:12 -0700)]
[libFuzzer] Fix fuzzer-oom.test.

SinkPtr was not correctly marked as volatile, causing the malloc to get
optimized out.  This was causing 20-minute timeouts for the test and no
OOM.

3 years ago[lli] Honor the --entry-function flag in orc and orc-lazy modes.
Lang Hames [Tue, 13 Apr 2021 18:26:57 +0000 (11:26 -0700)]
[lli] Honor the --entry-function flag in orc and orc-lazy modes.

Fixes https://llvm.org/PR49906.

3 years ago[SCEV] Don't walk uses of phis without SCEV expression when forgetting
Nikita Popov [Sat, 10 Apr 2021 21:50:23 +0000 (23:50 +0200)]
[SCEV] Don't walk uses of phis without SCEV expression when forgetting

I've run into some cases where a large fraction of compile-time is
spent invalidating SCEV. One of the causes is forgetLoop(), which
walks all values that are def-use reachable from the loop header
phis. When invalidating a topmost loop, that might be close to all
values in a function. Additionally, it's fairly common for there to
not actually be anything to invalidate, but we'll still be performing
this walk again and again.

My first thought was that we don't need to continue walking the uses
if the current value doesn't have a SCEV expression. However, this
isn't quite right, because SCEV construction can skip over values
(e.g. for a chain of adds, we might only create a SCEV expression
for the final value).

What this patch does instead is to only walk the (full) def-use chain
of loop phis that have a SCEV expression. If there's no expression
for a phi, then we also don't have any dependent expressions to
invalidate.

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

3 years agoString Literal and Wide String Literal Encoding from the Preprocessor
ThePhD [Tue, 13 Apr 2021 18:15:45 +0000 (14:15 -0400)]
String Literal and Wide String Literal Encoding from the Preprocessor

Adds the __clang_literal_encoding__ and __clang_wide_literal_encoding__
predefined macros to expose the encoding used for string literals to
the preprocessor.

3 years ago[RISCV] Rename RISCVISD::GREVI(W)/GORCI(W) to RISCVISD::GREV(W)/GORC(W). Don't requir...
Craig Topper [Tue, 13 Apr 2021 14:54:24 +0000 (07:54 -0700)]
[RISCV] Rename RISCVISD::GREVI(W)/GORCI(W) to RISCVISD::GREV(W)/GORC(W). Don't require second operand to be a constant.

Prep work for adding intrinsics for these instructions in the
future.

3 years ago[AArch64][GlobalISel] Mark G_CTPOP as legal for v16s8 and v8s8
Jessica Paquette [Mon, 12 Apr 2021 21:49:20 +0000 (14:49 -0700)]
[AArch64][GlobalISel] Mark G_CTPOP as legal for v16s8 and v8s8

G_CTPOP can be directly selected to CNT in these cases.

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

3 years ago[flang][OpenMP] Modify semantic check for nesting of `ordered` regions to include...
Arnamoy Bhattacharyya [Tue, 13 Apr 2021 17:56:43 +0000 (13:56 -0400)]
[flang][OpenMP] Modify semantic check for nesting of `ordered` regions to include `close` nesting check.

Reviewed By: kiranchandramohan

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

3 years ago[MemorySSA] Add test for PR49859.
Alina Sbirlea [Tue, 13 Apr 2021 00:53:29 +0000 (17:53 -0700)]
[MemorySSA] Add test for PR49859.

3 years ago[flang] Handle instantiation of procedure pointer components
Peter Steinfeld [Mon, 12 Apr 2021 20:11:42 +0000 (13:11 -0700)]
[flang] Handle instantiation of procedure pointer components

We were not instantiating procedure pointer components.  If the instantiation
contained errors, we were not reporting them.  This resulted in internal errors
in later processing.

I fixed this by adding code in .../lib/Semantics/type.cpp in
InstantiateComponent() to handle a component with ProcEntityDetails.  I also
added several tests for various good and bad instantiations of procedure
pointer components.

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

3 years ago[libFuzzer] Fix MSan false positives with custom mutators.
Matt Morehouse [Tue, 13 Apr 2021 16:25:12 +0000 (09:25 -0700)]
[libFuzzer] Fix MSan false positives with custom mutators.

We need to unpoison parameters before calling into MSan-instrumented
user-defined mutators.

Addresses https://github.com/google/oss-fuzz/issues/4605.

Reviewed By: metzman

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

3 years ago[debugserver] Use class member initialization for RNBContext
Jonas Devlieghere [Tue, 13 Apr 2021 17:23:04 +0000 (10:23 -0700)]
[debugserver] Use class member initialization for RNBContext

Address Shafik Yaghmour's post commit code review feedback.

3 years agoRemove a -O2 usage from a CSE specific test file
Philip Reames [Tue, 13 Apr 2021 17:22:30 +0000 (10:22 -0700)]
Remove a -O2 usage from a CSE specific test file

Given this is checking attributes, there are a bunch of valid ways that O2 can infer attributes that CSE will not.