platform/upstream/llvm.git
2 years ago[TargetLowering] Simplify the interface of expandABS. NFC
Craig Topper [Fri, 22 Oct 2021 17:19:57 +0000 (10:19 -0700)]
[TargetLowering] Simplify the interface of expandABS. NFC

Instead of returning a bool to indicate success and a separate
SDValue, return the SDValue and have the callers check if it is
null.

Reviewed By: RKSimon

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

2 years ago[lldb] Pass the target triple when determining the DWARF version
Jonas Devlieghere [Fri, 22 Oct 2021 17:09:17 +0000 (10:09 -0700)]
[lldb] Pass the target triple when determining the DWARF version

When targeting iOS, the default dwarf version is 2 and not 4. Currently,
the test suite does not pick up on that because it invokes the test
compiler without a target triple. This patch fixes that and now
correctly skips tests that have a dwarf version specified in a skipIf
decorator.

rdar://84530477

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

2 years ago[llvm]Inclusive language: replace master with main
Quinn Pham [Fri, 22 Oct 2021 16:49:14 +0000 (11:49 -0500)]
[llvm]Inclusive language: replace master with main

[NFC] This patch fixes a url in a testcase due to the renaming of the branch.

2 years ago[libc++] Fix tests after aee49255074f
Louis Dionne [Fri, 22 Oct 2021 16:49:58 +0000 (12:49 -0400)]
[libc++] Fix tests after aee49255074f

2 years ago[Loads] Use more powerful constant folding API
Nikita Popov [Thu, 21 Oct 2021 18:46:06 +0000 (20:46 +0200)]
[Loads] Use more powerful constant folding API

This follows up on D111023 by exporting the generic "load value
from constant at given offset as given type" and using it in the
store to load forwarding code. We now need to make sure that the
load size is smaller than the store size, previously this was
implicitly ensured by ConstantFoldLoadThroughBitcast().

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

2 years ago[Attributor] Generalize GEP construction
Nikita Popov [Thu, 21 Oct 2021 19:42:14 +0000 (21:42 +0200)]
[Attributor] Generalize GEP construction

Make use of the getGEPIndicesForOffset() helper for creating GEPs.
This handles arrays as well, uses correct GEP index types and
reduces code duplication.

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

2 years ago[LegalizeTypes][RISCV][PowerPC] Expand CTLZ/CTTZ/CTPOP instead of promoting if they...
Craig Topper [Fri, 22 Oct 2021 16:05:39 +0000 (09:05 -0700)]
[LegalizeTypes][RISCV][PowerPC] Expand CTLZ/CTTZ/CTPOP instead of promoting if they'll be expanded later.

Expanding these requires multiple constants. If we promote during type
legalization when they'll end up getting expanded in LegalizeDAG, we'll
use larger constants. These constants may be harder to materialize.
For example, 64-bit constants on 64-bit RISCV are very expensive.

This is similar to what has already been done to BSWAP and BITREVERSE.

Reviewed By: RKSimon

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

2 years ago[AIX] Enable rtl for plugins test
Steven Wan [Fri, 22 Oct 2021 16:07:57 +0000 (12:07 -0400)]
[AIX] Enable rtl for plugins test

On AIX, the plugins are linked with `-WL,-G`, which produces shared objects enabled for use with the run-time linker. This patch sets the run-time
linker at the main executable link step to allow symbols from the plugins shared objects to be properly bound.

Reviewed By: daltenty

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

2 years ago[RISCV] Merge vector tests for rv32 and rv64 into a single test file
Craig Topper [Thu, 21 Oct 2021 17:22:02 +0000 (10:22 -0700)]
[RISCV] Merge vector tests for rv32 and rv64 into a single test file

These tests have nearly identical content the only difference is
that the rv64 test has a signext attribute on some parameters.
That attribute should be harmless on rv32.

Merge them into a single test file with 2 RUN lines.

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

2 years ago[OpenMP][OMPT][GOMP] task frame support in KMP_API_NAME_GOMP_PARALLEL_SECTIONS
Vladimir Inđić [Thu, 21 Oct 2021 22:09:11 +0000 (17:09 -0500)]
[OpenMP][OMPT][GOMP] task frame support in KMP_API_NAME_GOMP_PARALLEL_SECTIONS

KMP_API_NAME_GOMP_PARALLEL_SECTIONS function was missing the task frame support.
This patch introduced a fix responsible to set properly the exit_frame of
the innermost implicit task that corresponds to the parallel section construct,
as well as the enter_frame of the task that encloses the mentioned implicit task.

This patch also introduced a simple test case sections_serialized.c that contains
serialized parallel section construct and validates whether the mentioned
task frames are set correctly.

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

2 years ago[Target, Transforms] Use StringRef::contains (NFC)
Kazu Hirata [Fri, 22 Oct 2021 15:52:33 +0000 (08:52 -0700)]
[Target, Transforms] Use StringRef::contains (NFC)

2 years ago[SystemZ] Give the EXRL_Pseudo a size value of 6 bytes.
Jonas Paulsson [Fri, 22 Oct 2021 15:05:20 +0000 (17:05 +0200)]
[SystemZ] Give the EXRL_Pseudo a size value of 6 bytes.

This pseudo is expanded very late (AsmPrinter) and therefore has to have a
correct size value, or the branch relaxation pass may make a wrong decision.

Review: Ulrich Weigand

2 years ago[libc++][nfc] Remove double spaces.
Mark de Wever [Thu, 21 Oct 2021 16:29:14 +0000 (18:29 +0200)]
[libc++][nfc] Remove double spaces.

Based on the comment of @Quuxplusone in D111961. It seems no tests are
affected, but give it a run on the CI to be sure.

Reviewed By: #libc, ldionne

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

2 years ago[libc++][doc] Fixes FeatureTestMacroTable.html.
Mark de Wever [Thu, 21 Oct 2021 18:06:30 +0000 (20:06 +0200)]
[libc++][doc] Fixes FeatureTestMacroTable.html.

