platform/upstream/llvm.git
3 years agoMark 2534 as Complete.
zoecarver [Fri, 19 Feb 2021 05:28:49 +0000 (21:28 -0800)]
Mark 2534 as Complete.

c90dee1 fixed LWG 1203 which supresses LWG 2534 as well.

Refs D62889.

Reviewed By: ldionne, #libc

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

3 years ago[HIP] Support device sanitizer
Yaxun (Sam) Liu [Tue, 16 Feb 2021 18:43:03 +0000 (13:43 -0500)]
[HIP] Support device sanitizer

Add option -fgpu-sanitize to enable sanitizer for AMDGPU target.

Since it is experimental, it is off by default.

Reviewed by: Artem Belevich

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

3 years ago[ORC] Print CPU feature string in JITTargetMachineBuilder debugging output.
Lang Hames [Fri, 19 Feb 2021 03:36:15 +0000 (14:36 +1100)]
[ORC] Print CPU feature string in JITTargetMachineBuilder debugging output.

3 years ago[RISCV] Remove redundant test cases for index segment store (8/8).
Hsiangkai Wang [Fri, 19 Feb 2021 03:10:01 +0000 (11:10 +0800)]
[RISCV] Remove redundant test cases for index segment store (8/8).

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

3 years ago[RISCV] Remove redundant test cases for index segment store (7/8).
Hsiangkai Wang [Fri, 19 Feb 2021 03:09:55 +0000 (11:09 +0800)]
[RISCV] Remove redundant test cases for index segment store (7/8).

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

3 years ago[RISCV] Remove redundant test cases for index segment store (6/8).
Hsiangkai Wang [Fri, 19 Feb 2021 03:09:49 +0000 (11:09 +0800)]
[RISCV] Remove redundant test cases for index segment store (6/8).

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

3 years ago[RISCV] Remove redundant test cases for index segment store (5/8).
Hsiangkai Wang [Fri, 19 Feb 2021 03:08:01 +0000 (11:08 +0800)]
[RISCV] Remove redundant test cases for index segment store (5/8).

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

3 years ago[RISCV] Remove redundant test cases for index segment load (4/8).
Hsiangkai Wang [Fri, 19 Feb 2021 03:07:52 +0000 (11:07 +0800)]
[RISCV] Remove redundant test cases for index segment load (4/8).

3 years ago[RISCV] Remove redundant test cases for index segment load (3/8).
Hsiangkai Wang [Fri, 19 Feb 2021 03:07:42 +0000 (11:07 +0800)]
[RISCV] Remove redundant test cases for index segment load (3/8).

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

3 years ago[RISCV] Remove redundant test cases for index segment load (2/8).
Hsiangkai Wang [Fri, 19 Feb 2021 03:07:36 +0000 (11:07 +0800)]
[RISCV] Remove redundant test cases for index segment load (2/8).

3 years ago[RISCV] Remove redundant test cases for index segment load (1/8).
Hsiangkai Wang [Fri, 19 Feb 2021 03:07:25 +0000 (11:07 +0800)]
[RISCV] Remove redundant test cases for index segment load (1/8).

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

3 years ago[Coroutine] Relax CoroElide musttail check
Xun Li [Fri, 19 Feb 2021 03:36:11 +0000 (19:36 -0800)]
[Coroutine] Relax CoroElide musttail check

As discussed in D94834, we don't really need to do complicated analysis. It's safe to just drop the tail call attribute.

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

3 years ago[RISCV] Split zvlsseg searchable table into 4 separate tables. Index by properties...
Craig Topper [Fri, 19 Feb 2021 03:00:48 +0000 (19:00 -0800)]
[RISCV] Split zvlsseg searchable table into 4 separate tables. Index by properties rather than intrinsic ID.

Intrinsic ID is a 32-bit value which made each row of the table 4
byte aligned. The remaining fields used 5 bytes. This meant 3 bytes
of padding per row.

This patch breaks the table into 4 separate tables and indexes them
by properties we know about the intrinsic. NF, masked,
strided, ordered, etc. The indexed load/store tables have no
padding in their rows now.

All together this reduces the size of llc binary by ~28K.

I'm considering adding similar tables for isel of non-segment
load/store as well to cut down the size of the isel table and
probably improve our isel performance. Those tables would need to
indexed from intrinsics, IR loads/stores, gathers/scatters, and
RISCVISD opcodes. So having a table that can be indexed without using
intrinsic ID is more flexible.

Reviewed By: HsiangKai

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

3 years ago[RISCV] Enable PrimaryKeyEarlyOut on RISCVVPseudosTable.
Craig Topper [Fri, 19 Feb 2021 02:50:58 +0000 (18:50 -0800)]
[RISCV] Enable PrimaryKeyEarlyOut on RISCVVPseudosTable.

This table is queried in RISCVMCInstLower without knowing
whether the instruction is a vector pseudo. Due to the way the
binary search works, we have to do log2(tablesize) checks just
to determine a non-vector instruction isn't in the table.

Conveniently, all the vector pseudos are pretty tightly
packed within the internal instruction enum. By enabling the
PrimaryKeyEarlyOut, tablegen will emit a check against the
beginning and end of the table before doing the binary search.
This gives a quick early out on the search for the majority
of non-vector instructions.

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

3 years agoReset the EntryValue location flag in finalizeEntryValue.
Adrian Prantl [Fri, 19 Feb 2021 02:35:29 +0000 (18:35 -0800)]
Reset the EntryValue location flag in finalizeEntryValue.

This fixes an assertion error when entry values are combined with
DW_OP_LLVM_fragment.

