platform/upstream/llvm.git
2 years ago[sanitizer] Improve FreeBSD ASLR detection
Ed Maste [Mon, 17 Jan 2022 22:36:45 +0000 (17:36 -0500)]
[sanitizer] Improve FreeBSD ASLR detection

The kern.elf64.aslr.pie_enable and kern.elf32.aslr.pie_enable sysctls
control the default setting for PIE binary address randomization, but
it is possible to enable or disable ASLR on a per-process basis.  So,
use procctl(2) to query whether ASLR is enabled.

(Note that with ASLR enabled but sysctl kern.elf64.aslr.pie_enable=0
a PIE binary will in effect have randomization disabled, and would be
functional with msan.  This is not intended as as a user-facing control
though; proccontrol(1) should be used to disable aslr for the process.)

Reviewed By: devnexen

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

2 years agoGlobalISel: Fix legalization error where CSE leaves behind dead defs
Matt Arsenault [Fri, 7 Jan 2022 22:44:23 +0000 (17:44 -0500)]
GlobalISel: Fix legalization error where CSE leaves behind dead defs

If the conversion artifact introduced in the unmerge of cast of merge
combine already existed in the function, this would introduce dead
copies which kept the old casts around, neither of which were deleted,
and would fail legalization.

This would fail as follows:

The G_UNMERGE_VALUES of the G_SEXT of the G_BUILD_VECTOR would
introduce a G_SEXT for each of the scalars.

Some of the required G_SEXTs already existed in the function, so CSE
moves them up in the function and introduces a copy to the original
result register.

The introduced CSE copies are dead, since the originally G_SEXTs were
already directly used. These copies add a use to the illegal G_SEXTs,
so they are not deleted.

The artifact combiner does not see the defs that need to be updated,
since it was hidden inside the CSE builder.

I see 2 potential fixes, and opted for the mechanically simpler one,
which is to just not insert the cast if the result operand isn't
used. Alternatively, we could not insert the cast directly into the
result register, and use replaceRegOrBuildCopy similar to the case
where there is no conversion.

I suspect this is a wider problem in the artifact combiner.

2 years agoAllows deferred location attribute in `parseOptionalLocationSpecifier`
Mehdi Amini [Tue, 18 Jan 2022 20:55:35 +0000 (20:55 +0000)]
Allows deferred location attribute in `parseOptionalLocationSpecifier`

Before this patch, deferred location in operation like `test.pretty_printed_region` would
break the parser, and so the IR round-trip.

Depends On D117088

Reviewed By: rriddle

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

2 years agoAdding gitattributes for split-file tests
Chris Bieneman [Tue, 18 Jan 2022 21:37:10 +0000 (15:37 -0600)]
Adding gitattributes for split-file tests

This change gets the split-file tests passing on Windows when
autocrlf=true.

2 years ago[clang][dataflow] Add a test to justify skipping past references in UO_Deref
Stanislav Gatev [Tue, 18 Jan 2022 15:51:57 +0000 (15:51 +0000)]
[clang][dataflow] Add a test to justify skipping past references in UO_Deref

This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.

Reviewed-by: xazax.hun
Differential Revision: https://reviews.llvm.org/D117567

2 years ago[BOLT][NFC] Delimit bytes in MCAnnotation bitmask
Amir Ayupov [Fri, 30 Jul 2021 00:29:32 +0000 (17:29 -0700)]
[BOLT][NFC] Delimit bytes in MCAnnotation bitmask

Summary: Show individual bytes in the annotation mask.

Test Plan: ninja llvm-bolt

Reviewers: maksfb

FBD30026393

2 years ago[BOLT][NFC] Move Offset annotation to Group 1
Amir Ayupov [Wed, 4 Aug 2021 00:53:32 +0000 (17:53 -0700)]
[BOLT][NFC] Move Offset annotation to Group 1

Summary:
Move the annotation to avoid dynamic memory allocations.
Improves the CPU time of instrumenting a large binary by 1% (+-0.8%, p-value 0.01)

Test Plan: NFC

Reviewers: maksfb

FBD30091656

2 years ago[Sema] Add test for new errors due to 09f8315bba391
Sam McCall [Tue, 18 Jan 2022 20:57:26 +0000 (21:57 +0100)]
[Sema] Add test for new errors due to 09f8315bba391

Knowing the type of more dependent expressions means we can diagnose
more errors at template parsing rather than instantiation time.

Such templates are IFNDR, so this is a QoI improvement.
I hadn't anticipated this in the original patch, so had no test.

2 years ago[DAG] Extend SearchForAndLoads with any_extend handling
David Green [Tue, 18 Jan 2022 21:03:08 +0000 (21:03 +0000)]
[DAG] Extend SearchForAndLoads with any_extend handling

This extends the code in SearchForAndLoads to be able to look through
ANY_EXTEND nodes, which can be created from mismatching IR types where
the AND node we begin from only demands the low parts of the register.
That turns zext and sext into any_extends as only the low bits are
demanded. To be able to look through ANY_EXTEND nodes we need to handle
mismatching types in a few places, potentially truncating the mask to
the size of the final load.

Recommitted with a more conservative check for the type of the extend.

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

2 years agoA readonly operand bundle should not prevent inference of readonly from a readnone...
Philip Reames [Tue, 18 Jan 2022 20:38:28 +0000 (12:38 -0800)]
A readonly operand bundle should not prevent inference of readonly from a readnone callee

A readonly operand bundle disallows inference of readnone from the callee, but it should not prevent us from using the readnone fact on the callee to infer readonly for the callsite.

Fixes pr53270.

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

2 years agoUse Opaque location for handling deferred references to aliases internally to the...
Mehdi Amini [Tue, 18 Jan 2022 20:43:19 +0000 (20:43 +0000)]
Use Opaque location for handling deferred references to aliases internally to the parser (NFC)

This will allow to return to the client of `parseLocationInstance` a location that is resolved later.

Reviewed By: rriddle

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

2 years agoHandle whitespace in symbol list
Chris Bieneman [Tue, 18 Jan 2022 17:06:26 +0000 (11:06 -0600)]
Handle whitespace in symbol list

Trimming whitespace or carriage returns from symbols allows this code
to work on Windows and makes it match other places symbol lists are
handled.

Reviewed By: MaskRay

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

2 years agoFix incorrect inference of writeonly despite reading operand bundle
Philip Reames [Tue, 18 Jan 2022 20:08:40 +0000 (12:08 -0800)]
Fix incorrect inference of writeonly despite reading operand bundle

If we have a writeonly function called from a callsite with a potentially reading operand bundle, we can not conclude the callsite is writeonly.

The changed test is the only one I've been able to demonstrate a current miscompile on, but an incorrect result here could show up in a bunch of subtle ways.  For instance, this issue caused several spurious test changes when combined with D117591.

2 years ago[polly][cmake] Use `GNUInstallDirs` to support custom installation dirs
John Ericson [Tue, 18 Jan 2022 07:05:47 +0000 (07:05 +0000)]
[polly][cmake] Use `GNUInstallDirs` to support custom installation dirs

I am breaking apart D99484 so the cause of build failures is easier to
understand.

Reviewed By: Meinersbur

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

2 years ago[lld][WebAssembly] Reinstate mistakenly disabled test. NFC
Sam Clegg [Tue, 18 Jan 2022 19:43:27 +0000 (11:43 -0800)]
[lld][WebAssembly] Reinstate mistakenly disabled test. NFC

It seems the first half of this test was disabled in error
as part of https://reviews.llvm.org/D93066.

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