`utils/generate_feature_test_macro_components.py` uses the wrong
indentation. `:name: feature-status-table :widths: auto` is rendered as
text instead of being used by Sphinx to render the table properly.

This fixes the identation in the souce and updates the generated output.

Reviewed By: #libc, ldionne

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

2 years ago[InstCombine][NFC] Precommit new tests
Piotr Sobczak [Fri, 22 Oct 2021 14:23:24 +0000 (16:23 +0200)]
[InstCombine][NFC] Precommit new tests

2 years ago[libc++][test][NFC] Add tests for std::vector comparisons
Konstantin Boyarinov [Fri, 22 Oct 2021 14:36:28 +0000 (17:36 +0300)]
[libc++][test][NFC] Add tests for std::vector comparisons

Add missing tests for std::vector operator==, !=, <, <=, >, >=

Reviewed By: ldionne, rarutyun, Quuxplusone, Mordante, #libc

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

2 years ago[Flang][docs] Remove an out-dated section on the new driver
Andrzej Warzynski [Fri, 22 Oct 2021 14:41:16 +0000 (14:41 +0000)]
[Flang][docs] Remove an out-dated section on the new driver

This section of the documentation should've been deleted in:
https://reviews.llvm.org/D105811

I am submitting this without a review as it's an obvious omission.

2 years ago[AArch64][SVE] Add new ld<n> intrinsics that return a struct of vscale types
Bradley Smith [Mon, 18 Oct 2021 16:20:24 +0000 (16:20 +0000)]
[AArch64][SVE] Add new ld<n> intrinsics that return a struct of vscale types

This will allow us to reuse existing interleaved load logic in
lowerInterleavedLoad that exists for neon types, but for SVE fixed
types.

The goal eventually will be to replace the existing ld<n> intriniscs
with these, once a migration path has been sorted out.

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

2 years ago[clang/llvm] Inclusive language: replace segregate with separate
Zarko Todorovski [Fri, 22 Oct 2021 13:45:30 +0000 (09:45 -0400)]
[clang/llvm] Inclusive language: replace segregate with separate

2 years ago[X86] `X86TTIImpl::getInterleavedMemoryOpCost()`: scale interleaving cost by the...
Roman Lebedev [Fri, 22 Oct 2021 13:31:56 +0000 (16:31 +0300)]
[X86] `X86TTIImpl::getInterleavedMemoryOpCost()`: scale interleaving cost by the fraction of live members

By definition, interleaving load of stride N means:
load N*VF elements, and shuffle them into N VF-sized vectors,
with 0'th vector containing elements `[0, VF)*stride + 0`,
and 1'th vector containing elements `[0, VF)*stride + 1`.
Example: https://godbolt.org/z/df561Me5E (i64 stride 4 vf 2 => cost 6)

Now, not fully interleaved load, is when not all of these vectors is demanded.
So at worst, we could just pretend that everything is demanded,
and discard the non-demanded vectors. What this means is that the cost
for not-fully-interleaved group should be not greater than the cost
for the same fully-interleaved group, but perhaps somewhat less.
Examples:
https://godbolt.org/z/a78dK5Geq (i64 stride 4 (indices 012u) vf 2 => cost 4)
https://godbolt.org/z/G91ceo8dM (i64 stride 4 (indices 01uu) vf 2 => cost 2)
https://godbolt.org/z/5joYob9rx (i64 stride 4 (indices 0uuu) vf 2 => cost 1)

Right now, for such not-fully-interleaved loads we just use the costs
for fully-interleaved loads. But at least **in general**,
that is obviously overly pessimistic, because **in general**,
not all the shuffles needed to perform the full interleaving
will end up being live.

So what this does, is naively scales the interleaving cost
by the fraction of the live members. I believe this should still result
in the right ballpark cost estimate, although it may be over/under -estimate.

Reviewed By: RKSimon

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

2 years agoReplace references to Makefile.sphinx
Sylvestre Ledru [Fri, 22 Oct 2021 13:31:38 +0000 (15:31 +0200)]
Replace references to Makefile.sphinx

and fix some typos

Reviewed By: aaron.ballman

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

2 years ago[lldb] Another build fix for 8b8070e23
Pavel Labath [Fri, 22 Oct 2021 13:28:06 +0000 (15:28 +0200)]
[lldb] Another build fix for 8b8070e23

This particular usage was guarded by !__linux__, so it broke everywhere
else. It should probably be replaced by something else.

2 years ago[CodeGen] Add PR50197 AArch64/ARM/X86 test coverage
Simon Pilgrim [Fri, 22 Oct 2021 13:22:33 +0000 (14:22 +0100)]
[CodeGen] Add PR50197 AArch64/ARM/X86 test coverage

Pre-commit for D111530

2 years ago[AMDGPU] Preserve deadness of vcc when shrinking instructions
Jay Foad [Fri, 22 Oct 2021 10:18:11 +0000 (11:18 +0100)]
[AMDGPU] Preserve deadness of vcc when shrinking instructions

This doesn't have any effect on codegen now, but it might do in the
future if we shrink instructions before post-RA scheduling, which is
sensitive to live vs dead defs.

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

2 years ago[mlir][OpenMP]Support for modifiers in workshare loops
Mats Petersson [Tue, 6 Apr 2021 10:20:49 +0000 (11:20 +0100)]
[mlir][OpenMP]Support for modifiers in workshare loops

Pass the modifiers from the Flang parser to FIR/MLIR workshare
loop operation.

Not yet supporting the SIMD modifier, which is a bit more work
than just adding it to the list of modifiers, so will go in a
separate patch.

This adds a new field to the WsLoopOp.

Also add test for dynamic WSLoop, checking that dynamic schedule calls
the init and next functions as expected.

Reviewed By: ftynse

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