3 years agoPR49239: Don't take shortcuts when constant evaluating in 'warn on UB'
Richard Smith [Fri, 19 Feb 2021 02:26:36 +0000 (18:26 -0800)]
PR49239: Don't take shortcuts when constant evaluating in 'warn on UB'
mode.

We use that mode when evaluating ICEs in C, and those shortcuts could
result in ICE evaluation producing the wrong answer, specifically if we
evaluate a statement-expression as part of evaluating the ICE.

3 years agoRevert "Modify TypePrinter to differentiate between anonymous struct and unnamed...
Shafik Yaghmour [Fri, 19 Feb 2021 02:17:08 +0000 (18:17 -0800)]
Revert "Modify TypePrinter to differentiate between anonymous struct and unnamed struct"

I missed clangd test suite and may need some time to get those working, so reverting for now.

This reverts commit ecb90b55454ee94733481247486729a504aa43a1.

3 years agoRevert "Fix for Modify TypePrinter to differentiate between anonymous struct and...
Shafik Yaghmour [Fri, 19 Feb 2021 02:16:12 +0000 (18:16 -0800)]
Revert "Fix for Modify TypePrinter to differentiate between anonymous struct and unnamed struct"

I missed clangd test suite and may need some time to get those working, so reverting for now.

This reverts commit 1e0819395657a9306f609849dcd3be9d7fb0c894.

3 years agoReland "[MLIR] Make structured op tests permutation invariant"
Geoffrey Martin-Noble [Fri, 19 Feb 2021 01:12:12 +0000 (17:12 -0800)]
Reland "[MLIR] Make structured op tests permutation invariant"

Relands with fix swapping DEPENDS for LINK_LIBS.

This reverts commit cd8cc00b9e2b2b2b10270f7485eb47759bc54cc1.

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

3 years ago[OpenMP][NVPTX] Add the support for CUDA 11.2 and CUDA 11.1
Shilei Tian [Fri, 19 Feb 2021 02:04:32 +0000 (21:04 -0500)]
[OpenMP][NVPTX] Add the support for CUDA 11.2 and CUDA 11.1

CUDA 11.2 and CUDA 11.1 are all available now.

Reviewed By: jdoerfert

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

3 years agoFix for Modify TypePrinter to differentiate between anonymous struct and unnamed...
Shafik Yaghmour [Fri, 19 Feb 2021 01:56:59 +0000 (17:56 -0800)]
Fix for Modify TypePrinter to differentiate between anonymous struct and unnamed struct

One of the lldb tests needed additional fixes.

3 years agoFix MLIR Toy tutorial JIT example and add a test to cover it
Mehdi Amini [Fri, 19 Feb 2021 01:53:14 +0000 (01:53 +0000)]
Fix MLIR Toy tutorial JIT example and add a test to cover it

3 years ago[libcxx] adds concept `std::uniform_random_bit_generator`
Christopher Di Bella [Wed, 17 Feb 2021 02:52:17 +0000 (02:52 +0000)]
[libcxx] adds concept `std::uniform_random_bit_generator`

Implements parts of:
    - P0898R3 Standard Library Concepts
    - P1754 Rename concepts to standard_case for C++20, while we still can

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

3 years agoAMDGPU/ELF: Sort MACHs by value and add missing reserved MACHs
Konstantin Zhuravlyov [Fri, 19 Feb 2021 01:44:54 +0000 (20:44 -0500)]
AMDGPU/ELF: Sort MACHs by value and add missing reserved MACHs

  - Sort MACHs by its value
  - Add missing reserved MACHs
    - EF_AMDGPU_MACH_AMDGCN_RESERVED_0X3D
    - EF_AMDGPU_MACH_AMDGCN_RESERVED_0X3E

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

3 years agoModify TypePrinter to differentiate between anonymous struct and unnamed struct
Shafik Yaghmour [Fri, 19 Feb 2021 01:05:46 +0000 (17:05 -0800)]
Modify TypePrinter to differentiate between anonymous struct and unnamed struct

Currently TypePrinter lumps anonymous classes and unnamed classes in one group "anonymous" this is not correct and can be confusing in some contexts.

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

3 years ago[android] Fix testing adb call
Vitaly Buka [Fri, 19 Feb 2021 01:22:32 +0000 (17:22 -0800)]
[android] Fix testing adb call

Looks like some debug leftover which force another retry.

3 years agoSwitch to using LEB encoding for key and data lengths in on-disk hash
Richard Smith [Fri, 19 Feb 2021 00:24:01 +0000 (16:24 -0800)]
Switch to using LEB encoding for key and data lengths in on-disk hash
tables.

This gives a modest AST file size reduction, while also fixing crashes
in cases where the key or data length doesn't fit into 16 bits.
Unfortunately, such situations tend to require huge test cases (such as
more than 16K modules or an overload set with 16K entries), and I
couldn't get a testcase to finish in a reasonable amount of time, so no
test is included for that bugfix.

No functionality change intended (other than the bugfix).

3 years agoDetect diagnostic groups that are defined in multiple 'def's.
Richard Smith [Wed, 17 Feb 2021 19:22:52 +0000 (11:22 -0800)]
Detect diagnostic groups that are defined in multiple 'def's.

Remove the three such groups that we've accumulated. These were causing
duplicated output to appear in generated the diagnostic reference.

3 years ago[SampleFDO] Stop repeated indirect call promotion for the same target.
Wei Mi [Sat, 13 Feb 2021 03:46:28 +0000 (19:46 -0800)]
[SampleFDO] Stop repeated indirect call promotion for the same target.