2 years agoA better profi rebalancer
spupyrev [Mon, 10 Jan 2022 21:33:55 +0000 (13:33 -0800)]
A better profi rebalancer

This is an extension of **profi** post-processing step that rebalances counts
in CFGs that have basic blocks w/o probes (aka "unknown" blocks). Specifically,
the new version finds many more "unknown" subgraphs and marks more "unknown"
basic blocks as hot (which prevents unwanted optimization passes).

I see up to 0.5% perf on some (large) binaries, e.g., clang-10 and gcc-8.

The algorithm is still linear and yields no build time overhead.

2 years ago[clang-tidy] Make `readability-container-data-pointer` more robust
Fabian Wolff [Tue, 18 Jan 2022 18:19:23 +0000 (19:19 +0100)]
[clang-tidy] Make `readability-container-data-pointer` more robust

Fixes PR#52245. I've also added a few test cases beyond PR#52245 that would also fail with the current implementation, which is quite brittle in many respects (e.g. it uses the `hasDescendant()` matcher to find the container that is being accessed, which is very easy to trick, as in the example in PR#52245).

I have not been able to reproduce the second issue mentioned in PR#52245 (namely that using the `data()` member function is suggested even for containers that don't have it), but I've added a test case for it to be sure.

Reviewed By: aaron.ballman

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

2 years ago[tests] Add coverage of writeonly attribute and operand bundle intersection
Philip Reames [Tue, 18 Jan 2022 20:08:02 +0000 (12:08 -0800)]
[tests] Add coverage of writeonly attribute and operand bundle intersection

2 years agoAutogen a test for ease of update
Philip Reames [Tue, 18 Jan 2022 19:46:43 +0000 (11:46 -0800)]
Autogen a test for ease of update

2 years ago[RISCV] Remove special case for constant shift amount in FSHL/FSHR lowering to FSL...
Craig Topper [Tue, 18 Jan 2022 19:42:25 +0000 (11:42 -0800)]
[RISCV] Remove special case for constant shift amount in FSHL/FSHR lowering to FSL/FSR.

Remove fshl/fshr with constant shift amount isel patterns. Replace
with fsr/fsl with constant isel patterns.

This hack was trying to preserve as much optimization opportunity
for fshl/fshr by constant as possible, but the conversion to
RISCVISD::FSR/FSL happens so late it probably isn't worth much.

The new isel patterns are needed by D117468 anyway.

2 years agoRevert "[Libomptarget] Fix external visibility for internal variables"
Joseph Huber [Tue, 18 Jan 2022 19:43:49 +0000 (14:43 -0500)]
Revert "[Libomptarget] Fix external visibility for internal variables"

Reverting to investigate break on AMDGPU. This reverts commit
0203ff19602d9d90e03653062dbb19cc13afa956.

2 years agoRevert "[OpenMP] Remove hidden visibility for declare target variables"
Joseph Huber [Tue, 18 Jan 2022 19:43:36 +0000 (14:43 -0500)]
Revert "[OpenMP] Remove hidden visibility for declare target variables"

Reverting to investigate break on AMDPGU.  This reverts commit
d081bfcd17c1c704776a0964d239f19f6acde93d.

2 years ago[libcxx][test] `unordered_meow` iterators are not portably non-bidi
Casey Carter [Wed, 29 Dec 2021 22:28:58 +0000 (14:28 -0800)]
[libcxx][test] `unordered_meow` iterators are not portably non-bidi

MSVCSTL's are actually bidirectional.

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

2 years agoupdateDWARFObjectAddressRanges: nullify low pc
Vladislav Khmelevsky [Thu, 16 Dec 2021 15:59:01 +0000 (18:59 +0300)]
updateDWARFObjectAddressRanges: nullify low pc

In case the case the DW_AT_ranges tag already exists for the object the
low pc values won't be updated and will be incorrect in
after-bolt binaries.

Vladislav Khmelevsky,
Advanced Software Technology Lab, Huawei

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

2 years ago[libcxx][test] compiler options are non-portable
Casey Carter [Wed, 29 Dec 2021 23:25:53 +0000 (15:25 -0800)]
[libcxx][test] compiler options are non-portable

... it's easier to suppress warnings internally, where we can detect the compiler.

* Rename `TEST_COMPILER_C1XX` to `TEST_COMPILER_MSVC`
* Rename all `TEST_WORKAROUND_C1XX_<meow>` to `TEST_WORKAROUND_MSVC_<meow>`

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

2 years agoFix build break introduced by D115847
Mircea Trofin [Tue, 18 Jan 2022 19:33:26 +0000 (11:33 -0800)]
Fix build break introduced by D115847

Because CoroEarly is also run, the `coroutine.presplit` attr should be
0.

2 years ago[libc++][NFC] Use _LIBCPP_DEBUG_ASSERT in <unordered_map>
Nikolas Klauser [Sat, 15 Jan 2022 18:41:33 +0000 (19:41 +0100)]
[libc++][NFC] Use _LIBCPP_DEBUG_ASSERT in <unordered_map>

Use `_LIBCPP_DEBUG_ASSERT` in <unordered_map>

Reviewed By: ldionne, Mordante, #libc

Spies: libcxx-commits

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

2 years ago[libc++][test] test in_in_result convertible requirements
Nikolas Klauser [Mon, 17 Jan 2022 23:18:39 +0000 (00:18 +0100)]
[libc++][test] test in_in_result convertible requirements

Currently it is not checked that operator in_in_result<II1, II2>() SFINAEs away properly

Reviewed By: ldionne, #libc

Spies: libcxx-commits

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

2 years ago[flang] Support substring references in NAMELIST input
Peter Klausler [Fri, 7 Jan 2022 21:39:28 +0000 (13:39 -0800)]
[flang] Support substring references in NAMELIST input

Implements substring references into potentially partial CHARACTER
scalars and array elements in NAMELIST input.

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

2 years ago[libc++] Use reserved identifier for template parameter
Alex Brachet [Tue, 18 Jan 2022 19:15:18 +0000 (19:15 +0000)]
[libc++] Use reserved identifier for template parameter

`T` is not a valid identifier for libc++ to use, use `_Tp` instead. Caught from D116957

Reviewed By: Quuxplusone

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

2 years ago[BOLT][TEST] Update exceptions-instrumentation.test
Amir Aupov [Tue, 18 Jan 2022 19:16:36 +0000 (11:16 -0800)]
[BOLT][TEST] Update exceptions-instrumentation.test

Matching an exact byte offset is fragile if a different version of compiler
is used (e.g. distro clang).
Resolves an issue with running with BOLT_CLANG_EXE + clang-12

Reviewed By: maksfb

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

2 years ago[InstrProf][NFC] Add InstrProfInstBase base
Ellis Hoag [Tue, 18 Jan 2022 18:38:58 +0000 (10:38 -0800)]
[InstrProf][NFC] Add InstrProfInstBase base

The `InstrProfInstBase` class is for all `llvm.instrprof.*` intrinsics. In a
later diff we will add new instrinsic of this type. Also refactor some
logic in `InstrProfiling.cpp`.

Reviewed By: davidxl

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

2 years agoAMDGPU: Remove llvm.amdgcn.alignbit and handle bitcode upgrade to fshr
Matt Arsenault [Sat, 15 Jan 2022 19:37:34 +0000 (14:37 -0500)]
AMDGPU: Remove llvm.amdgcn.alignbit and handle bitcode upgrade to fshr

2 years ago[NFC] Test commit.
Adrian Tong [Tue, 18 Jan 2022 13:37:57 +0000 (13:37 +0000)]
[NFC] Test commit.