2 years ago[DSE] Add test cases with more complex redundant stores.
Florian Hahn [Fri, 22 Oct 2021 12:50:32 +0000 (13:50 +0100)]
[DSE] Add test cases with more complex redundant stores.

This patch adds more complex test cases with redundant stores of an
existing memset, with other stores in between.

It also makes a few of the existing tests more robust.

2 years ago[lldb] [Utility/UriParser] Replace port==-1 with llvm::None
Michał Górny [Fri, 22 Oct 2021 12:00:07 +0000 (14:00 +0200)]
[lldb] [Utility/UriParser] Replace port==-1 with llvm::None

Use llvm::Optional<uint16_t> instead of int for port number
in UriParser::Parse(), and use llvm::None to indicate missing port
instead of a magic value of -1.

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

2 years ago[lldb] Fix build errors from 8b8070e23
Pavel Labath [Fri, 22 Oct 2021 12:28:52 +0000 (14:28 +0200)]
[lldb] Fix build errors from 8b8070e23

I missed windows and openbsd.

2 years ago[NFC] Re-harden test/Transforms/LoopVectorize/X86/pr48340.ll
Roman Lebedev [Fri, 22 Oct 2021 11:56:04 +0000 (14:56 +0300)]
[NFC] Re-harden test/Transforms/LoopVectorize/X86/pr48340.ll

This test is quite fragile WRT improvements to the interleaved load cost
modelling. Let's bump the stride way up so that is no longer a concern.

2 years agoRevert "[NFC][LV] Autogenerate check lines in a test for ease of future update"
Roman Lebedev [Fri, 22 Oct 2021 11:54:36 +0000 (14:54 +0300)]
Revert "[NFC][LV] Autogenerate check lines in a test for ease of future update"

This reverts commit 8ae83a1bafdfd726a657db43653195d35bda1179.

2 years agoAMDGPULibCalls - constify some FuncInfo& arguments. NFCI.
Simon Pilgrim [Fri, 22 Oct 2021 11:10:44 +0000 (12:10 +0100)]
AMDGPULibCalls - constify some FuncInfo& arguments. NFCI.

2 years ago[TTI] `BasicTTIImplBase::getInterleavedMemoryOpCost()`: fix load discounting
Roman Lebedev [Fri, 22 Oct 2021 11:04:38 +0000 (14:04 +0300)]
[TTI] `BasicTTIImplBase::getInterleavedMemoryOpCost()`: fix load discounting

The math here is:
Cost of 1 load = cost of n loads / n
Cost of live loads = num live loads * Cost of 1 load
Cost of live loads = num live loads * (cost of n loads / n)
Cost of live loads = cost of n loads * (num live loads / n)

But, all the variables here are integers,
and integer division rounds down,
but this calculation clearly expects float semantics.

Instead multiply upfront, and then perform round-up-division.

Reviewed By: RKSimon

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

2 years ago[NFC][LV] Autogenerate check lines in a test for ease of future update
Roman Lebedev [Fri, 22 Oct 2021 11:04:03 +0000 (14:04 +0300)]
[NFC][LV] Autogenerate check lines in a test for ease of future update

2 years agoHost::GetOSBuildString
Pavel Labath [Tue, 19 Oct 2021 14:00:31 +0000 (16:00 +0200)]
Host::GetOSBuildString

2 years agoMark baremetal.cpp test as unsupported on Windows.
Kristof Beyls [Fri, 22 Oct 2021 10:36:49 +0000 (11:36 +0100)]
Mark baremetal.cpp test as unsupported on Windows.

A new check was added in 3b93dc68, which seems to not be possible to get
working correctly on windows systems:

The test first "captures" the install directory of the clang toolchain
running the test as follows:
// CHECK-AARCH64-NO-HOST-INC: InstalledDir: [[INSTALLEDDIR:.+]]
Then, in a check line a bit later, it uses this to check if a particular
directory in the toolchain installation directory is included when
targeting aarch64-none-elf:
// CHECK-AARCH64-NO-HOST-INC-SAME: "-internal-isystem" "[[INSTALLEDDIR]]{{[/\\]+}}..{{[/\\]+}}lib{{[/\\]+}}clang-runtimes{{[/\\]+}}aarch64-none-elf{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"

Even though the test aims to take into account forward vs backward slash
differences between Windows and Unix paths, it still fails on Windows.

It seems that on Windows (this is based on the output log from a Windows
bot), the INSTALLEDDIR variable has the following value:

note: with "INSTALLEDDIR" equal to "c:\\\\b\\\\slave\\\\clang-x64-windows-msvc\\\\build\\\\stage1\\\\bin"

However the actual "InstalledDir:" output produced by the clang
toolchain on that Windows bot was:

InstalledDir: c:\b\slave\clang-x64-windows-msvc\build\stage1\bin

It is unclear where the explosion of backslashes happens. Maybe this is
a bug in FileCheck somewhere?
Anyway, marking this test as not supported on Windows to make the bots
green again.

2 years agoAMDGPULibCalls::parseFunctionName - use reference instead of pointer. NFCI.
Simon Pilgrim [Fri, 22 Oct 2021 10:45:12 +0000 (11:45 +0100)]
AMDGPULibCalls::parseFunctionName - use reference instead of pointer. NFCI.

parseFunctionName allowed a default null pointer, despite it being dereferenced immediately to be used as a reference and that all callers were taking the address of an existing reference.

Fixes static analyzer warning about potential dereferenced nulls

2 years ago[llvm] [ADT] Update llvm::Split() per Pavel Labath's suggestions
Michał Górny [Mon, 27 Sep 2021 10:22:31 +0000 (12:22 +0200)]
[llvm] [ADT] Update llvm::Split() per Pavel Labath's suggestions

Optimize the iterator comparison logic to compare Current.data()
pointers.  Use std::tie for assignments from std::pair.  Replace
the custom class with a function returning iterator_range.

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