Found a problem in indirect call promotion in sample loader pass. Currently
if an indirect call is promoted for a target, and if the parent function is
inlined into some other function, the indirect call can be promoted for the
same target again. That is redundent which can harm performance and can cause
excessive compile time in some extreme case.

The patch fixes the issue. If a target is promoted for an indirect call, the
patch will write ICP metadata with the target call count being set to 0.
In the later ICP in sample profile loader, if it sees a target has 0 count
for an indirect call, it knows the target has been promoted and won't do
indirect call promotion for the indirect call.

The fix brings 0.1~0.2% performance on our search benchmark.

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

3 years agoAdd DivOp to the Shape dialect
Jing Pu [Fri, 19 Feb 2021 00:58:47 +0000 (16:58 -0800)]
Add DivOp to the Shape dialect

Reviewed By: jpienaar

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

3 years agoRevert "[MLIR] Make structured op tests permutation invariant"
Mehdi Amini [Fri, 19 Feb 2021 00:15:51 +0000 (00:15 +0000)]
Revert "[MLIR] Make structured op tests permutation invariant"

This reverts commit b9ff67099ad6da931976e66f1510c5af2558a86e.
The build is broken with -DBUILD_SHARED_LIBS=ON

3 years ago[lldb] Check that files exists before handing them off to FileCollector
Jonas Devlieghere [Fri, 19 Feb 2021 00:13:28 +0000 (16:13 -0800)]
[lldb] Check that files exists before handing them off to FileCollector

The FileCollector asserts that paths passed to addDirectory are indeed
directories. For that to work, the file needs to actually exist. In the
downstream Swift fork we have tests that remove files during testing,
which resulted in this assertion getting triggered.

3 years agoMIR: Fix parser crash on syntax error on first character
Matt Arsenault [Thu, 18 Feb 2021 23:46:39 +0000 (18:46 -0500)]
MIR: Fix parser crash on syntax error on first character

This was calling the diagnostic printer before the context member was
initialized.

3 years ago[Polly] Update IslAstInfo::getNodePayload to use isl C++ interface. NFC.
Michael Kruse [Thu, 18 Feb 2021 23:08:41 +0000 (17:08 -0600)]
[Polly] Update IslAstInfo::getNodePayload to use isl C++ interface. NFC.

3 years ago[dfsan] Instrument origin variable and function definitions
Jianzhou Zhao [Thu, 18 Feb 2021 18:29:21 +0000 (18:29 +0000)]
[dfsan] Instrument origin variable and function definitions

This is a part of https://reviews.llvm.org/D95835.

Reviewed-by: morehouse, gbalats
Differential Revision: https://reviews.llvm.org/D96977

3 years ago[llvm][IR] Do not place constants with static relocations in a mergeable section
Leonard Chan [Wed, 10 Feb 2021 17:59:36 +0000 (09:59 -0800)]
[llvm][IR] Do not place constants with static relocations in a mergeable section

This patch provides two major changes:

1. Add getRelocationInfo to check if a constant will have static, dynamic, or
   no relocations. (Also rename the original needsRelocation to needsDynamicRelocation.)
2. Only allow a constant with no relocations (static or dynamic) to be placed
   in a mergeable section.

This will allow unused symbols that contain static relocations and happen to
fit in mergeable constant sections (.rodata.cstN) to instead be placed in
unique-named sections if -fdata-sections is used and subsequently garbage collected
by --gc-sections.

See https://lists.llvm.org/pipermail/llvm-dev/2021-February/148281.html.

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

3 years ago[gn build] assert that goma_dir and sysroot are set for goma builds
Nico Weber [Thu, 18 Feb 2021 23:30:13 +0000 (18:30 -0500)]
[gn build] assert that goma_dir and sysroot are set for goma builds

3 years ago[CSSPGO] Use callsite sample counts to annotate indirect call sites.
Hongtao Yu [Thu, 18 Feb 2021 20:44:57 +0000 (12:44 -0800)]
[CSSPGO] Use callsite sample counts to annotate indirect call sites.

With CSSPGO all indirect call targets are counted torwards the original indirect call site in the profile, including both inlined and non-inlined targets. Therefore no need to look for callee entry counts. This also fixes the issue where callee entry count doesn't match callsite count due to the nature of CS sampling.

I'm also cleaning up the orginal code that called `findIndirectCallFunctionSamples` just to compute the sum, the return value of which was disgarded.

Reviewed By: wmi, wenlei

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

3 years agoAMDGPU: Add regression testcase for bundle pressure issue
Matt Arsenault [Wed, 3 Feb 2021 19:16:40 +0000 (14:16 -0500)]
AMDGPU: Add regression testcase for bundle pressure issue

This is a somewhat reduced testcase that regressed, causing the revert
in 477e3fe4f874b1c4d5896f3bfaf7b3b8a6d38103.

This was producing a bundle that could not be allocated. This is a
tricky one to reduce/reproduce, but I do like having some sanity check
for this.

3 years ago[MLIR] Make structured op tests permutation invariant
Geoffrey Martin-Noble [Thu, 18 Feb 2021 20:56:42 +0000 (12:56 -0800)]
[MLIR] Make structured op tests permutation invariant

Extracts the relevant dimensions from the map under test to build up the
maps to test against in a permutation-invariant way.

This also includes a fix to the indexing maps used by
isColumnMajorMatmul. The maps as currently written do not describe a
column-major matmul. The linalg named op column_major_matmul has the
correct maps (and notably fails the current test).