This is just a test commit to check whether I got commit permission.

2 years agoRecommit "[RISCV] Make the operand order for RISCVISD::FSL(W)/FSR(W) match the instru...
Craig Topper [Tue, 18 Jan 2022 18:46:16 +0000 (10:46 -0800)]
Recommit "[RISCV] Make the operand order for RISCVISD::FSL(W)/FSR(W) match the instruction register numbering."

This reverts the revert commit e32838573929ac85fc4df3058593798d10ce4cd2.

Accidental demanded bits change has been removed. The demanded bits
code itself was remove in a pre-commit since it isn't tested.

Original commit message:
Previous we used the fshl/fshr operand ordering for simplicity. This
made things confusing when D117468 proposed adding intrinsics for
the instructions. We can't just use the generic funnel shifting
intrinsics because fsl/fsr have different functionality that should
be exposed to software.

Now we use rs1, rs3, rs2/shamt order which matches the instruction
printing order and the order used in this intrinsic header
https://github.com/riscv/riscv-bitmanip/blob/main-history/cproofs/rvintrin.h

2 years ago[RISCV] Remove DemandedBits handling for FSR/FSL until we have test cases for it.
Craig Topper [Tue, 18 Jan 2022 18:42:47 +0000 (10:42 -0800)]
[RISCV] Remove DemandedBits handling for FSR/FSL until we have test cases for it.

Testing may be easier after D117468. Right now we get demanded bits
optimizations done on ISD::FSHL/FSHR before they become FSR/FSL. This
makes it hard to test.

2 years agoAMDGPU: Avoid enabling kernel workitem IDs with reqd_work_group_size
Matt Arsenault [Mon, 10 Jan 2022 02:21:14 +0000 (21:21 -0500)]
AMDGPU: Avoid enabling kernel workitem IDs with reqd_work_group_size

2 years agoPostRAPseudos: Don't preserve kills on some implicit copy operands
Matt Arsenault [Wed, 12 Jan 2022 01:15:47 +0000 (20:15 -0500)]
PostRAPseudos: Don't preserve kills on some implicit copy operands

This fixes a verifier error I ran into at -O0. A subregister copy had
an implicit kill of an overlapping superregister, which was partially
redefined by the copy. The preserved implicit operand killed
subregisters made live earlier in the sequence. AMDGPU already uses
similar logic for whether to preserve the kill of the superregister on
the final instruction if there's overlap.

2 years agoMark ATOMIC_VAR_INIT and ATOMIC_FLAG_INIT as deprecated
Aaron Ballman [Tue, 18 Jan 2022 18:40:47 +0000 (13:40 -0500)]
Mark ATOMIC_VAR_INIT and ATOMIC_FLAG_INIT as deprecated

C17 deprecated ATOMIC_VAR_INIT with the resolution of DR 485. C++
followed suit when adopting P0883R2 for C++20, but additionally chose
to deprecate ATOMIC_FLAG_INIT at the same time despite the macro still
being required in C. This patch marks both macros as deprecated when
appropriate to do so.

2 years agoRevert "[RISCV] Make the operand order for RISCVISD::FSL(W)/FSR(W) match the instruct...
Craig Topper [Tue, 18 Jan 2022 18:29:37 +0000 (10:29 -0800)]
Revert "[RISCV] Make the operand order for RISCVISD::FSL(W)/FSR(W) match the instruction register numbering."

This reverts commit b634f8a663d56877663f5224a785d9f0263c4176.

I broke the SimplifyDemandedBits code, but we don't have tests.

2 years ago[mlir:Analysis] Move the LoopAnalysis library to Dialect/Affine/Analysis
River Riddle [Sat, 15 Jan 2022 07:34:09 +0000 (23:34 -0800)]
[mlir:Analysis] Move the LoopAnalysis library to Dialect/Affine/Analysis

The current state of the top level Analysis/ directory is that it contains two libraries;
a generic Analysis library (free from dialect dependencies), and a LoopAnalysis library
that contains various analysis utilities that originated from Affine loop transformations.
This commit moves the LoopAnalysis to the more appropriate home of `Dialect/Affine/Analysis/`,
given the use and intention of the majority of the code within it. After the move, if there
are generic utilities that would fit better in the top-level Analysis/ directory, we can move
them.

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

2 years ago[libc++] Adds a test for std::fill_n.
Mark de Wever [Sat, 15 Jan 2022 12:48:54 +0000 (13:48 +0100)]
[libc++] Adds a test for std::fill_n.

The function `std::fill` requires a ForwardIterator, but `std::fill_n`
only requires an OutputIterator. Adds a test to validate `std::fill_n`
works with an OutputIterator.

Noticed this while working on LWG3539
format_to must not copy models of output_iterator<const charT&>

Reviewed By: #libc, Quuxplusone, ldionne

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

2 years agoAdd test showing missed opt from pr53270
Philip Reames [Tue, 18 Jan 2022 18:19:14 +0000 (10:19 -0800)]
Add test showing missed opt from pr53270

2 years ago[NFC] Set gitattributes for line endings
Chris Bieneman [Tue, 18 Jan 2022 17:01:36 +0000 (11:01 -0600)]
[NFC] Set gitattributes for line endings

A clean checkout of LLVM using core.autocrlf=on for Windows cannot pass
the LLVM test suite because several test input files rely on specific
line endings.

This change updates the line ending attributes for impacted tests and
re-normalizes a CRLF test case that was committed as LF to the git
index.

2 years ago[libc++] [test] Use hidden friends consistently in the test iterators.
Arthur O'Dwyer [Wed, 5 Jan 2022 20:17:06 +0000 (15:17 -0500)]
[libc++] [test] Use hidden friends consistently in the test iterators.

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

2 years ago[Libomptarget] Fix external visibility for internal variables
Joseph Huber [Tue, 18 Jan 2022 00:55:03 +0000 (19:55 -0500)]
[Libomptarget] Fix external visibility for internal variables

After the changes in D117362 made variables declared inside of a target
declare directive visible outside the plugin, some variables inside the
runtime were given visiblity that conflicted with their address space
type. This caused problems when shared or local memory was made
externally visible. This patch fixes this issue by making these
varialbes static within the module, therefore limiting their visibility
to being internal.

Reviewed By: jdoerfert

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

2 years ago[OpenMP] Remove hidden visibility for declare target variables
Joseph Huber [Fri, 14 Jan 2022 22:21:46 +0000 (17:21 -0500)]
[OpenMP] Remove hidden visibility for declare target variables

This patch changes the visiblity of variables declared within a declare
target directive. Variable declarations within a declare target
directive need to be externally visible to the plugin for initialization
or reading. Previously this would cause runtime errors where the named
global could not be found because it was not included in the symbol
table.

Reviewed By: jdoerfert

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

2 years ago[OpenMP] Mark device RTL variables as hidden
Joseph Huber [Fri, 14 Jan 2022 15:31:01 +0000 (10:31 -0500)]
[OpenMP] Mark device RTL variables as hidden

This patch changes the visibility of the `__omp_rtl_debug_kind` variable
to be hidden. These variables are only used by the plugin so they do not
need to be read externally. Previously the default visibility prevented
these variables from being completely eliminated in the module.

Reviewed By: tianshilei1992

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

2 years ago[RISCV] Make the operand order for RISCVISD::FSL(W)/FSR(W) match the instruction...
Craig Topper [Tue, 18 Jan 2022 17:26:28 +0000 (09:26 -0800)]
[RISCV] Make the operand order for RISCVISD::FSL(W)/FSR(W) match the instruction register numbering.