2 years ago[LLVM-C]Add LLVMAddMetadataToInst, deprecated LLVMSetInstDebugLocation.
Florian Hahn [Fri, 22 Oct 2021 10:00:23 +0000 (11:00 +0100)]
[LLVM-C]Add LLVMAddMetadataToInst, deprecated LLVMSetInstDebugLocation.

IRBuilder has been updated to support preserving metdata in a more
general manner. This patch adds `LLVMAddMetadataToInst` and
deprecates `LLVMSetInstDebugLocation` in favor of the more
general function.

Reviewed By: aprantl

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

2 years ago[mlir][Vector] NFC - Extract rewrites related to insert/extract strided slice in...
Nicolas Vasilache [Fri, 22 Oct 2021 09:39:07 +0000 (09:39 +0000)]
[mlir][Vector] NFC - Extract rewrites related to insert/extract strided slice in a separate file.

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

2 years ago[analyzer][solver] Introduce reasoning for not equal to operator
Manas [Fri, 22 Oct 2021 09:47:27 +0000 (11:47 +0200)]
[analyzer][solver] Introduce reasoning for not equal to operator

Prior to this, the solver was only able to verify whether two symbols
are equal/unequal, only when constants were involved. This patch allows
the solver to work over ranges as well.

Reviewed By: steakhal, martong

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

Patch by: @manas (Manas Gupta)

2 years ago[RISCV] Fix missing cross-block VSETVLI insertion
Fraser Cormack [Thu, 21 Oct 2021 14:32:12 +0000 (15:32 +0100)]
[RISCV] Fix missing cross-block VSETVLI insertion

This patch fixes a codegen bug, the test for which was introduced in
D112223.

When merging VSETVLIInfo across blocks, if the 'exit' VSETVLIInfo
produced by a block is found to be compatible with the VSETVLIInfo
computed as the intersection of the 'exit' VSETVLIInfo produced by the
block's predecessors, that blocks' 'exit' info is discarded and the
intersected value is taken in its place.

However, we have one authority on what constitutes VSETVLIInfo
compatibility and we are using it in two different contexts.

Compatibility is used in one context to elide VSETVLIs between
straight-line vector instructions. But compatibility when evaluated
between two blocks' exit infos ignores any info produced *inside* each
respective block before the exit points. As such it does not guarantee
that a block will not produce a VSETVLI which is incompatible with the
'previous' block.

As such, we must ensure that any merging of VSETVLIInfo is performed
using some notion of "strict" compatibility. I've defined this as a full
vtype match, but this is perhaps too pessimistic. Given that test
coverage in this regard is lacking -- the only change is in the failing
test -- I think this is a good starting point.

Reviewed By: craig.topper

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

2 years agoFix baremetal.cpp test to handle windows paths.
Kristof Beyls [Fri, 22 Oct 2021 09:24:04 +0000 (10:24 +0100)]
Fix baremetal.cpp test to handle windows paths.

2 years ago[Analyzer] Extend ConstraintAssignor to handle remainder op
Gabor Marton [Thu, 23 Sep 2021 18:19:21 +0000 (20:19 +0200)]
[Analyzer] Extend ConstraintAssignor to handle remainder op

Summary:
`a % b != 0` implies that `a != 0` for any `a` and `b`. This patch
extends the ConstraintAssignor to do just that. In fact, we could do
something similar with division and in case of multiplications we could
have some other inferences, but I'd like to keep these for future
patches.

Fixes https://bugs.llvm.org/show_bug.cgi?id=51940

Reviewers: noq, vsavchenko, steakhal, szelethus, asdenyspetrov

Subscribers:

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

2 years ago[Analyzer][NFC] Add RangedConstraintManager to ConstraintAssignor
Gabor Marton [Mon, 11 Oct 2021 12:44:02 +0000 (14:44 +0200)]
[Analyzer][NFC] Add RangedConstraintManager to ConstraintAssignor

In this patch we store a reference to `RangedConstraintManager` in the
`ConstraintAssignor`. This way it is possible to call back and reuse some
functions of it. This patch is exclusively needed for its child patches,
it is not intended to be a standalone patch.

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

2 years ago[Analyzer][NFC] Move RangeConstraintManager's def before ConstraintAssignor's def
Gabor Marton [Fri, 24 Sep 2021 07:15:59 +0000 (09:15 +0200)]
[Analyzer][NFC] Move RangeConstraintManager's def before ConstraintAssignor's def

In this patch we simply move the definition of RangeConstraintManager before
the definition of ConstraintAssignor. This patch is exclusively needed for it's
child patch, so in the child the diff would be clean and the review would be
easier.

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

2 years ago[lldb] Remove ConstString from ABI, Architecture and Disassembler plugin names
Pavel Labath [Tue, 19 Oct 2021 11:09:38 +0000 (13:09 +0200)]
[lldb] Remove ConstString from ABI, Architecture and Disassembler plugin names

2 years ago[lldb] Fix TestCompressedVectors after array type name change
Raphael Isemann [Fri, 22 Oct 2021 08:07:58 +0000 (10:07 +0200)]
[lldb] Fix TestCompressedVectors after array type name change

aee49255074fd4ef38d97e6e70cbfbf2f9fd0fa7 turns array names such as `int [1]`
into `int[1]` (without the space). This probably breaks some user formatters,
but let's first get this test running while this is being discussed.

2 years ago[fir] Add utility function to FIRBuilder and MutableBox
Valentin Clement [Fri, 22 Oct 2021 07:59:44 +0000 (09:59 +0200)]
[fir] Add utility function to FIRBuilder and MutableBox

This patch is extracted from D111337 to make is smaller.
It introduce utility functions to the FIRBuilder and add the MutableBox
files.

- genShape
- readCharLen
- getExtents

Reviewed By: kiranchandramohan

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[clang][ASTImporter] Fix for importing functions with EST_Unevaluated prototype.
Balázs Kéri [Fri, 22 Oct 2021 06:43:46 +0000 (08:43 +0200)]
[clang][ASTImporter] Fix for importing functions with EST_Unevaluated prototype.