If `C = matmul(A, B)` we want an operation that given A in column major
format and B in column major format produces C in column major format.
Given that for a matrix, faux column major is just transpose.
`column_major_matmul(transpose(A), transpose(B)) = transpose(C)`. If
`A` is `NxK` and `B` is `KxM`, then `C` is `NxM`, so `transpose(A)` is
`KxN`, `transpose(B)` is `MxK` and `transpose(C)` is `MxN`, not `NxM`
as these maps currently have.

Reviewed By: nicolasvasilache

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

3 years ago[Coverage] Store compilation dir separately in coverage mapping
Petr Hosek [Wed, 10 Feb 2021 08:25:34 +0000 (00:25 -0800)]
[Coverage] Store compilation dir separately in coverage mapping

We currently always store absolute filenames in coverage mapping.  This
is problematic for several reasons. It poses a problem for distributed
compilation as source location might vary across machines.  We are also
duplicating the path prefix potentially wasting space.

This change modifies how we store filenames in coverage mapping. Rather
than absolute paths, it stores the compilation directory and file paths
as given to the compiler, either relative or absolute. Later when
reading the coverage mapping information, we recombine relative paths
with the working directory. This approach is similar to handling
ofDW_AT_comp_dir in DWARF.

Finally, we also provide a new option, -fprofile-compilation-dir akin
to -fdebug-compilation-dir which can be used to manually override the
compilation directory which is useful in distributed compilation cases.

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

3 years agoGlobalISel: Merge some AMDGPU ABI lowering code to generic code
Matt Arsenault [Sun, 7 Feb 2021 17:12:31 +0000 (12:12 -0500)]
GlobalISel: Merge some AMDGPU ABI lowering code to generic code

AMDGPU currently has a lot of pre-processing code to pre-split
argument types into 32-bit pieces before passing it to the generic
code in handleAssignments. This is a bit sloppy and also requires some
overly fancy iterator work when building the calls. It's better if all
argument marshalling code is handled directly in
handleAssignments. This handles more situations like decomposing large
element vectors into sub-element sized pieces.

This should mostly be NFC, but does change the generated code by
shifting where the initial argument packing instructions are placed. I
think this is nicer looking, since it now emits the packing code
directly after the relevant copies, rather than after the copies for
the remaining arguments.

This doubles down on gfx6/gfx7 using the gfx8+ ABI for 16-bit
types. This is ultimately the better option, but incompatible with the
DAG. Fixing this requires more work, especially for f16.

3 years ago[BasicAA] Always strip single-argument phi nodes
Nikita Popov [Sun, 14 Feb 2021 20:24:36 +0000 (21:24 +0100)]
[BasicAA] Always strip single-argument phi nodes

We can always look through single-argument (LCSSA) phi nodes when
performing alias analysis. getUnderlyingObject() already does this,
but stripPointerCastsAndInvariantGroups() does not. We still look
through these phi nodes with the usual aliasPhi() logic, but
sometimes get sub-optimal results due to the restrictions on value
equivalence when looking through arbitrary phi nodes. I think it's
generally beneficial to keep the underlying object logic and the
pointer cast stripping logic in sync, insofar as it is possible.

With this patch we get marginally better results:

  aa.NumMayAlias | 5010069 | 5009861
  aa.NumMustAlias | 347518 | 347674
  aa.NumNoAlias | 27201336 | 27201528
  ...
  licm.NumPromoted | 1293 | 1296

I've renamed the relevant strip method to stripPointerCastsForAliasAnalysis(),
as we're past the point where we can explicitly spell out everything
that's getting stripped.

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

3 years ago[mlir] Fold trivial subtensor / subtensor_insert ops.
Nicolas Vasilache [Thu, 18 Feb 2021 21:33:03 +0000 (21:33 +0000)]
[mlir] Fold trivial subtensor / subtensor_insert ops.

Static subtensor / subtensor_insert of the same size as the source / destination tensor and root @[0..0] with strides [1..1] are folded away.

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

3 years ago[libc] Add implementations of the remaining fenv functions.
Siva Chandra Reddy [Tue, 16 Feb 2021 06:36:55 +0000 (22:36 -0800)]
[libc] Add implementations of the remaining fenv functions.

Namely, implementations of fegetexceptfflag, fesetexceptflag,
fegetenv, fesetenv, feholdexcept and feupdateenv have been added.

Reviewed By: lntue

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

3 years ago[DAG] getTruncatedUSUBSAT - always truncate operands. NFCI.
Simon Pilgrim [Thu, 18 Feb 2021 21:28:39 +0000 (21:28 +0000)]
[DAG] getTruncatedUSUBSAT - always truncate operands. NFCI.

As noticed on D96703, we're always truncating the operands so should use getNode(ISD::TRUNCATE) instead of getZExtOrTrunc.

3 years agoMove a second variable only used in an assert into the assert.
Sterling Augustine [Thu, 18 Feb 2021 21:25:37 +0000 (13:25 -0800)]
Move a second variable only used in an assert into the assert.

This prevents unused variable warnings when building without asserts.