Previous we used the fshl/fshr operand ordering for simplicity. This
made things confusing when D117468 proposed adding intrinsics for
the instructions. We can't just use the generic funnel shifting
intrinsics because fsl/fsr have different functionality that should
be exposed to software.

Now we use rs1, rs3, rs2/shamt order which matches the instruction
printing order and the order used in this intrinsic header
https://github.com/riscv/riscv-bitmanip/blob/main-history/cproofs/rvintrin.h

2 years ago[mlgo][inline] Improve global state tracking
Mircea Trofin [Thu, 13 Jan 2022 00:56:24 +0000 (00:56 +0000)]
[mlgo][inline] Improve global state tracking

The global state refers to the number of the nodes currently in the
module, and the number of direct calls between nodes, across the
module.

Node counts are not a problem; edge counts are because we want strictly
the kind of edges that affect inlining (direct calls), and that is not
easily obtainable without iteration over the whole module.

This patch avoids relying on analysis invalidation because it turned out
to be too aggressive in some cases. It leverages the fact that Node
objects are stable - they do not get deleted while cgscc passes are
run over the module; and cgscc pass manager invariants.

Reviewed By: aeubanks

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

2 years ago[VP] Propagate align parameter attr on VP gather/scatter to ISel
Fraser Cormack [Fri, 19 Nov 2021 21:06:35 +0000 (21:06 +0000)]
[VP] Propagate align parameter attr on VP gather/scatter to ISel

This patch fixes a case where the 'align' parameter attribute on the
pointer operands to llvm.vp.gather and llvm.vp.scatter was being dropped
during the conversion to the SelectionDAG. The default alignment equal
to the ABI type alignment of the vector type was kept. It also updates
the documentation to reflect the fact that the parameter attribute is
now properly supported.

The default alignment of these intrinsics was previously documented as
being equal to the ABI alignment of the *scalar* type, when in fact that
wasn't the case: the ABI alignment of the vector type was used instead.
This has also been fixed in this patch.

Reviewed By: simoll, craig.topper

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

2 years ago[AMDGPU][NFC] Add DWARF extension support for SIMD execution
Tony Tye [Sat, 8 Jan 2022 18:48:14 +0000 (18:48 +0000)]
[AMDGPU][NFC] Add DWARF extension support for SIMD execution

- Add current iteration to the context of a DWARF expression evaluation.
- Add DW_AT_LLVM_iterations attribute to specify the number of
  iterations executing concurrently.
- Add DF_OP_LLVM_push_iteration to support optimizations that result in
  multiple iterations executing concurrently.
- Add DW_OP_LLVM_overlay and DW_OP_LLVM_bit_overlay to support
  expressing the location of arrays that are promoted to vector
  registers in SIMD vectorized loops.
- Generally clarify the difference between SIMT and SIMD execution.
- Change the DW_AT_LLVM_active_lane attribute to take location
  description expression so that a loclist can be used to express
  different vales at different program locations.

Reviewed By: scott.linder

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

2 years ago[mlir] NFC fix a typo in assembly format
Mogball [Tue, 18 Jan 2022 17:36:09 +0000 (17:36 +0000)]
[mlir] NFC fix a typo in assembly format

2 years ago[gn build] Port df51be85e4ae
LLVM GN Syncbot [Tue, 18 Jan 2022 17:28:57 +0000 (17:28 +0000)]
[gn build] Port df51be85e4ae

2 years ago[libc++] Refactor stride_counting_iterator
Louis Dionne [Tue, 18 Jan 2022 15:34:32 +0000 (10:34 -0500)]
[libc++] Refactor stride_counting_iterator

Instead of storing the wrapped iterator inside the stride_counting_iterator,
store its base so we can have e.g. a stride_counting_iterator of an
input_iterator (which was previously impossible because input_iterators
are not copyable). Also a few other simplifications in stride_counting_iterator.

As a fly-by fix, remove the member base() functions, which are super
confusing.

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

2 years ago[libc++] Split a few utilities out of __threading_support
Louis Dionne [Mon, 10 Jan 2022 14:43:29 +0000 (09:43 -0500)]
[libc++] Split a few utilities out of __threading_support

This change is the basis for a further refactoring where I'm going to
split up the various implementations we have in __threading_support to
make that code easier to understand.

Note that I had to make __convert_to_timespec a template to break
circular dependencies. Concretely, we never seem to use it with anything
other than ::timespec, but I am wary of hardcoding that assumption as
part of this change, since I suspect there's a reason for going through
these hoops in the first place.

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

2 years ago[llvm] Remove uses of `std::vector<bool>`
Jan Svoboda [Tue, 18 Jan 2022 17:01:24 +0000 (18:01 +0100)]
[llvm] Remove uses of `std::vector<bool>`

LLVM Programmer’s Manual strongly discourages the use of `std::vector<bool>` and suggests `llvm::BitVector` as a possible replacement.

This patch does just that for llvm.

Reviewed By: dexonsmith

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

2 years ago[mlir] Replace StrEnumAttr -> EnumAttr in core dialects
Mogball [Tue, 18 Jan 2022 16:53:55 +0000 (16:53 +0000)]
[mlir] Replace StrEnumAttr -> EnumAttr in core dialects

Removes uses of `StrEnumAttr` in core dialects

Reviewed By: mehdi_amini, rriddle

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

2 years ago[SDAG] remove duplicate functionality when getting shift type for demanded bits;...
Sanjay Patel [Tue, 18 Jan 2022 16:07:17 +0000 (11:07 -0500)]
[SDAG] remove duplicate functionality when getting shift type for demanded bits; NFCI

This was noted as a potential cleanup in D117508.
getShiftAmountTy() has checks for vector, phase, etc. so it should
handle anything that the caller was trying to account for.

2 years ago[InstCombine] reduce code duplication; NFC
Sanjay Patel [Tue, 18 Jan 2022 16:02:12 +0000 (11:02 -0500)]
[InstCombine] reduce code duplication; NFC

2 years ago[InstCombine] add tests for fsub with fmul/fdiv operand; NFC
Sanjay Patel [Tue, 18 Jan 2022 14:13:03 +0000 (09:13 -0500)]
[InstCombine] add tests for fsub with fmul/fdiv operand; NFC

2 years ago[AIX] Support of Big archive (read)
zhijian [Mon, 17 Jan 2022 15:37:08 +0000 (10:37 -0500)]
[AIX] Support of Big archive (read)

Summary:

The patch is based on the EGuesnet's implement of the "Support of Big archive (read)
the first commit of the patch is come from https://reviews.llvm.org/D100651.

the rest of commits of the patch

1  Addressed the comments on the https://reviews.llvm.org/D100651
2  according to https://www.ibm.com/docs/en/aix/7.2?topic=formats-ar-file-format-big
using the "fl_fstmoff" for the first object file number, using "char ar_nxtmem[20]" to get next object file ,
using the "char fl_lstmoff[20]" for the last of the object file will fix the following problems:
   2.1 can not correct reading a archive files which has padding data between too object file
   2.2 can not correct reading a archive files from which some object file has be deleted

3 introduce a new derived class BigArchive for big ar file.

Reviewers: James Henderson
Differential Revision: https://reviews.llvm.org/D111889

2 years agoFix pair construction with an implicit constructor inside.
Tres Popp [Tue, 18 Jan 2022 17:00:47 +0000 (18:00 +0100)]
Fix pair construction with an implicit constructor inside.