Fix for importing functions where the TypeSourceInfo is set and the
exception specification information contains reference to the function
declaration itself.

Reviewed By: martong, steakhal

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

2 years agoAdd basic aarch64-none-elf bare metal driver.
Kristof Beyls [Tue, 5 Oct 2021 08:24:10 +0000 (09:24 +0100)]
Add basic aarch64-none-elf bare metal driver.

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

2 years ago[PowerPC] iterate on the SmallSet directly; NFC
Chen Zheng [Fri, 22 Oct 2021 06:18:07 +0000 (06:18 +0000)]
[PowerPC] iterate on the SmallSet directly; NFC

2 years ago[PowerPC] return early if there is no preparing candidate in the loop; NFC
Chen Zheng [Fri, 22 Oct 2021 05:39:51 +0000 (05:39 +0000)]
[PowerPC] return early if there is no preparing candidate in the loop; NFC

This is to improve compiling time.

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

Reviewed By: jsji

2 years agoFix for OutputStream->OutputBuffer rename
David Blaikie [Fri, 22 Oct 2021 03:14:04 +0000 (20:14 -0700)]
Fix for OutputStream->OutputBuffer rename

2 years ago[Coroutines] Ignore partial lifetime markers refer of an alloca
Chuanqi Xu [Fri, 22 Oct 2021 01:49:04 +0000 (09:49 +0800)]
[Coroutines] Ignore partial lifetime markers refer of an alloca

When I playing with Coroutines, I found that it is possible to generate
following IR:
```
%struct = alloca ...
%sub.element = getelementptr %struct, i64 0, i64 index ; index is not
%zero
lifetime.marker.start(%sub.element)
% use of %sub.element
lifetime.marker.end(%sub.element)
store %struct to xxx ;  %struct is escaping!

<suspend points>
```

Then the AllocaUseVisitor would collect the lifetime marker for
sub.element and treat it as the lifetime markers of the alloca! So it
judges that the alloca could be put on the stack instead of the frame by
judging the lifetime markers only.
The root cause for the bug is that AllocaUseVisitor collects wrong
lifetime markers.

This patch fixes this.

Reviewed By: lxfind

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

2 years ago[gn build] Port 2e97236aacbb
LLVM GN Syncbot [Fri, 22 Oct 2021 01:36:03 +0000 (01:36 +0000)]
[gn build] Port 2e97236aacbb

2 years ago[libcxxabi] Fix build after D111947
Vitaly Buka [Fri, 22 Oct 2021 01:34:29 +0000 (18:34 -0700)]
[libcxxabi] Fix build after D111947

2 years ago[msan] Don't use TLS slots of noundef args
Vitaly Buka [Thu, 21 Oct 2021 03:59:28 +0000 (20:59 -0700)]
[msan] Don't use TLS slots of noundef args

Transformations may strip the attribute from the
argument, e.g. for unused, which will result in
shadow offsets mismatch between caller and
callee.

Stripping noundef for used arguments can be
a problem, as TLS is not going to be set
by caller. However this is not the goal of the
patch and I am not aware if that's even
possible.

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

2 years ago[AMDGPU] Allow to use a whole register file on gfx90a for VGPRs
Stanislav Mekhanoshin [Wed, 13 Oct 2021 22:47:07 +0000 (15:47 -0700)]
[AMDGPU] Allow to use a whole register file on gfx90a for VGPRs

In a kernel which does not have calls or AGPR usage we can allocate
the whole vector register budget for VGPRs and have no AGPRs as
long as VGPRs stay addressable (i.e. below 256).

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

2 years ago[mlir][linalg][bufferize] Support scf::IfOp
Matthias Springer [Fri, 22 Oct 2021 00:58:41 +0000 (09:58 +0900)]
[mlir][linalg][bufferize] Support scf::IfOp

This commit adds support for scf::IfOp to comprehensive bufferization. Support is currently limited to cases where both branches yield tensors that bufferize to the same buffer.

To keep the analysis simple, scf::IfOp are treated as memory writes for analysis purposes, even if no op inside any branch is writing. (scf::ForOps are handled in the same way.)

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

2 years ago[gn build] Make 'compiler-rt' depend on include dir
Nico Weber [Thu, 21 Oct 2021 17:33:47 +0000 (13:33 -0400)]
[gn build] Make 'compiler-rt' depend on include dir

That way, the headers in llvm/utils/gn/secondary/compiler-rt/include
are copied when running `ninja compiler-rt`. (Previously, they were
only copied when running `check-hwasan` or when building the
compiler-rt/include target.)