3 years ago[DAGCombiner] Transform (zext (select c, load1, load2)) -> (select c, zextload1,...
Guozhi Wei [Thu, 18 Feb 2021 21:12:19 +0000 (13:12 -0800)]
[DAGCombiner] Transform (zext (select c, load1, load2)) -> (select c, zextload1, zextload2)

If extload is legal, following transform
    (zext (select c, load1, load2)) -> (select c, zextload1, zextload2)
can save one ext instruction.

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

3 years ago[flang] Extension: forward refs to dummy args under IMPLICIT NONE
peter klausler [Thu, 18 Feb 2021 19:55:31 +0000 (11:55 -0800)]
[flang] Extension: forward refs to dummy args under IMPLICIT NONE

Most Fortran compilers accept the following benign extension,
and it appears in some applications:

  SUBROUTINE FOO(A,N)
    IMPLICIT NONE
    REAL A(N) ! N is used before being typed
    INTEGER N
  END

Allow it in f18 only for default integer scalar dummy arguments.

Differential Revesion: https://reviews.llvm.org/D96982

3 years ago[gn build] kind of merge f020544601
Nico Weber [Thu, 18 Feb 2021 21:12:04 +0000 (16:12 -0500)]
[gn build] kind of merge f020544601

Fixes check-llvm with a clean build dir.

3 years agoImplement -bundle_loader
Vy Nguyen [Wed, 3 Feb 2021 02:23:22 +0000 (21:23 -0500)]
Implement -bundle_loader

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

Usage: -bundle_loader <executable>
This option specifies the executable that will load the build output file being linked.
When building a bundle, users can use the --bundle_loader  to specify an executable
that contains symbols referenced, but not implemented in the bundle.

3 years agoMove variable only used in an assert into the assert.
Sterling Augustine [Thu, 18 Feb 2021 21:00:49 +0000 (13:00 -0800)]
Move variable only used in an assert into the assert.

This prevents unused variable warnings when building without asserts.

3 years ago[DCE] Add tests for non-willreturn function being removed (NFC)
Nikita Popov [Thu, 18 Feb 2021 20:25:14 +0000 (21:25 +0100)]
[DCE] Add tests for non-willreturn function being removed (NFC)

3 years agoRevert "[Coverage] Store compilation dir separately in coverage mapping"
Petr Hosek [Thu, 18 Feb 2021 20:47:40 +0000 (12:47 -0800)]
Revert "[Coverage] Store compilation dir separately in coverage mapping"

This reverts commit 97ec8fa5bb07e3f5bf25ddcb216b545cd3d03b65 since
the test is failing on some bots.

3 years ago[mlir][Vector] Fold tensor_cast + vector.transfer_read
Nicolas Vasilache [Thu, 18 Feb 2021 20:26:14 +0000 (20:26 +0000)]
[mlir][Vector] Fold tensor_cast + vector.transfer_read

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

3 years agoRemove redundent types in pr49185.ll
Ta-Wei Tu [Thu, 18 Feb 2021 20:44:27 +0000 (04:44 +0800)]
Remove redundent types in pr49185.ll

3 years ago[RISCV] Simplify VPseudoAMOEI multiclass. NFC
Craig Topper [Thu, 18 Feb 2021 20:35:23 +0000 (12:35 -0800)]
[RISCV] Simplify VPseudoAMOEI multiclass. NFC

lmul was already iterated in one of the loops. We don't need to recreate
it from a string.

3 years ago[AMDGPU] Correct gfx90c feature list
Stanislav Mekhanoshin [Thu, 18 Feb 2021 20:20:23 +0000 (12:20 -0800)]
[AMDGPU] Correct gfx90c feature list

Looks like we have forced FeatureXNACK and forgot
FeatureMadMacF32Insts.

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

3 years agoRevert "[AArch64] Adding Neon Polynomial vadd Intrinsics"
Pengxuan Zheng [Thu, 18 Feb 2021 20:36:02 +0000 (12:36 -0800)]
Revert "[AArch64] Adding Neon Polynomial vadd Intrinsics"

Revert the patch due to buildbot failures.

This reverts commit d9645059c5deeacf264bea0cf50eab459cf8e5bb.

3 years agoPerform memory accesses in the same addrspace as the corresponding memref.
Andrew Pritchard [Thu, 18 Feb 2021 20:21:11 +0000 (12:21 -0800)]
Perform memory accesses in the same addrspace as the corresponding memref.

It's not necessarily the case on all architectures that all memory is
addressable in addrspace 0, so casting the pointer to addrspace 0 is
liable to cause problems.

Reviewed By: aartbik, ftynse, nicolasvasilache

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

3 years ago[Coverage] Store compilation dir separately in coverage mapping
Petr Hosek [Wed, 10 Feb 2021 08:25:34 +0000 (00:25 -0800)]
[Coverage] Store compilation dir separately in coverage mapping

We currently always store absolute filenames in coverage mapping.  This
is problematic for several reasons. It poses a problem for distributed
compilation as source location might vary across machines.  We are also
duplicating the path prefix potentially wasting space.

This change modifies how we store filenames in coverage mapping. Rather
than absolute paths, it stores the compilation directory and file paths
as given to the compiler, either relative or absolute. Later when
reading the coverage mapping information, we recombine relative paths
with the working directory. This approach is similar to handling
ofDW_AT_comp_dir in DWARF.

Finally, we also provide a new option, -fprofile-compilation-dir akin
to -fdebug-compilation-dir which can be used to manually override the
compilation directory which is useful in distributed compilation cases.

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

3 years ago[clang] bump VERSION_MAJOR
Nico Weber [Thu, 18 Feb 2021 20:23:23 +0000 (15:23 -0500)]
[clang] bump VERSION_MAJOR

Somewhat speculative, see https://reviews.llvm.org/D96816#2572431

3 years ago[MLIR][TOSA] Add lowering from TOSA to Linalg for math-based and elementwise ops
natashaknk [Thu, 18 Feb 2021 20:09:59 +0000 (12:09 -0800)]
[MLIR][TOSA] Add lowering from TOSA to Linalg for math-based and elementwise ops

This patch adds lowering to Linalg for the following TOSA ops: negate, rsqrt, mul, select, clamp and reluN and includes support for signless integer and floating point types

Reviewed By: rsuderman

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

3 years ago[llvm][TextAPI] add equality operator for InterfaceFile
Sam Powell [Thu, 18 Feb 2021 19:27:54 +0000 (11:27 -0800)]
[llvm][TextAPI] add equality operator for InterfaceFile

This patch adds functionality to compare for the equality between `InterfaceFile`s based on attributes specific to linking.

Reviewed By: cishida, steven_wu

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

3 years ago[WebAssembly] Fix assert in lookup of section symbols
Wouter van Oortmerssen [Thu, 11 Feb 2021 01:34:05 +0000 (17:34 -0800)]
[WebAssembly] Fix assert in lookup of section symbols

Fixes assert in: https://bugs.llvm.org/show_bug.cgi?id=49036

getWasmSection creates sections if they don't exist, but doesn't add them to the Symbols table. This may cause problems in subsequent calls to getOrCreateSymbol which checks this table, the calls createSymbol assuming it doesn't exist, which then checks UsedNames and finds out it does exist, causing an assert on trying to rename a non-temp symbol.

I tried also fixing the somewhat unintuitive forced suffixing (adding `0`), but it turns out that WasmObjectWriter currently assumes these section symbols are unique, so that may have to be a separate fix: https://bugs.llvm.org/show_bug.cgi?id=49252

Also worth noting is that getWasmSection calling createSymbol may not be correct to start with, given that createSymbol seems to assume it is creating non-section symbols. But again, for a future fix.

Related: where some of this was introduced: https://github.com/llvm/llvm-project/commit/8d396acac3bc21f688ac707bb42e4698dbdcab7e

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

3 years ago[RISCV] Add Zbb command lines to uadd/usub/sadd/ssub tests.
Craig Topper [Thu, 18 Feb 2021 19:24:04 +0000 (11:24 -0800)]
[RISCV] Add Zbb command lines to uadd/usub/sadd/ssub tests.

The expansions of the saturating intrinsics can make use of
the min(u)/max(u) instructions in Zbb.

3 years ago[Coverage] Emit gap region after conditions when macro is present.
Zequan Wu [Thu, 18 Feb 2021 02:16:40 +0000 (18:16 -0800)]
[Coverage] Emit gap region after conditions when macro is present.

3 years ago[gn build] try to fix libxml2 include path on mac after 0ec448194e29
Nico Weber [Thu, 18 Feb 2021 19:40:14 +0000 (14:40 -0500)]
[gn build] try to fix libxml2 include path on mac after 0ec448194e29

3 years ago[RISCV] Use XLenRI alias for RegInfoByHwMode instances
Jessica Clarke [Sat, 13 Feb 2021 16:26:08 +0000 (16:26 +0000)]
[RISCV] Use XLenRI alias for RegInfoByHwMode instances

This avoids tedious repetition and matches what we do for the
ValueTypeByHwMode uses.

Reviewed By: craig.topper, luismarques

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

3 years ago[AArch64] Adding Neon Polynomial vadd Intrinsics
Pengxuan Zheng [Thu, 18 Feb 2021 19:32:35 +0000 (11:32 -0800)]
[AArch64] Adding Neon Polynomial vadd Intrinsics

This patch adds the following intrinsics:
            vadd_p8
            vadd_p16
            vadd_p64
            vaddq_p8
            vaddq_p16
            vaddq_p64
            vaddq_p128

Reviewed By: t.p.northover, DavidSpickett

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

3 years agofix comment typos to cycle bots
Nico Weber [Thu, 18 Feb 2021 19:24:56 +0000 (14:24 -0500)]
fix comment typos to cycle bots

3 years agoPre-commit test case
Guozhi Wei [Thu, 18 Feb 2021 19:05:29 +0000 (11:05 -0800)]
Pre-commit test case

Pre-commit test case for https://reviews.llvm.org/D95086, so that patch
can show the actual diff.

3 years ago[NPM] Properly reset parent loop after loop passes
Ta-Wei Tu [Thu, 18 Feb 2021 18:50:21 +0000 (02:50 +0800)]
[NPM] Properly reset parent loop after loop passes

This fixes https://bugs.llvm.org/show_bug.cgi?id=49185

When `NDEBUG` is not set, `LPMUpdater` checks if the added loops have the same parent loop as the current one in `addSiblingLoops`.
If multiple loop passes are executed through `LoopPassManager`, `U.ParentL` will be the same across all passes.
However, the parent loop might change after running a loop pass, resulting in assertion failures in subsequent passes.

This patch resets `U.ParentL` after running individual loop passes in `LoopPassManager`.

Reviewed By: asbirlea, ychen

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

3 years agolibcxx: use early returns
Joerg Sonnenberger [Wed, 17 Feb 2021 21:13:01 +0000 (22:13 +0100)]
libcxx: use early returns

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

3 years ago[lldb] Remove unused code in ScriptInterpreterPython
Jonas Devlieghere [Thu, 18 Feb 2021 18:37:30 +0000 (10:37 -0800)]
[lldb] Remove unused code in ScriptInterpreterPython

Remove the unused code I noticed when working on d6e80578fc5e and do
some other minor cleanups in the vicinity.

3 years ago[CFE, SystemZ] New target hook testFPKind() for checks of FP values.
Jonas Paulsson [Fri, 12 Feb 2021 01:57:26 +0000 (02:57 +0100)]
[CFE, SystemZ]  New target hook testFPKind() for checks of FP values.

The recent commit 00a6254 "Stop traping on sNaN in builtin_isnan" changed the
lowering in constrained FP mode of builtin_isnan from an FP comparison to
integer operations to avoid trapping.

SystemZ has a special instruction "Test Data Class" which is the preferred
way to do this check. This patch adds a new target hook "testFPKind()" that
lets SystemZ emit the s390_tdc intrinsic instead.

testFPKind() takes the BuiltinID as an argument and is expected to soon
handle more opcodes than just 'builtin_isnan'.

Review: Thomas Preud'homme, Ulrich Weigand
Differential Revision: https://reviews.llvm.org/D96568

3 years ago[PowerPC][AIX] Add support for vector arg passing on the stack.
Sean Fertile [Thu, 18 Feb 2021 18:31:30 +0000 (13:31 -0500)]
[PowerPC][AIX] Add support for vector arg passing on the stack.

Enable passing more vector arguments then available vector
argument passing registers.

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

3 years ago[WebAssembly] Handle multiple EH_LABELs in EH pad
Heejin Ahn [Thu, 18 Feb 2021 17:21:33 +0000 (09:21 -0800)]
[WebAssembly] Handle multiple EH_LABELs in EH pad

Usually `EH_LABEL`s are placed in
- Before an `invoke` (which becomes calls in the backend)
- After an `invoke`
- At the start of an EH pad

I don't know exactly why, but I noticed there are cases of multiple, not
a single, `EH_LABEL` instructions in the beginning of an EH pad. In that
case `global.set` instruction placed to restore `__stack_pointer` ended
up between two `EH_LABEL` instructions before `CATCH`. It should follow
after the `EH_LABEL`s and `CATCH`. This CL fixes that case.

Reviewed By: dschuff

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

3 years ago[dfsan] Refactor defining TLS variables
Jianzhou Zhao [Thu, 18 Feb 2021 08:14:13 +0000 (08:14 +0000)]
[dfsan] Refactor defining TLS variables

This is a part of https://reviews.llvm.org/D95835.

Reviewed-by: morehouse
Differential Revision: https://reviews.llvm.org/D96941

3 years ago[dfsan] Refactor runtime functions checking
Jianzhou Zhao [Thu, 18 Feb 2021 08:04:30 +0000 (08:04 +0000)]
[dfsan] Refactor runtime functions checking

This is a part of https://reviews.llvm.org/D95835.

Reviewed-by: morehouse
Differential Revision: https://reviews.llvm.org/D96940

3 years ago[dfsan] Add origin tls/move/read APIs
Jianzhou Zhao [Fri, 12 Feb 2021 00:29:58 +0000 (00:29 +0000)]
[dfsan] Add origin tls/move/read APIs

This is a part of https://reviews.llvm.org/D95835.

Added
1) TLS storage
2) a weak global used to set by instrumented code
3) move origins