2 years ago[clangd][clang-tidy] Remove uses of `std::vector<bool>`
Jan Svoboda [Tue, 18 Jan 2022 16:58:57 +0000 (17:58 +0100)]
[clangd][clang-tidy] Remove uses of `std::vector<bool>`

LLVM Programmer’s Manual strongly discourages the use of `std::vector<bool>` and suggests `llvm::BitVector` as a possible replacement.

This patch does just that for clangd and clang-tidy.

Reviewed By: dexonsmith

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

2 years agoFix a failed assertion on an invalid typename requirement
Aaron Ballman [Tue, 18 Jan 2022 16:57:59 +0000 (11:57 -0500)]
Fix a failed assertion on an invalid typename requirement

The parsing code for a typename requirement currently asserts when
given something which is not a valid type-requirement
(http://eel.is/c++draft/expr.prim.req.type#nt:type-requirement). This
removes the assertion to continue on to the proper diagnostic.

This resolves PR53057.

Note that in that PR, it is using _BitInt(N) as a dependent type name.
This patch does not attempt to support that as it is not clear that is
a valid type requirement (it does not match the grammar production for
one). The workaround in the PR, however, is definitely valid and works
as expected.

2 years ago[mlir] Drop the leading space when printing regions
Mogball [Tue, 18 Jan 2022 07:47:25 +0000 (07:47 +0000)]
[mlir] Drop the leading space when printing regions

The leading space that is always printed at the beginning of regions is not consistent with other parts of the printing API. Moreover, this leading space can lead to undesirable assembly formats:

```
attr-dict-with-keyword $region
```

Prints as:

```
// Two spaces between `}` and `{`
attributes {foo}  { ... }
```

Moreover, the leading space results in the odd generic op format:

```
"test.op"() ( {...}) : () -> ()
```

Reviewed By: rriddle, mehdi_amini

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

2 years agoRevert "[MemCpyOpt] Make capture check during call slot optimization more precise"
Hans Wennborg [Tue, 18 Jan 2022 16:30:27 +0000 (17:30 +0100)]
Revert "[MemCpyOpt] Make capture check during call slot optimization more precise"

This casued a miscompile due to call slot optimization replacing a call
argument without considering the call's !noalias metadata, see discussion on
the code review.

> Call slot optimization is currently supposed to be prevented if
> the call can capture the source pointer. Due to an implementation
> bug, this check currently doesn't trigger if a bitcast of the source
> pointer is passed instead. I'm somewhat afraid of the fallout of
> fixing this bug (due to heavy reliance on call slot optimization
> in rust), so I'd like to strengthen the capture reasoning a bit first.
>
> In particular, I believe that the capture is fine as long as a)
> the call itself cannot depend on the pointer identity, because
> neither dest has been captured before/at nor src before the
> call and b) there is no potential use of the captured pointer
> before the lifetime of the source alloca ends, either due to
> lifetime.end or a return from a function. At that point the
> potentially captured pointer becomes dangling.
>
> Differential Revision: https://reviews.llvm.org/D115615

Also reverting the dependent commit:

> [MemCpyOpt] Look through pointer casts when checking capture
>
> The user scanning loop above looks through pointer casts, so we
> also need to strip pointer casts in the capture check. Previously
> the source was incorrectly considered not captured if a bitcast
> was passed to the call.

This reverts commit 487a34ed9d7d24a7b1fb388c8856c784a459b22b
and 00e6869463ae6023d0d48f30de8511d6d748b14f.

2 years ago[clang-tidy] Force LF newlines when writing files
Richard [Mon, 3 Jan 2022 17:52:59 +0000 (10:52 -0700)]
[clang-tidy] Force LF newlines when writing files

The recommendation on Windows is to checkout from git with
core.autolf=false in order to preserve LF line endings on
test files.  However, when creating a new check this results
in modified files as having switched all the line endings on
Windows.  Write all files with explicit LF line endings to
prevent this.

Fixes #52968

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

2 years ago[JITLink][ELF] Support duplicated section names from object file
Steven Wu [Tue, 18 Jan 2022 16:38:15 +0000 (08:38 -0800)]
[JITLink][ELF] Support duplicated section names from object file

ELF object files can contain duplicated sections (thus section symbols
as well), espeically when comdats/section groups are present. This patch
adds support for generating LinkGraph from object files that have
duplicated section names. This is the first step to properly model
comdats/section groups.

Reviewed By: lhames

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

2 years ago[ADT] Fix Optional<> with llvm::is_trivially_move_constructible
Steven Wu [Tue, 18 Jan 2022 16:37:22 +0000 (08:37 -0800)]
[ADT] Fix Optional<> with llvm::is_trivially_move_constructible

Fix the compatibility of Optional<> with some GCC versions that it will fail
to compile when T is getting checked for `is_trivially_move_constructible`
as mentioned here: https://reviews.llvm.org/D93510#2538983

Fix the problem by using `llvm::is_trivially_move_constructible`.

Reviewed By: jplayer-nv, tatyana-krasnukha

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

2 years agoAMDGPU/GlobalISel: Regenerate base test checks
Matt Arsenault [Tue, 18 Jan 2022 15:59:27 +0000 (10:59 -0500)]
AMDGPU/GlobalISel: Regenerate base test checks

2 years ago[DebugInstrRef] Add some missing const qualifiers (NFC)
Nikita Popov [Tue, 18 Jan 2022 16:17:40 +0000 (17:17 +0100)]
[DebugInstrRef] Add some missing const qualifiers (NFC)

2 years ago[OpenMP] Add use of TPAUSE
Terry Wilmarth [Tue, 14 Dec 2021 21:04:55 +0000 (15:04 -0600)]
[OpenMP] Add use of TPAUSE

Add use of TPAUSE (from WAITPKG) to the runtime for Intel hardware,
with an envirable to turn it on in a particular C-state.  Always uses
TPAUSE if it is selected and enabled by Intel hardware and presence of
WAITPKG, and if not, falls back to old way of checking
__kmp_use_yield, etc.

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

2 years ago[mlir] handle nested regions in llvm-legalize-for-export
Alex Zinenko [Tue, 18 Jan 2022 09:16:19 +0000 (10:16 +0100)]
[mlir] handle nested regions in llvm-legalize-for-export

The translation from the MLIR LLVM dialect to LLVM IR includes a mechanism that
ensures the successors of a block to be different blocks in case block
arguments are passed to them since the opposite cannot be expressed in LLVM IR.
This mechanism previously only worked for functions because it was written
prior to the introduction of other region-carrying operations such as the
OpenMP dialect, which also translates directly to LLVM IR. Modify this
mechanism to handle all regions in the module and not only functions.

Reviewed By: wsmoses

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

2 years agoRevert "[mlir] fix crash in PybindAdaptors.h"
Alex Zinenko [Tue, 18 Jan 2022 16:05:29 +0000 (17:05 +0100)]
Revert "[mlir] fix crash in PybindAdaptors.h"

This reverts commit 289021a45decdef8ed61d054b9c90ce775ca9c96.

2 years ago[DebugInstrRef] Use DenseMap for ValueToLoc (NFC)
Nikita Popov [Tue, 18 Jan 2022 15:12:17 +0000 (16:12 +0100)]
[DebugInstrRef] Use DenseMap for ValueToLoc (NFC)

Just replacing std::map with DenseMap here is a major regression
-- because this code used an identity hash for ValueIDNum.
Because ValueIDNum is composed of multiple components, it is
important that we use a reasonably good hash function here, so
switch it to hash_value. DenseMapInfo::getHashValue<uint64_t>
would not be sufficient.