(Since they should be copied only once, depend on the target in the
host toolchain. I think default_toolchain should work just as well,
it just needs to be a single fixed toolchain. check-hwasan depends
through host_toolchain, so let's use that here too.)

Prevents errors like

    testing/fuzzed_data_provider.h:8:10: fatal error: 'fuzzer/FuzzedDataProvider.h' file not found

when building with locally-built clang. (For now, you still have to
explicitly build the 'compiler-rt' target. Maybe we should make the
clang target depend on that in the GN build?)

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

2 years ago[Demangle] Rename OutputStream to OutputString
Luís Ferreira [Fri, 22 Oct 2021 00:31:53 +0000 (17:31 -0700)]
[Demangle] Rename OutputStream to OutputString

This patch is a refactor to implement prepend afterwards. Since this changes a lot of files and to conform with guidelines, I will separate this from the implementation of prepend. Related to the discussion in https://reviews.llvm.org/D111414 , so please read it for more context.

Reviewed By: #libc_abi, dblaikie, ldionne

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

2 years ago[lldb] Include unistd.h for sleep in profile_vrs_detach
Jonas Devlieghere [Fri, 22 Oct 2021 00:32:02 +0000 (17:32 -0700)]
[lldb] Include unistd.h for sleep in profile_vrs_detach

2 years ago[DebugInfo] Expand ability to load 2-byte addresses in dwarf sections
Jack Anderson [Fri, 22 Oct 2021 00:29:34 +0000 (17:29 -0700)]
[DebugInfo] Expand ability to load 2-byte addresses in dwarf sections

Some dwarf loaders in LLVM are hard-coded to only accept 4-byte and 8-byte address sizes. This patch generalizes acceptance into `DWARFContext::isAddressSizeSupported` and provides a common way to generate rejection errors.

The MSP430 target has been given new tests to cover dwarf loading cases that previously failed due to 2-byte addresses.

Reviewed By: dblaikie

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

2 years ago[lldb] Always set the minimum OS version in the Darwin builder
Jonas Devlieghere [Thu, 21 Oct 2021 23:45:48 +0000 (16:45 -0700)]
[lldb] Always set the minimum OS version in the Darwin builder

2 years agocompiler-rt: Fix arch detection for ppc64le
Tom Stellard [Thu, 21 Oct 2021 23:11:41 +0000 (16:11 -0700)]
compiler-rt: Fix arch detection for ppc64le

Reviewed By: MaskRay

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

2 years ago[RISCV] Remove Zvamo C intrinsics and builtins.
Craig Topper [Thu, 21 Oct 2021 23:02:42 +0000 (16:02 -0700)]
[RISCV] Remove Zvamo C intrinsics and builtins.

Zvamo is not part of the 1.0 V spec. Remove the intrinsics
for now. This helps reduce clang binary size and lit test time.

Reviewed By: HsiangKai

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

2 years ago[docs] Remove Makefile.sphinx files
Tom Stellard [Thu, 21 Oct 2021 23:04:51 +0000 (16:04 -0700)]
[docs] Remove Makefile.sphinx files

Does anyone still use these?  I want to make some changes to the sphinx
html generation and I don't want to have to implement the changes in
two places.

Reviewed By: sylvestre.ledru, #libc, ldionne

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

2 years ago[TargetLowering] Simplify the interface for expandCTPOP/expandCTLZ/expandCTTZ.
Craig Topper [Thu, 21 Oct 2021 22:23:41 +0000 (15:23 -0700)]
[TargetLowering] Simplify the interface for expandCTPOP/expandCTLZ/expandCTTZ.

There is no need to return a bool and have an SDValue output
parameter. Just return the SDValue and let the caller check if it
is null.

I have another patch to add more callers of these so I thought
I'd clean up the interface first.

Reviewed By: RKSimon

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

2 years ago[fir] Remove unused function in CharacterTest
Valentin Clement [Thu, 21 Oct 2021 22:25:59 +0000 (00:25 +0200)]
[fir] Remove unused function in CharacterTest

2 years ago[LegalizeVectorOps][X86] Don't defer BITREVERSE expansion to LegalizeDAG.
Craig Topper [Thu, 21 Oct 2021 22:16:41 +0000 (15:16 -0700)]
[LegalizeVectorOps][X86] Don't defer BITREVERSE expansion to LegalizeDAG.

By expanding early it allows the shifts to be custom lowered in
LegalizeVectorOps. Then a DAG combine is able to run on them before
LegalizeDAG handles the BUILD_VECTORS for the masks used.

v16Xi8 shift lowering on X86 requires a mask to be applied to a v8i16
shift. The BITREVERSE expansion applied an AND mask before SHL ops and
after SRL ops. This was done to share the same mask constant for both shifts.
It looks like this patch allows DAG combine to remove the AND mask added
after v16i8 SHL by X86 lowering. This maintains the mask sharing that
BITREVERSE was trying to achieve. Prior to this patch it looks like
we kept the mask after the SHL instead which required an extra constant
pool or a PANDN to invert it.

This is dependent on D112248 because RISCV will end up scalarizing the BSWAP
portion of the BITREVERSE expansion if we don't disable BSWAP scalarization in
LegalizeVectorOps first.

Reviewed By: RKSimon

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

2 years ago[InstCombine] Precommit new and-xor-or.ll tests. NFC.
Stanislav Mekhanoshin [Thu, 21 Oct 2021 22:15:54 +0000 (15:15 -0700)]
[InstCombine] Precommit new and-xor-or.ll tests. NFC.

2 years ago[modules] Update visibility for merged ObjCInterfaceDecl definitions.
Volodymyr Sapsai [Fri, 24 Sep 2021 21:51:21 +0000 (14:51 -0700)]
[modules] Update visibility for merged ObjCInterfaceDecl definitions.

We keep using the first encountered definition and need to take into
account visibility from subsequent definitions. For example, if the
first definition is hidden and the second is visible, we need to make
the first one visible too.

rdar://82263843

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

2 years ago[libcxx] [test] Convert an XFAIL: LIBCXX-WINDOWS-FIXME into XFAIL: msvc with explanation
Martin Storsjö [Mon, 31 May 2021 09:32:21 +0000 (09:32 +0000)]
[libcxx] [test] Convert an XFAIL: LIBCXX-WINDOWS-FIXME into XFAIL: msvc with explanation

This test doesn't fail in mingw mode (which uses the same Itanium
name mangling and ABI as other platforms).

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

2 years agoPR18733: Remove -Wweak-template-vtables
David Blaikie [Sun, 25 Jul 2021 18:47:01 +0000 (11:47 -0700)]
PR18733: Remove -Wweak-template-vtables

It isn't really pulling its weight and I think splitting it out from
-Wweak-vtables was the wrong call: I think it was just a bug in the
original warning, which was trying to not diagnose template
instantiations, implicit or explicit.

2 years ago[MLIR] Fix FloorDivSIOpConverter that was failing for index type after the arithmetic...
Mogball [Thu, 21 Oct 2021 21:42:10 +0000 (21:42 +0000)]
[MLIR] Fix FloorDivSIOpConverter that was failing for index type after the arithmetic op refactor

ConstantOp should be used instead of ConstantIntOp to be able to support index type.

Reviewed By: Mogball

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