These APIs are similar to MSan's APIs
  https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/msan/msan_poisoning.cpp
We first improved MSan's by https://reviews.llvm.org/D94572 and https://reviews.llvm.org/D94552.
So the correctness has been verified by MSan.
After the DFSan instrument code is ready, we wil be adding more test
cases

4) read

To reduce origin tracking cost, some of the read APIs return only
the origin from the first taint data.

Note that we did not add origin set APIs here because they are related
to code instrumentation, will be added later with IR transformation
code.

Reviewed-by: morehouse
Differential Revision: https://reviews.llvm.org/D96564

3 years ago[lldb] Un-XFAIL TestFormatters on windows
Pavel Labath [Thu, 18 Feb 2021 15:27:47 +0000 (16:27 +0100)]
[lldb] Un-XFAIL TestFormatters on windows

The test passes after D96779.

3 years ago[ObjC] Encode pointers to C++ classes as "^v" if the encoded string
Akira Hatanaka [Thu, 18 Feb 2021 17:38:26 +0000 (09:38 -0800)]
[ObjC] Encode pointers to C++ classes as "^v" if the encoded string
would otherwise include template specialization types

This helps reduce the size of the encoded C++ type strings in the binary.

This is enabled by default only on Darwin, but can be enabled/disabled
via command line options.