This gives a -0.8% geomean improvement on CTMark ReleaseLTO-g.

2 years ago[libc++] Persistently cache memoized operations during Lit configuration
Louis Dionne [Tue, 9 Nov 2021 14:08:08 +0000 (09:08 -0500)]
[libc++] Persistently cache memoized operations during Lit configuration

When invoking Lit repeatedly, we perform all the configuration checks
over and over again, which takes a lot of time. This patch allows caching
the result of configuration checks persistently across Lit invocations to
speed this up.

In theory, this should still be functionally correct since the cache
key should contain everything that determines the output of the
configuration check. However, in cases where e.g. the compiler has
changed but is at the same path as previously, the Lit configuration
checks will be cached even though technically the cache should have
been invalidated.

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

2 years ago[X86] getTargetShuffleInputs - ensure we limit the maximum recursion depth to match...
Simon Pilgrim [Tue, 18 Jan 2022 15:25:08 +0000 (15:25 +0000)]
[X86] getTargetShuffleInputs - ensure we limit the maximum recursion depth to match SelectionDAG::MaxRecursionDepth

Regressions were pre-handled by rG62e36b120749

Fixes Issue #52960

2 years ago[clang][dataflow] Remove obsolete FIXME
Stanislav Gatev [Tue, 18 Jan 2022 15:04:09 +0000 (15:04 +0000)]
[clang][dataflow] Remove obsolete FIXME

The FIXME is no longer relevant as ControlFlowContext centralizes the
construction of the CFG.

This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.

Reviewed-by: xazax.hun
Differential Revision: https://reviews.llvm.org/D117563

2 years ago[X86] canLowerByDroppingEvenElements - generalize to drop even or odd elements
Simon Pilgrim [Tue, 18 Jan 2022 14:58:39 +0000 (14:58 +0000)]
[X86] canLowerByDroppingEvenElements - generalize to drop even or odd elements

This allows us to match shuffle<1,3,5,7,9,11,13,15> style shift+trunc/pack patterns as well as the existing shuffle<0,2,4,6,8,10,12,14> style shuffle trunc/pack patterns

In the future, interleaving patterns might benefit from an even more general implementation for higher strides

2 years ago[analyzer][NFC] Refactor GenericTaintChecker to use CallDescriptionMap
Endre Fülöp [Wed, 12 Jan 2022 08:06:27 +0000 (09:06 +0100)]
[analyzer][NFC] Refactor GenericTaintChecker to use CallDescriptionMap

GenericTaintChecker now uses CallDescriptionMap to describe the possible
operation in code which trigger the introduction (sources), the removal
(filters), the passing along (propagations) and detection (sinks) of
tainted values.

Reviewed By: steakhal, NoQ

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

2 years ago[clang][lex] NFC: Simplify calls to `LookupFile`
Jan Svoboda [Tue, 18 Jan 2022 14:44:24 +0000 (15:44 +0100)]
[clang][lex] NFC: Simplify calls to `LookupFile`

The `{HeaderSearch,Preprocessor}::LookupFile()` functions take an out-parameter `const DirectoryLookup *&`. Most callers end up creating a `const DirectoryLookup *` variable that's otherwise unused.

This patch changes the out-parameter from reference to a pointer, making it possible to simply pass `nullptr` to the function without the ceremony.

Reviewed By: ahoppen

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

2 years ago[clang] NFC: Remove unused `DirectoryLookup`
Jan Svoboda [Tue, 18 Jan 2022 14:13:49 +0000 (15:13 +0100)]
[clang] NFC: Remove unused `DirectoryLookup`

This patch removes bitrotten/dead uses of `DirectoryLookup` in `InclusionRewriter.cpp`.

Reviewed By: ahoppen

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

2 years ago[MachineSink] Allow sinking of constant or ignorable physreg uses
Vang Thao [Tue, 18 Jan 2022 13:53:41 +0000 (13:53 +0000)]
[MachineSink] Allow sinking of constant or ignorable physreg uses

For AMDGPU, any use of the physical register EXEC prevents sinking even if it is not a real physical register read. Add check to see if a physical
register use can be ignored for sinking.

Also perform same constant and ignorable physical register check when considering sinking in loops.

https://reviews.llvm.org/D116053

2 years ago[Driver] Pass the flag -dI to cc1 invocation
Qichao Gu [Tue, 18 Jan 2022 14:15:13 +0000 (06:15 -0800)]
[Driver] Pass the flag -dI to cc1 invocation

Hook up the flag -dI in the driver to pass it to cc1 invocation.

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

2 years ago[analyzer] Produce SymbolCast symbols for integral types in SValBuilder::evalCast
Denys Petrov [Fri, 2 Jul 2021 13:04:07 +0000 (16:04 +0300)]
[analyzer] Produce SymbolCast symbols for integral types in SValBuilder::evalCast

Summary: Produce SymbolCast for integral types in `evalCast` function. Apply several simplification techniques while producing the symbols. Added a boolean option `handle-integral-cast-for-ranges` under `-analyzer-config` flag. Disabled the feature by default.

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

2 years ago[lldb] Delete TestStopReplyContainsThreadPcs
Pavel Labath [Tue, 18 Jan 2022 13:04:05 +0000 (14:04 +0100)]
[lldb] Delete TestStopReplyContainsThreadPcs

This was meant to be a replacement for the lldb-server sub-test suite of
the API tests, but it never got off the ground and it's making the
windows bot flaky.

Deleting it does not reduce test coverage as the original api test is
still around.

2 years agoRevert "[AArch64] Revive optimize add/sub with immediate through MIPeepholeOpt"
Florian Hahn [Tue, 18 Jan 2022 12:58:50 +0000 (12:58 +0000)]
Revert "[AArch64] Revive optimize add/sub with immediate through MIPeepholeOpt"

This reverts commit e6698f09929a134bf0f46d9347142b86d8f636a2.

This commit appears to introduce new machine verifier failures when
building the llvm-test-suite with `-mllvm -verify-machineinstrs` enabled:

https://green.lab.llvm.org/green/job/test-suite-verify-machineinstrs-aarch64-O3/11061/