2 years agoMake genAttributeVerifier escape the summary.
Matthias Kramm [Thu, 21 Oct 2021 21:41:15 +0000 (21:41 +0000)]
Make genAttributeVerifier escape the summary.

The summary can contain references to e.g. attribute defaults, which
can contain special characters. So these strings need to be C++
escaped.

Reviewed By: Mogball

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

2 years agoRemove unused parallel-libs project
David Blaikie [Thu, 21 Oct 2021 20:40:29 +0000 (13:40 -0700)]
Remove unused parallel-libs project

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

2 years ago[TargetLowering][RISCV] Prevent scalarization of fixed vector bswap.
Craig Topper [Thu, 21 Oct 2021 21:31:43 +0000 (14:31 -0700)]
[TargetLowering][RISCV] Prevent scalarization of fixed vector bswap.

It's better to do the ands, shifts, ors in the vector domain than
to scalarize it and do those operations on each element.

Reviewed By: RKSimon

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

2 years agoFix escaping in RewriterGen.cpp.
Matthias Kramm [Thu, 21 Oct 2021 21:30:31 +0000 (21:30 +0000)]
Fix escaping in RewriterGen.cpp.

When we escape strings for C++, make sure we use C++ escape
sequences. (In particular, \x22 instead of \22)

Reviewed By: Mogball

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

2 years agoFix buildbots after https://reviews.llvm.org/D111686
Greg Clayton [Thu, 21 Oct 2021 21:21:36 +0000 (14:21 -0700)]
Fix buildbots after https://reviews.llvm.org/D111686

2 years ago[mlir][linalg] Remove special case for contraction vectorization
thomasraoux [Thu, 21 Oct 2021 21:05:27 +0000 (14:05 -0700)]
[mlir][linalg] Remove special case for contraction vectorization

Handle contraction op like all the other generic op reductions. This
simpifies the code. We now rely on contractionOp canonicalization to
keep the same code quality.

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

2 years ago[mlir][vector] Add patterns to convert multidimreduce to vector.contract
thomasraoux [Thu, 21 Oct 2021 20:20:52 +0000 (13:20 -0700)]
[mlir][vector] Add patterns to convert multidimreduce to vector.contract

add several patterns that will simplify contraction vectorization in the
future. With those canonicalizationns we will be able to remove the special
case for contration during vectorization and rely on those transformations to
avoid materizalizing broadcast ops.

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

2 years ago[AArch64][GlobalISel] Fold 64-bit cmps with 64-bit adds
Jessica Paquette [Mon, 4 Oct 2021 18:53:37 +0000 (11:53 -0700)]
[AArch64][GlobalISel] Fold 64-bit cmps with 64-bit adds

G_ICMP is selected to an arithmetic overflow op (ADDS/SUBS/etc) with a dead
destination + a CSINC instruction.

We have a fold which allows us to combine 32-bit adds with G_ICMP.

The problem with G_ICMP is that we model it as always having a 32-bit
destination even though it can be a 64-bit operation. So, we were missing some
opportunities for 64-bit folds.

This patch teaches the fold to recognize 64-bit G_ICMPs + refactors some of
the code surrounding CSINC accordingly.

(Later down the line, I think we should probably change the way we handle G_ICMP
in general.)

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

2 years ago[fir] Remove createConcatenate test temporarily
Valentin Clement [Thu, 21 Oct 2021 20:40:09 +0000 (22:40 +0200)]
[fir] Remove createConcatenate test temporarily

This test is makeing one buildbot fail for unknown reason. Remove
it until we can investifate further.

2 years ago[libcxx] [test] Add a specific XFAIL for a MinGW env failure that is fixed in Clang 14
Martin Storsjö [Fri, 1 Oct 2021 21:29:46 +0000 (00:29 +0300)]
[libcxx] [test] Add a specific XFAIL for a MinGW env failure that is fixed in Clang 14

This issue only occurs when linked statically in MinGW configurations,
and has been fixed for Clang 14 by https://reviews.llvm.org/D109651.

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

2 years ago[libcxx] [test] Add an XFAIL for the timespec test for MinGW targets
Martin Storsjö [Fri, 27 Aug 2021 10:12:53 +0000 (10:12 +0000)]
[libcxx] [test] Add an XFAIL for the timespec test for MinGW targets

MinGW headers/libs lack timespec_get.

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

2 years agoFollow-up fixes for aee49255074fd4ef38d97e6e70cbfbf2f9fd0fa7
David Blaikie [Thu, 21 Oct 2021 20:00:35 +0000 (13:00 -0700)]
Follow-up fixes for aee49255074fd4ef38d97e6e70cbfbf2f9fd0fa7

2 years agoAdd test to check we can instcombine after reassociate. NFC.
Stanislav Mekhanoshin [Thu, 21 Oct 2021 18:45:42 +0000 (11:45 -0700)]
Add test to check we can instcombine after reassociate. NFC.

The pattern became optimized after b92412fb286b.

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

2 years ago[gn build] Port d7b338537cf3
LLVM GN Syncbot [Thu, 21 Oct 2021 19:18:49 +0000 (19:18 +0000)]
[gn build] Port d7b338537cf3

2 years agoModify "statistics dump" to dump JSON.
Greg Clayton [Wed, 20 Oct 2021 21:49:09 +0000 (14:49 -0700)]
Modify "statistics dump" to dump JSON.

This patch is a smaller version of a previous patch https://reviews.llvm.org/D110804.

This patch modifies the output of "statistics dump" to be able to get stats from the current target. It adds 3 new stats as well. The output of "statistics dump" is now emitted as JSON so that it can be used to track performance and statistics and the output could be used to populate a database that tracks performance. Sample output looks like:

(lldb) statistics dump
{
  "expressionEvaluation": {
    "failures": 0,
    "successes": 0
  },
  "firstStopTime": 0.34164492800000001,
  "frameVariable": {
    "failures": 0,
    "successes": 0
  },
  "launchOrAttachTime": 0.31969605400000001,
  "targetCreateTime": 0.0040863039999999998
}