rdar://63288571

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

3 years agoFix a buildbot warning triggered by 1dfb06d
Philip Reames [Thu, 18 Feb 2021 17:37:38 +0000 (09:37 -0800)]
Fix a buildbot warning triggered by 1dfb06d

3 years ago[RISCV] Pre-commit test file changes from D96661. NFC
Craig Topper [Thu, 18 Feb 2021 17:24:52 +0000 (09:24 -0800)]
[RISCV] Pre-commit test file changes from D96661. NFC

This includes i32 SHFLI tests for RV64 which we currently don't optimize.
And tests for associativity of OR.

3 years ago[flang][driver] Add missing dependency (nfc)
Andrzej Warzynski [Thu, 18 Feb 2021 17:02:23 +0000 (17:02 +0000)]
[flang][driver] Add missing dependency (nfc)

These dependencies were introduced via the `ParseTreeDumper` API in:
  * https://reviews.llvm.org/D96716
They manifested themselves in buildbot builders that set
`BUILD_SHARED_LIBS` to `On`.

3 years ago[RISCV] Add support for fixed vector MULHU/MULHS.
Craig Topper [Thu, 18 Feb 2021 17:09:33 +0000 (09:09 -0800)]
[RISCV] Add support for fixed vector MULHU/MULHS.

This uses to division by constant optimization to use MULHU/MULHS.

Reviewed By: frasercrmck, arcbbb

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

3 years ago[verify-regalloc] Verify after allocation and before postOptimization
Philip Reames [Thu, 18 Feb 2021 17:08:56 +0000 (09:08 -0800)]
[verify-regalloc] Verify after allocation and before postOptimization

I've now hit several cases where a mistake in the regalloc main loop caused corrupt live intervals that didn't get caught until either the next verify or during post-optimization.  The later case is rather confusing and tends to lead one down false trails, so let's catch corruption before that.