FAILED: MultiSource/Benchmarks/Olden/health/CMakeFiles/health.dir/health.c.o
/Users/buildslave/jenkins/workspace/test-suite-verify-machineinstrs-aarch64-O3/test-suite-build/tools/timeit --summary MultiSource/Benchmarks/Olden/health/CMakeFiles/health.dir/health.c.o.time /Users/buildslave/jenkins/workspace/test-suite-verify-machineinstrs-aarch64-O3/compiler/bin/clang -DNDEBUG  -B /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin    -Wno-unused-command-line-argument -mllvm -verify-machineinstrs -O3 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk   -w -Werror=date-time -DTORONTO -MD -MT MultiSource/Benchmarks/Olden/health/CMakeFiles/health.dir/health.c.o -MF MultiSource/Benchmarks/Olden/health/CMakeFiles/health.dir/health.c.o.d -o MultiSource/Benchmarks/Olden/health/CMakeFiles/health.dir/health.c.o   -c /Users/buildslave/jenkins/workspace/test-suite-verify-machineinstrs-aarch64-O3/test-suite/MultiSource/Benchmarks/Olden/health/health.c
*** Bad machine code: Illegal virtual register for instruction ***
- function:    alloc_tree
- basic block: %bb.1 if.else (0x7fc0db8f8bb0)
- instruction: %31:gpr64 = nsw MADDXrrr killed %39:gpr64sp, killed %25:gpr64, $xzr
- operand 1:   killed %39:gpr64sp
Expected a GPR64 register, but got a GPR64sp register
fatal error: error in backend: Found 1 machine code errors.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /Users/buildslave/jenkins/workspace/test-suite-verify-machineinstrs-aarch64-O3/compiler/bin/clang -DNDEBUG -B /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin -Wno-unused-command-line-argument -mllvm -verify-machineinstrs -O3 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk -w -Werror=date-time -DTORONTO -MD -MT MultiSource/Benchmarks/Olden/health/CMakeFiles/health.dir/health.c.o -MF MultiSource/Benchmarks/Olden/health/CMakeFiles/health.dir/health.c.o.d -o MultiSource/Benchmarks/Olden/health/CMakeFiles/health.dir/health.c.o -c /Users/buildslave/jenkins/workspace/test-suite-verify-machineinstrs-aarch64-O3/test-suite/MultiSource/Benchmarks/Olden/health/health.c
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module '/Users/buildslave/jenkins/workspace/test-suite-verify-machineinstrs-aarch64-O3/test-suite/MultiSource/Benchmarks/Olden/health/health.c'.
4. Running pass 'Verify generated machine code' on function '@alloc_tree'
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  clang         0x000000011191896b llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 43
1  clang         0x00000001119179b5 llvm::sys::RunSignalHandlers() + 85
2  clang         0x00000001119180e2 llvm::sys::CleanupOnSignal(unsigned long) + 210
3  clang         0x0000000111849f6a (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) + 106
4  clang         0x0000000111849ee8 llvm::CrashRecoveryContext::HandleExit(int) + 24
5  clang         0x0000000111914acc llvm::sys::Process::Exit(int, bool) + 44
6  clang         0x000000010f4e9be9 LLVMErrorHandler(void*, char const*, bool) + 89
7  clang         0x0000000114eba333 llvm::report_fatal_error(llvm::Twine const&, bool) + 323
8  clang         0x0000000110d8c620 (anonymous namespace)::MachineVerifier::BBInfo::~BBInfo() + 0
9  clang         0x0000000110cdddca llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 378
10 clang         0x00000001110b0154 llvm::FPPassManager::runOnFunction(llvm::Function&) + 1092
11 clang         0x00000001110b6268 llvm::FPPassManager::runOnModule(llvm::Module&) + 72
12 clang         0x00000001110b074a llvm::legacy::PassManagerImpl::run(llvm::Module&) + 986
13 clang         0x0000000111c20ad4 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, std::__1::unique_ptr<llvm::raw_pwrite_stream, std::__1::default_delete<llvm::raw_pwrite_stream> >) + 3764
14 clang         0x0000000111f6dd31 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 1905
15 clang         0x00000001131a28b3 clang::ParseAST(clang::Sema&, bool, bool) + 643
16 clang         0x00000001122b02a4 clang::FrontendAction::Execute() + 84
17 clang         0x000000011222d6a9 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 873
18 clang         0x000000011232faf5 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 661
19 clang         0x000000010f4e9860 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 2544
20 clang         0x000000010f4e7168 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) + 312
21 clang         0x00000001120ab187 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, bool*) const::$_1>(long) + 23
22 clang         0x0000000111849eb4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) + 228
23 clang         0x00000001120aac24 clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, bool*) const + 324
24 clang         0x000000011207b85d clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const + 221
25 clang         0x000000011207bdad clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*> >&) const + 125
26 clang         0x0000000112092f7c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*> >&) + 204
27 clang         0x000000010f4e6977 main + 10375
28 libdyld.dylib 0x00007fff6be90cc9 start + 1
29 libdyld.dylib 0x0000000000000018 start + 18446603338705728336
clang-14: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 14.0.0 (https://github.com/llvm/llvm-project.git c90d136be4e055f1b409f38706d0fe3e2211af08)
Target: arm64-apple-darwin19.5.0
Thread model: posix
InstalledDir: /Users/buildslave/jenkins/workspace/test-suite-verify-machineinstrs-aarch64-O3/compiler/bin
clang-14: note: diagnostic msg:
********************

2 years ago[X86][SSE] Add some additional shuffle tests for mask/shift + packus/packss style...
Simon Pilgrim [Tue, 18 Jan 2022 12:50:41 +0000 (12:50 +0000)]
[X86][SSE] Add some additional shuffle tests for mask/shift + packus/packss style patterns

2 years ago[InstCombine] Simplify addends reordering logic
Daniil Kovalev [Tue, 18 Jan 2022 12:48:33 +0000 (15:48 +0300)]
[InstCombine] Simplify addends reordering logic

Previously some constants were not pushed to the top of the resulting
expression tree as intended by the algorithm. We can remove the logic
from simplifyFAdd and rely on SimplifyAssociativeOrCommutative to do
that.

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

2 years agoTableGen: sort SearchableTable emission order by fields, not top-level name
Tim Northover [Tue, 2 Nov 2021 10:42:27 +0000 (10:42 +0000)]
TableGen: sort SearchableTable emission order by fields, not top-level name

This is often used for anonymous definitions, so we were sorting by
"anonymous_1234" record names, which while less bad than pointers can be easily
perturbed by adding code even in completely unrelated systems. That causes test
failures on AArch64 when sysregs with multiple valid names suddenly start
printing a different one.

2 years agoRevert "[AIX] Support of Big archive (read)"
Florian Hahn [Tue, 18 Jan 2022 12:41:45 +0000 (12:41 +0000)]
Revert "[AIX] Support of Big archive (read)"

This appears to be causing the following build failures on green
dragon during stage2 builds on macOS:

 /System/Volumes/Data/jenkins/workspace/apple-clang-stage2-configure-RA_osceola/clang.roots/BuildRecords/clang-9999.99_install/Objects/obj-llvm/./bin/clang++ -fno-stack-protector -fno-common -Wno-profile-instr-unprofiled -Wno-unknown-warning-option -Werror=unguarded-availability-new -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -fmodules -fmodules-cache-path=/System/Volumes/Data/jenkins/workspace/apple-clang-stage2-configure-RA_osceola/clang.roots/BuildRecords/clang-9999.99_install/Objects/obj-llvm/tools/clang/stage2-bins/module.cache -fcxx-modules -Xclang -fmodules-local-submodule-visibility -gmodules -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-class-memaccess -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -fdiagnostics-color -O2 -gline-tables-only -DNDEBUG -arch x86_64 -arch arm64 -arch arm64e -isysroot /Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk -mmacosx-version-min=10.10 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -Wl,-dead_strip tools/llvm-cov/CMakeFiles/llvm-cov.dir/llvm-cov.cpp.o tools/llvm-cov/CMakeFiles/llvm-cov.dir/gcov.cpp.o tools/llvm-cov/CMakeFiles/llvm-cov.dir/CodeCoverage.cpp.o tools/llvm-cov/CMakeFiles/llvm-cov.dir/CoverageExporterJson.cpp.o tools/llvm-cov/CMakeFiles/llvm-cov.dir/CoverageExporterLcov.cpp.o tools/llvm-cov/CMakeFiles/llvm-cov.dir/CoverageFilters.cpp.o tools/llvm-cov/CMakeFiles/llvm-cov.dir/CoverageReport.cpp.o tools/llvm-cov/CMakeFiles/llvm-cov.dir/CoverageSummaryInfo.cpp.o tools/llvm-cov/CMakeFiles/llvm-cov.dir/SourceCoverageView.cpp.o tools/llvm-cov/CMakeFiles/llvm-cov.dir/SourceCoverageViewHTML.cpp.o tools/llvm-cov/CMakeFiles/llvm-cov.dir/SourceCoverageViewText.cpp.o tools/llvm-cov/CMakeFiles/llvm-cov.dir/TestingSupport.cpp.o -o bin/llvm-cov  -Wl,-rpath,@loader_path/../lib  lib/libLLVMCore.a  lib/libLLVMSupport.a  lib/libLLVMObject.a  lib/libLLVMCoverage.a  lib/libLLVMProfileData.a  lib/libLLVMDebugInfoDWARF.a  lib/libLLVMObject.a  lib/libLLVMBitReader.a  lib/libLLVMCore.a  lib/libLLVMRemarks.a  lib/libLLVMBitstreamReader.a  lib/libLLVMMCParser.a  lib/libLLVMTextAPI.a  lib/libLLVMMC.a  lib/libLLVMBinaryFormat.a  lib/libLLVMDebugInfoCodeView.a  lib/libLLVMSupport.a  -lm  /Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/usr/lib/libz.tbd  /Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/usr/lib/libcurses.tbd  lib/libLLVMDemangle.a && cd /System/Volumes/Data/jenkins/workspace/apple-clang-stage2-configure-RA_osceola/clang.roots/BuildRecords/clang-9999.99_install/Objects/obj-llvm/tools/clang/stage2-bins/tools/llvm-cov && xcrun dsymutil -o=llvm-cov.dSYM /System/Volumes/Data/jenkins/workspace/apple-clang-stage2-configure-RA_osceola/clang.roots/BuildRecords/clang-9999.99_install/Objects/obj-llvm/tools/clang/stage2-bins/bin/llvm-cov
Undefined symbols for architecture x86_64:
  "llvm::object::CommonArchiveMemberHeader<llvm::object::BigArMemHdrType>::getRawAccessMode() const", referenced from:
      vtable for llvm::object::BigArchiveMemberHeader in libLLVMObject.a(Archive.cpp.o)
  "llvm::object::CommonArchiveMemberHeader<llvm::object::BigArMemHdrType>::getRawUID() const", referenced from:
      vtable for llvm::object::BigArchiveMemberHeader in libLLVMObject.a(Archive.cpp.o)
  "llvm::object::CommonArchiveMemberHeader<llvm::object::BigArMemHdrType>::getRawGID() const", referenced from:
      vtable for llvm::object::BigArchiveMemberHeader in libLLVMObject.a(Archive.cpp.o)
  "llvm::object::CommonArchiveMemberHeader<llvm::object::UnixArMemHdrType>::getRawAccessMode() const", referenced from:
      vtable for llvm::object::ArchiveMemberHeader in libLLVMObject.a(Archive.cpp.o)
  "llvm::object::CommonArchiveMemberHeader<llvm::object::UnixArMemHdrType>::getRawLastModified() const", referenced from:
      vtable for llvm::object::ArchiveMemberHeader in libLLVMObject.a(Archive.cpp.o)
  "llvm::object::CommonArchiveMemberHeader<llvm::object::BigArMemHdrType>::getRawLastModified() const", referenced from:
      vtable for llvm::object::BigArchiveMemberHeader in libLLVMObject.a(Archive.cpp.o)
  "llvm::object::CommonArchiveMemberHeader<llvm::object::BigArMemHdrType>::getOffset() const", referenced from:
      vtable for llvm::object::BigArchiveMemberHeader in libLLVMObject.a(Archive.cpp.o)
  "llvm::object::CommonArchiveMemberHeader<llvm::object::UnixArMemHdrType>::getRawUID() const", referenced from:
      vtable for llvm::object::ArchiveMemberHeader in libLLVMObject.a(Archive.cpp.o)
  "llvm::object::CommonArchiveMemberHeader<llvm::object::UnixArMemHdrType>::getRawGID() const", referenced from:
      vtable for llvm::object::ArchiveMemberHeader in libLLVMObject.a(Archive.cpp.o)
  "llvm::object::CommonArchiveMemberHeader<llvm::object::UnixArMemHdrType>::getOffset() const", referenced from:
      vtable for llvm::object::ArchiveMemberHeader in libLLVMObject.a(Archive.cpp.o)
ld: symbol(s) not found for architecture x86_64

https://smooshbase.apple.com/ci/job/apple-clang-stage2-configure-RA_osceola/30276/console

2 years ago[LoopVectorize][AArch64] Use get.active.lane.mask intrinsic when SVE is enabled
David Sherwood [Mon, 6 Dec 2021 16:02:30 +0000 (16:02 +0000)]
[LoopVectorize][AArch64] Use get.active.lane.mask intrinsic when SVE is enabled

When SVE is enabled for AArch64 targets it makes more sense to use the
get.active.lane.mask intrinsic, because SVE has an exact 1-1 mapping
from the intrinsic to the 'whilelo' instruction for legal vector types.
This instruction neatly takes overflow into account as well. This patch
fixes an issue in VPInstruction::generateInstruction that assumed we are
only dealing with fixed-width vectors.

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

2 years ago[clang][dataflow] Add transfer function for addrof
Stanislav Gatev [Mon, 17 Jan 2022 16:23:24 +0000 (16:23 +0000)]
[clang][dataflow] Add transfer function for addrof

This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.

Reviewed-by: xazax.hun
Differential Revision: https://reviews.llvm.org/D117496

2 years ago[AttrBuilder] Add string attribute getter (NFC)
Nikita Popov [Tue, 18 Jan 2022 11:12:22 +0000 (12:12 +0100)]
[AttrBuilder] Add string attribute getter (NFC)

This avoids the need to scan through td_attrs() in AutoUpgrade,
decoupling it from AttrBuilder implementation details.

2 years ago[VE] VECustomDAG builder class
Simon Moll [Tue, 18 Jan 2022 10:32:19 +0000 (11:32 +0100)]
[VE] VECustomDAG builder class

VECustomDAG's functions simplify emitting VE custom ISD nodes. The class
is just a stub now. We add more functions, in particular for the
VP->VVP->VE lowering, to VECustomDAG as we build up vector isel.

Reviewed By: kaz7

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

2 years ago[VE] vp_select+vectorBinOp passthru isel and tests
Simon Moll [Tue, 18 Jan 2022 09:29:22 +0000 (10:29 +0100)]
[VE] vp_select+vectorBinOp passthru isel and tests

Extend the VE binaryop vector isel patterns to use passthru when the
result of a SDNode is used in a vector select or merge.

Reviewed By: kaz7

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

2 years ago[LVI] Handle implication from icmp of trunc (PR51867)
Nikita Popov [Tue, 18 Jan 2022 09:54:06 +0000 (10:54 +0100)]
[LVI] Handle implication from icmp of trunc (PR51867)

Similar to the existing urem code, if we have (trunc X) >= C,
then also X >= C.

Proof: https://alive2.llvm.org/ce/z/RF4YR2

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

2 years ago[LegalizeTypes][VP] Add widening support for vp.reduce.*
Victor Perez [Tue, 18 Jan 2022 09:30:31 +0000 (09:30 +0000)]
[LegalizeTypes][VP] Add widening support for vp.reduce.*

When widening these intrinsics, we do not have to insert neutral
elements at the end of the vector as when widening vector.reduce.*
intrinsics, thanks to vector predication semantics.

Reviewed By: craig.topper

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

2 years ago[CVP] Add tests for icmp of trunc implication (NFC)
Nikita Popov [Tue, 18 Jan 2022 10:07:48 +0000 (11:07 +0100)]
[CVP] Add tests for icmp of trunc implication (NFC)