The top level keys are:

"expressionEvaluation" which replaces the previous stats that were emitted as plain text. This dictionary contains the success and fail counts.
"frameVariable" which replaces the previous stats for "frame variable" that were emitted as plain text. This dictionary contains the success and fail counts.
"targetCreateTime" contains the number of seconds it took to create the target and load dependent libraries (if they were enabled) and also will contain symbol preloading times if that setting is enabled.
"launchOrAttachTime" is the time it takes from when the launch/attach is initiated to when the first private stop occurs.
"firstStopTime" is the time in seconds that it takes to stop at the first stop that is presented to the user via the LLDB interface. This value will only have meaning if you set a known breakpoint or stop location in your code that you want to measure as a performance test.

This diff is also meant as a place to discuess what we want out of the "statistics dump" command before adding more funcionality. It is also meant to clean up the previous code that was storting statistics in a vector of numbers within the lldb_private::Target class.

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

2 years agoBPF: emit BTF_KIND_DECL_TAG for typedef types
Yonghong Song [Tue, 21 Sep 2021 06:35:58 +0000 (23:35 -0700)]
BPF: emit BTF_KIND_DECL_TAG for typedef types

If a typedef type has __attribute__((btf_decl_tag("str"))) with
bpf target, emit BTF_KIND_DECL_TAG for that type in the BTF.

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

2 years ago[modules] Fix tracking ObjCInterfaceType decl when there are multiple definitions.
Volodymyr Sapsai [Fri, 24 Sep 2021 20:57:23 +0000 (13:57 -0700)]
[modules] Fix tracking ObjCInterfaceType decl when there are multiple definitions.

With the old approach we were updating `ObjCInterfaceType.Decl` to the
last encountered definition. But during loading modules
`ASTDeclReader::VisitObjCInterfaceDecl` keeps the *first* encountered
definition. So with multiple definitions imported there would be a
disagreement between expected definition in `ObjCInterfaceType.Decl` and
actual definition `ObjCInterfaceDecl::getDefinition` which can lead to
incorrect diagnostic.

Fix by not tracking definition in `ObjCInterfaceType` explicitly but by
getting it from redeclaration chain.

Partially reverted 919fc50034b44c48aae8b80283f253ec2ee17f45 keeping the
modified test case as the correct behavior is achieved in a different
way.

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

2 years ago[OpenMP][NFC] skip atomic tests for non-x86 arch
AndreyChurbanov [Thu, 21 Oct 2021 18:51:33 +0000 (21:51 +0300)]
[OpenMP][NFC] skip atomic tests for non-x86 arch

2 years ago[InstCombine] Add additional store forwarding test (NFC)
Nikita Popov [Thu, 21 Oct 2021 18:47:13 +0000 (20:47 +0200)]
[InstCombine] Add additional store forwarding test (NFC)

Variant where the load is larger than the store. Make sure we
don't forward this.

2 years ago[test] Make sure plugin actually runs in clear-ast-before-backend-plugins.c
Arthur Eubanks [Thu, 21 Oct 2021 18:14:29 +0000 (11:14 -0700)]
[test] Make sure plugin actually runs in clear-ast-before-backend-plugins.c

Reviewed By: dblaikie

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

2 years agoEnable libc++ in the build for libcxx initializerlist pretty printers
David Blaikie [Wed, 20 Oct 2021 18:05:40 +0000 (11:05 -0700)]
Enable libc++ in the build for libcxx initializerlist pretty printers

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

2 years agoRecommit: Compress formatting of array type names (int [4] -> int[4])
David Blaikie [Thu, 14 Oct 2021 21:52:47 +0000 (14:52 -0700)]
Recommit: Compress formatting of array type names (int [4] -> int[4])

Based on post-commit review discussion on
2bd84938470bf2e337801faafb8a67710f46429d with Richard Smith.

Other uses of forcing HasEmptyPlaceHolder to false seem OK to me -
they're all around pointer/reference types where the pointer/reference
token will appear at the rightmost side of the left side of the type
name, so they make nested types (eg: the "int" in "int *") behave as
though there is a non-empty placeholder (because the "*" is essentially
the placeholder as far as the "int" is concerned).

This was originally committed in 277623f4d5a672d707390e2c3eaf30a9eb4b075c

Reverted in f9ad1d1c775a8e264bebc15d75e0c6e5c20eefc7 due to breakages
outside of clang - lldb seems to have some strange/strong dependence on
"char [N]" versus "char[N]" when printing strings (not due to that name
appearing in DWARF, but probably due to using clang to stringify type
names) that'll need to be addressed, plus a few other odds and ends in
other subprojects (clang-tools-extra, compiler-rt, etc).

2 years ago[Triple] Don't repeat the function name in comments. NFC
Fangrui Song [Thu, 21 Oct 2021 18:32:29 +0000 (11:32 -0700)]
[Triple] Don't repeat the function name in comments. NFC

2 years ago[CodeMetrics] Don't require speculatability for ephemeral values
Nikita Popov [Tue, 19 Oct 2021 19:05:09 +0000 (21:05 +0200)]
[CodeMetrics] Don't require speculatability for ephemeral values

As discussed in D112016, our current requirement of speculatability
for ephemeral is overly strict: What we really care about is that
the instruction will be DCEd once the assume is dropped. For that
it is sufficient that the instruction is side-effect free and not
a terminator.

In particular, this allows non-dereferenceable loads to be ephemeral
values.

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

2 years agoFollow-up on https://github.com/llvm/llvm-project/commit/88303693ce97cf842f0714068c2c...
Kirill Bobyrev [Thu, 21 Oct 2021 18:13:37 +0000 (20:13 +0200)]
Follow-up on https://github.com/llvm/llvm-project/commit/88303693ce97cf842f0714068c2cae44cd6515e1

Use hash code instead of unsigned for the hash return value.