3 years ago[clang][SVE] Use __inline__ instead of inline in arm_sve.h
Joe Ellis [Thu, 18 Feb 2021 17:08:12 +0000 (17:08 +0000)]
[clang][SVE] Use __inline__ instead of inline in arm_sve.h

The inline keyword is not defined in the C89 standard, so source files
that include arm_sve.h will fail compilation if -std=c89 is specified.
For consistency with arm_neon.h, we should use __inline__ instead.

Reviewed By: paulwalker-arm

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

3 years ago[RISCV] Add support for fixed vector sign/zero extend from mask types.
Craig Topper [Thu, 18 Feb 2021 17:01:51 +0000 (09:01 -0800)]
[RISCV] Add support for fixed vector sign/zero extend from mask types.

Due to vXi64 on RV32, I've directly emitted this using _VL ISD
opcodes. If it wasn't for that we could just use fixed vector
BUILD_VECTOR and VSELECT and let those each be legalized.

Reviewed By: frasercrmck

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

3 years ago[RISCV] Support isel of scalable vector bitcasts
Craig Topper [Thu, 18 Feb 2021 16:54:03 +0000 (08:54 -0800)]
[RISCV] Support isel of scalable vector bitcasts

These should be NOPs so we can just replace with the input. This
matches what SVE does with isel patterns for all permutations.
Custom isel saves us from having to list all permurations for
all LMULs.

Reviewed By: frasercrmck

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

3 years ago[splitkit] Add a minor wrapper function for readability [NFC]
Philip Reames [Thu, 18 Feb 2021 16:59:38 +0000 (08:59 -0800)]
[splitkit] Add a minor wrapper function for readability [NFC]

3 years agolibcxx: fix a documentation typo
Nico Weber [Thu, 18 Feb 2021 16:58:48 +0000 (11:58 -0500)]
libcxx: fix a documentation typo

See `grep 'option.LIBCXX_INCLUDE_TESTS' libcxx/CMakeLists.txt`.

3 years ago[gn build] fix mistake in 0ec448194e29
Nico Weber [Thu, 18 Feb 2021 16:57:38 +0000 (11:57 -0500)]
[gn build] fix mistake in 0ec448194e29

3 years agoAMDGPU: Fix checks in llvm.amdgcn.workitem.id.ll
Konstantin Zhuravlyov [Thu, 18 Feb 2021 16:55:25 +0000 (11:55 -0500)]
AMDGPU: Fix checks in llvm.amdgcn.workitem.id.ll

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

3 years ago[AArch64][SVE] Add patterns to generate FMLA/FMLS/FNMLA/FNMLS/FMAD
Bradley Smith [Mon, 8 Feb 2021 16:52:19 +0000 (16:52 +0000)]
[AArch64][SVE] Add patterns to generate FMLA/FMLS/FNMLA/FNMLS/FMAD

Adjust generateFMAsInMachineCombiner to return false if SVE is present
in order to combine fmul+fadd into fma. Also add new pseudo instructions
so as to select the most appropriate of FMLA/FMAD depending on register
allocation.

Depends on D96599

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

3 years ago[TableGen][SelectionDAG] Improve efficiency of encoding negative immediates for isel...
Craig Topper [Thu, 18 Feb 2021 16:45:08 +0000 (08:45 -0800)]
[TableGen][SelectionDAG] Improve efficiency of encoding negative immediates for isel's CheckInteger opcode.

CheckInteger uses an int64_t encoded using a variable width encoding
that is optimized for encoding a number with a lot of leading zeros.
Negative numbers have no leading zeros so use the largest encoding
requiring 9 bytes.

I believe its most like we want to check for positive and negative
numbers near 0. -1 is quite common due to its use in the 'not'
idiom.

To optimize for this, we can borrow an idea from the bitcode format
and move the sign bit to bit 0 with the magnitude stored in the
upper bits. This will drastically increase the number of leading
zeros for small magnitudes. Then we can run this value through
VBR encoding.

This gives a small reduction in the table size on all in tree
targets except VE where size increased by about 300 bytes due
to intrinsic ids now requiring 3 bytes instead of 2. Since the
intrinsic enum space is shared by all targets this an unfortunate
consquence of where VE is currently located in the range.

Reviewed By: RKSimon

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

3 years ago[AArch64] Allow folding FMUL/FADD into FMA for FP16 types
Bradley Smith [Fri, 12 Feb 2021 12:51:10 +0000 (12:51 +0000)]
[AArch64] Allow folding FMUL/FADD into FMA for FP16 types

isFMAFasterThanFMulAndFAdd should return true for FP16 types when
HasFullFP16 is present, since we have the instructions to handle it for
both SVE and NEON. (SVE patterns and tests will follow).

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

3 years ago[regalloc] Add a couple of dump routines for ease of debugging [NFC]
Philip Reames [Thu, 18 Feb 2021 16:50:00 +0000 (08:50 -0800)]
[regalloc] Add a couple of dump routines for ease of debugging [NFC]

3 years ago[instcombine] Exploit UB implied by nofree attributes
Philip Reames [Thu, 18 Feb 2021 16:33:12 +0000 (08:33 -0800)]
[instcombine] Exploit UB implied by nofree attributes

This patch simply implements the documented UB of the current nofree attributes as specified. It doesn't try to be fancy about inference (yet), it just implements the cases already specified and inferred.

Note: When this lands, it may expose miscompiles. If so, please revert and provide a test case. It's likely the bug is in the existing inference code and without a relatively complete test case, it will be hard to debug.

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