Joseph Huber [Mon, 31 Jan 2022 21:46:00 +0000 (16:46 -0500)]
[OpenMP] Remove hard-coded triple in new driver test
Summary:
Previously this test used a hard-coded triple value in the check lines
wihch failed on other architectures. This patch changes that to accept
any host triple.
Itay Bookstein [Sat, 29 Jan 2022 11:05:17 +0000 (13:05 +0200)]
[clang][CodeGen][NFC] Remove unused CodeGenModule fields
Signed-off-by: Itay Bookstein <ibookstein@gmail.com>
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D118619
Mircea Trofin [Mon, 31 Jan 2022 21:42:47 +0000 (13:42 -0800)]
[nfc][mlgo] De-const a parameter
We plan to pass the MachineFunction& to APIs that expect it non-const
(for legitimate reasons). The advisor still holds the ref as a const
ref, though, so we keep most of the maintainability value of that.
Peter Klausler [Wed, 26 Jan 2022 17:54:58 +0000 (09:54 -0800)]
[flang] Distinguish intrinsic from non-intrinsic modules
For "USE, INTRINSIC", search only for intrinsic modules;
for "USE, NON_INTRINSIC", do not recognize intrinsic modules.
Allow modules of both kinds with the same name to be used in
the same source file (but not in the same scoping unit, a
constraint of the standard that is now enforced).
The symbol table's scope tree now has a single instance of
a scope with a new kind, IntrinsicModules, whose children are
the USE'd intrinsic modules (explicit or not). This separate
"top-level" scope is a child of the single global scope and
it allows both intrinsic and non-intrinsic modules of the same
name to exist in the symbol table. Intrinsic modules' scopes'
symbols now have the INTRINSIC attribute set.
The search path directories need to make a distinction between
regular directories and the one(s) that point(s) to intrinsic
modules. I allow for multiple intrinsic module directories in
the second search path, although only one is needed today.
Differential Revision: https://reviews.llvm.org/D118631
William S. Moses [Sun, 17 Oct 2021 22:31:00 +0000 (18:31 -0400)]
[LoopIdiom] Keep TBAA when creating memcpy/memmove
When upgrading a loop of load/store to a memcpy, the existing pass does not keep existing aliasing information. This patch allows existing aliasing information to be kept.
Reviewed By: jeroen.dobbelaere
Differential Revision: https://reviews.llvm.org/D108221
Nico Weber [Mon, 31 Jan 2022 21:15:48 +0000 (16:15 -0500)]
[gn build] (manually) port
551b1774524
Martin Storsjö [Wed, 12 Jan 2022 09:26:49 +0000 (09:26 +0000)]
[libcxx] [Windows] Pick a unique bit for __regex_word
The old `__regex_word` aliased the mask for `xdigit`, causing stray
test failures.
The diff may look surprising, as if the previous faulty value had
been set specifically for Windows - but this is due to a restructuring
in
411c630bae0e0d50697651797709987e2cfea92d. Prior to that, there
were OS specific settings for some OSes, and one fallback used for
the rest (which turns out to not work for Windows).
Differential Revision: https://reviews.llvm.org/D118188
David Greene [Mon, 31 Jan 2022 15:06:08 +0000 (07:06 -0800)]
[UpdateTestChecks] Re-add --filter and --filter-out options
Re-add filtering options with fixes for failed tests. We were not passing the
is_filtered argument in all check generator calls in update_cc_test_checks.py
Enhance the various update_*_test_checks.py tools to allow filtering the tool
output with regular expressions. The --filter option will emit only tool output
lines matching the given regular expression while the --filter-out option will
emit only tools output lines not matching the given regular expression. Filters
are applied in order of appearance on the command line (or in UTC_ARGS) and the
first matching filter terminates the search.
This allows test authors to create more focused tests by removing irrelevant
tool output and checking only the pieces of output necessary to test the desired
functionality.
Differential Revision: https://reviews.llvm.org/D117694
tyb0807 [Thu, 20 Jan 2022 11:28:19 +0000 (11:28 +0000)]
[AArch64] Removing redundant PAuth flag
This removes `HasPAUTH` from `AArch64SubTarget`, as it seems to be a
redundant, unused copy of `HasPAuth`.
Differential Revision: https://reviews.llvm.org/D117782
tyb0807 [Wed, 19 Jan 2022 10:19:58 +0000 (10:19 +0000)]
[AArch64][SelectionDAG] CodeGen for Armv8.8/9.3 MOPS
New target SDNodes are added: AArch64ISD::MOPS_MEMSET, etc.
Each intrinsic is translated to one of these in SelectionDAGBuilder
via EmitTargetCodeForMOPS.
A custom lowering routine for INTRINSIC_W_CHAIN is added to handle
llvm.aarch64.mops.memset.tag. This takes a separate path from the common
intrinsics but ultimately ends up in the same EmitMOPS().
This is part 4/4 of a series of patches split from
https://reviews.llvm.org/D117405 to facilitate reviewing.
Patch by Tomas Matheson, Lucas Prates and Son Tuan Vu.
Differential Revision: https://reviews.llvm.org/D117764
Joseph Huber [Thu, 30 Dec 2021 21:41:36 +0000 (16:41 -0500)]
[Clang] Introduce Clang Linker Wrapper Tool
This patch introduces a linker wrapper tool that allows us to preprocess
files before they are sent to the linker. This adds a dummy action and
job to the driver stage that builds the linker command as usual and then
replaces the command line with the wrapper tool.
Depends on D116543
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D116544
Joseph Huber [Wed, 29 Dec 2021 21:29:13 +0000 (16:29 -0500)]
[OpenMP] Embed device files into the host IR
This patch adds support for embedding the device object files into the
host IR to create a fat binary. Each offloading file will be inserted
into a section with the following naming format
`.llvm.offloading.<triple>.<arch>.<filename>`.
Depends on D116542
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D116543
Joseph Huber [Fri, 3 Dec 2021 20:48:36 +0000 (15:48 -0500)]
[OpenMP] Add a flag for embedding a file into the module
This patch adds support for a flag `-fembed-offload-binary` to embed a
file as an ELF section in the output by placing it in a global variable.
This can be used to bundle offloading files with the host binary so it
can be accessed by the linker. The section is named using the
`-fembed-offload-section` option.
Depends on D116541
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D116542
Joseph Huber [Thu, 16 Dec 2021 17:40:13 +0000 (12:40 -0500)]
[OpenMP] Introduce new flag to change offloading driver pipeline
This patch introduces the `-fopenmp-new-driver` option which instructs
the compiler to use a new driver scheme for producing offloading code.
In this scheme we create a complete offloading object file and then pass
it as input to the host compilation phase. This will allow us to embed
the object code in the backend phase.
This is the start of a series of commits to rework the OpenMP offloading driver
pipeline. The goal of this is to simplify the steps required for creating an
offloading program. This patch changes the driver's configuration to simply pass
the device file back to the host as an input so it can be embedded as an LLVM IR
global during the backend, then simply passes that object file to the linker.
This driver implementation will currently create the following phases,
```
$ clang input.c -fopenmp -fopenmp-targets=nvptx64 -fopenmp-new-driver -ccc-print-phases
+- 0: input, "input.c", c, (host-openmp)
+- 1: preprocessor, {0}, cpp-output, (host-openmp)
+- 2: compiler, {1}, ir, (host-openmp)
| | +- 3: input, "input.c", c, (device-openmp)
| | +- 4: preprocessor, {3}, cpp-output, (device-openmp)
| |- 5: compiler, {4}, ir, (device-openmp)
| +- 6: offload, "host-openmp (x86_64-unknown-linux-gnu)" {2}, "device-openmp (nvptx64)" {5}, ir
| +- 7: backend, {6}, assembler, (device-openmp)
|- 8: assembler, {7}, object, (device-openmp)
+- 9: offload, "host-openmp (x86_64-unknown-linux-gnu)" {2}, "device-openmp (nvptx64)" {8}, ir
+- 10: backend, {9}, assembler, (host-openmp)
+- 11: assembler, {10}, object, (host-openmp)
12: clang-linker-wrapper, {11}, image, (host-openmp)
```
Which will map to the following bindings
```
# "x86_64-unknown-linux-gnu" - "clang", inputs: ["input.c"], output: "/tmp/input-bae62e.bc"
# "nvptx64" - "clang", inputs: ["input.c", "/tmp/input-bae62e.bc"], output: "/tmp/input-76784e.s"
# "nvptx64" - "NVPTX::Assembler", inputs: ["/tmp/input-76784e.s"], output: "/tmp/input-8f29db.o"
# "x86_64-unknown-linux-gnu" - "clang", inputs: ["/tmp/input-bae62e.bc", "/tmp/input-8f29db.o"], output: "/tmp/input-545450.o"
# "x86_64-unknown-linux-gnu" - "Offload::Linker", inputs: ["/tmp/input-545450.o"], output: "a.out"
```
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D116541
tyb0807 [Tue, 18 Jan 2022 22:34:48 +0000 (22:34 +0000)]
[AArch64][GlobalISel] CodeGen for Armv8.8/9.3 MOPS
This implements codegen for Armv8.8/9.3 Memory Operations extension (MOPS).
Any memcpy/memset/memmov intrinsics will always be emitted as a series
of three consecutive instructions P, M and E which perform the
operation. The SelectionDAG implementation is split into a separate
patch.
AArch64LegalizerInfo will now consider the following generic opcodes
if +mops is available, instead of legalising by expanding them to
libcalls: G_BZERO, G_MEMCPY_INLINE, G_MEMCPY, G_MEMMOVE, G_MEMSET
The s8 value of memset is legalised to s64 to match the pseudos.
AArch64O0PreLegalizerCombinerInfo will still be able to combine
G_MEMCPY_INLINE even if +mops is present, as it is unclear whether it is
better to generate fixed length copies or MOPS instructions for the
inline code of small or zero-sized memory operations, so we choose to be
conservative for now.
AArch64InstructionSelector will select the above as new pseudo
instructions: AArch64::MOPSMemory{Copy/Move/Set/SetTagging} These are
each expanded to a series of three instructions (e.g. SETP/SETM/SETE)
which must be emitted together during code emission to avoid scheduler
reordering.
This is part 3/4 of a series of patches split from
https://reviews.llvm.org/D117405 to facilitate reviewing.
Patch by Tomas Matheson and Son Tuan Vu
Differential Revision: https://reviews.llvm.org/D117763
River Riddle [Mon, 31 Jan 2022 19:32:17 +0000 (11:32 -0800)]
[mlir:Standard][NFC] Remove the dead Arithmetic op classes from Ops.td
These were dead after the arithmetic operations moved from Standard to the Arithmetic dialect.
tyb0807 [Tue, 18 Jan 2022 19:24:11 +0000 (19:24 +0000)]
[AArch64] Modeling NZCV read/write for MOPS instructions
According to the specification, MOPS instructions define/use NZCV flags as
part of their semantics (see discussion in
https://reviews.llvm.org/D116157).
More specifically, the specification of the MOPS extension states that
each memcpy/memset/memmov operation will be performed by a series
of three MOPS instructions P, M and E. The P instruction writes to the
NZCV flags, while the others (M and E) reads from the NZCV flags.
This is part 2/4 of a series of patches split from
https://reviews.llvm.org/D117405 to facilitate reviewing.
Differential Revision: https://reviews.llvm.org/D117757
tyb0807 [Tue, 18 Jan 2022 14:12:03 +0000 (14:12 +0000)]
[AArch64] Support for memset tagged intrinsic
This introduces a new ACLE intrinsic for memset tagged
(https://github.com/ARM-software/acle/blob/next-release/main/acle.md#memcpy-family-of-operations-intrinsics---mops).
void *__builtin_arm_mops_memset_tag(void *, int, size_t)
A corresponding LLVM intrinsic is introduced:
i8* llvm.aarch64.mops.memset.tag(i8*, i8, i64)
The types match llvm.memset but the return type is not void.
This is part 1/4 of a series of patches split from
https://reviews.llvm.org/D117405 to facilitate reviewing.
Patch by Tomas Matheson
Differential Revision: https://reviews.llvm.org/D117753
Peter Klausler [Thu, 20 Jan 2022 21:37:58 +0000 (13:37 -0800)]
[flang] Correct interpretation of RECL=
When RECL= is set on OPEN(), ensure that it:
1) enforces a max output record payload size
(not including header+footer or newline), and
2) causes padding of short output records only
for ACCESS='DIRECT'
The previous code was causing some false overrun errors
and applying padding to sequential/stream output files.
Differential Revision: https://reviews.llvm.org/D118630
Mircea Trofin [Mon, 31 Jan 2022 20:44:09 +0000 (12:44 -0800)]
[mlgo][regalloc][test] Add comprehensive log output testing
Sanjoy Das [Sun, 30 Jan 2022 02:34:48 +0000 (18:34 -0800)]
Remove `mutable` and stray comment
The `mutable` was added back when `scope` was a `DataLayoutOpInterface`.
Differential Revision: https://reviews.llvm.org/D118643
Martin Storsjö [Thu, 20 Jan 2022 11:46:49 +0000 (11:46 +0000)]
[libcxx] [Windows] Use the standard vsnprintf instead of _vsnprintf
In ancient Microsoft C runtimes, there might only have been
a nonstandard `_vsnprintf` instead of the standard `vsnprintf`, but
in modern versions (the only ones relevant for libc++), both
are available.
In MinGW configurations built with `__USE_MINGW_ANSI_STDIO=1` (as it
is built in CI), `vsnprintf` provides a more standards compliant
behaviour than what Microsoft's CRT provides, while `_vsnprintf` retains
the Microsoft C runtime specific quirks.
Differential Revision: https://reviews.llvm.org/D118187
Daniel McIntosh [Fri, 28 Jan 2022 19:18:56 +0000 (14:18 -0500)]
[docs] Update Prolog/Epilog Code Insertion docs to show it's still incomplete
Compact Unwind is a subsection, but that was lost in rGff9feeb520a32d076c3095468208ae116c428285
Reviewed By: void
Differential Revision: https://reviews.llvm.org/D118499
Sam Clegg [Mon, 31 Jan 2022 20:19:54 +0000 (12:19 -0800)]
Revert "[WebAssembly] Refactor and fix emission of external IR global decls"
This reverts commit
00bf4755e90c89963a135739218ef49c2417109f.
This change broke the emscripten builder (among other things):
https://ci.chromium.org/ui/p/emscripten-releases/builders/try/linux/
b8823500584349280721/overview
Sample failure:
```
test_unistd_unlink (test_core.core0) ...
wasm-ld: error: symbol type mismatch: __stdio_write
>>> defined as WASM_SYMBOL_TYPE_FUNCTION in /usr/local/google/home/sbc/dev/wasm/emscripten/cache/sysroot/lib/wasm32-emscripten/libc-debug.a(__stdio_write.o)
>>> defined as WASM_SYMBOL_TYPE_DATA in /usr/local/google/home/sbc/dev/wasm/emscripten/cache/sysroot/lib/wasm32-emscripten/libc-debug.a(stderr.o)
```
Joseph Huber [Mon, 31 Jan 2022 16:39:20 +0000 (11:39 -0500)]
[OpenMP][NFC] Change error message on offloading failure to mention documentation
This patch changes the error message to instead mention the
documentation page for the debugging options provided by libomptarget
and the bitcode runtimes. Add some extra information to the documentation to
help users more quickly identify debugging resources.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D118626
Joseph Huber [Mon, 31 Jan 2022 16:47:19 +0000 (11:47 -0500)]
[Libomptarget] Reduce shared memory stack size to 512 and a message when it is exceeded
Reduces the shared memory size used for globalization to 512 bytes from
2048 to reduce the pressure on shared memory. This patch ado adds a
debug mesage to indicate when the shared memory was insufficient.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D118625
Sanjay Patel [Mon, 31 Jan 2022 19:19:05 +0000 (14:19 -0500)]
[x86] add tests for binop of select with identity constant; NFC
bakhtiyar [Mon, 31 Jan 2022 20:00:03 +0000 (12:00 -0800)]
[async] Get the number of worker threads from the runtime.
Reviewed By: ezhulenev
Differential Revision: https://reviews.llvm.org/D117751
Adrian Prantl [Mon, 31 Jan 2022 19:57:18 +0000 (11:57 -0800)]
Work around a Clang modules build issue.
See:
https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/40636/consoleFull#-
39956214149ba4694-19c4-4d7e-bec5-
911270d8a58c
```
llvm/lib/Support/Valgrind.cpp:37:63: error: missing '#include <stddef.h>'; 'size_t' must be declared before it is used
void llvm::sys::ValgrindDiscardTranslations(const void *Addr, size_t Len) {
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.0.0/include/stddef.h:46:23: note: declaration here is not visible
typedef __SIZE_TYPE__ size_t;
^
1 error generated.
```
rdar://
88049280
Florian Hahn [Mon, 31 Jan 2022 19:54:14 +0000 (19:54 +0000)]
[LV] Add additional complex first order recurrence test.
Add a new test case with 2 first-order recurrences, which share a user.
Louis Dionne [Mon, 31 Jan 2022 19:44:02 +0000 (14:44 -0500)]
[libc++][NFC] Mark a few issues and papers as implemented
Differential Revision: https://reviews.llvm.org/D118638
Eli Friedman [Mon, 31 Jan 2022 18:37:07 +0000 (10:37 -0800)]
[ScalarEvolution] Add bailout to avoid zext of pointer.
The RHS of an isImpliedCond call can be a pointer even if the LHS is
not. This is similar to
bfa2a81e.
Not going to include a testcase; an IR testcase would be extremely
complicated and fragile.
Fixes https://github.com/llvm/llvm-project/issues/51936 .
Differential Revision: https://reviews.llvm.org/D114555
Paul Walker [Fri, 28 Jan 2022 13:25:08 +0000 (13:25 +0000)]
[SVE] By using SEL when orring predicates we forgo the need for a PTRUE.
Differential Revision: https://reviews.llvm.org/D118463
Chris Bieneman [Mon, 31 Jan 2022 19:31:46 +0000 (13:31 -0600)]
[NFC] Fix build when LLVM_DEFAULT_TARGET_TRIPLE=""
We do support building with a default target unspecified. This fixes
two small build issues that prevented LLVM's unit tests from building
and libSupport from building on Windows.
Ruslan Arutyunyan [Mon, 31 Jan 2022 18:40:16 +0000 (21:40 +0300)]
[libc++][pstl][NFC] Remove usage of std::result_of from Parallel STL
std::result_of creates problems when building with C++20 because it's
deprecated there.
The solution is to remove it and get return value type for a function
with decltype.
Substitute std::invoke_result for std::result_of is unnecessary because
we don't have std::invoke semantics within the function - we don't work
with pointer-to-member's.
Reviewed by: ldionne, MikeDvorskiy, #libc
Differential Revision: https://reviews.llvm.org/D118457
Konstantin Varlamov [Mon, 31 Jan 2022 19:23:40 +0000 (11:23 -0800)]
[libc++][ranges][NFC] Add some missing links to the Ranges status page.
Arthur O'Dwyer [Wed, 26 Jan 2022 04:36:55 +0000 (23:36 -0500)]
[libc++] [ranges] ADL-proof ranges::iter_{swap,move}.
As discovered in D117817, `std::ranges::input_range<Holder<Incomplete>*[10]>`
hard-errored before this patch. That's because `input_range` requires
`iter_rvalue_reference_t`, which requires `iter_move`, which was
not ADL-proofed.
Add ADL-proofing tests to all the range refinements.
`output_range` and `common_range` shouldn't be affected,
and all the others subsume `input_range` anyway, but we might as
well be thorough.
Differential Revision: https://reviews.llvm.org/D118213
Alexey Bataev [Thu, 16 Dec 2021 16:55:52 +0000 (08:55 -0800)]
[SLP]Alternate vectorization for cmp instructions.
Added support for alternate ops vectorization of the cmp instructions.
It allows to vectorize either cmp instructions with same/swapped
predicate but different (swapped) operands kinds or cmp instructions
with different predicates and compatible operands kinds.
Differential Revision: https://reviews.llvm.org/D115955
Alexander Yermolovich [Mon, 31 Jan 2022 19:06:06 +0000 (11:06 -0800)]
[BOLT][DWARF] Handle shared abbrev section
We can have a scenario where multiple CUs share an abbrev table.
We modify or don't modify one CU, which leads to other CUs having invalid abbrev section.
Example that caused it.
All of CUs shared the same abbrev table. First CU just had compile_unit and sub_program.
It was not modified. Next CU had DW_TAG_lexical_block with
DW_AT_low_pc/DW_AT_high_pc converted to DW_AT_low_pc/DW_AT_ranges.
We used unmodified abbrev section for first and subsequent CUs.
So when parsing subsequent CUs debug info was corrupted.
In this patch we will now duplicate all sections that are modified and are different.
This also means that if .debug_types is present and it shares Abbrev table, and
they usually are, we now can have two Abbrev tables. One for CU that was modified,
and unmodified one for TU.
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D118517
Paul Walker [Sun, 30 Jan 2022 15:24:23 +0000 (15:24 +0000)]
[SVE] Extend isel pattern coverage for INCP & DECP.
Adds patterns for:
add(x, cntp(p, p)) -> incp(x, p)
sub(x, cntp(p, p)) -> decp(x, p)
Differential Revision: https://reviews.llvm.org/D118567
Sanjoy Das [Sat, 29 Jan 2022 22:30:57 +0000 (14:30 -0800)]
Remove OpTrait, AttrTrait and TypeTrait
- Remove the `{Op,Attr,Type}Trait` TableGen classes and replace with `Trait`
- Rename `OpTraitList` to `TraitList` and use it in a few places
The bulk of this change is a mechanical s/OpTrait/Trait/ throughout the codebase.
Reviewed By: rriddle, jpienaar, herhut
Differential Revision: https://reviews.llvm.org/D118543
Ties Stuij [Mon, 31 Jan 2022 19:00:46 +0000 (19:00 +0000)]
Add info on PACBTI-M to the Clang release notes
Differential Revision: https://reviews.llvm.org/D118380
Jonas Devlieghere [Mon, 31 Jan 2022 18:28:51 +0000 (10:28 -0800)]
[lldb] Support Rosetta registers in crashlog.py
Rosetta crashlogs can have their own thread register state. Unlike the
other registers which ware directly listed under "threadState", the
Rosetta registers are nested under their own key in the JSON, as
illustrated below:
{
"threadState":
{
"rosetta":
{
"tmp2":
{
"value":
4935057216
},
"tmp1":
{
"value":
4365863188
},
"tmp0":
{
"value":
18446744073709551615
}
}
}
}
Jon Chesterfield [Mon, 31 Jan 2022 18:43:03 +0000 (18:43 +0000)]
[openmp] Delete rpath test, too expensive to get it working across platforms
Christian Sigg [Mon, 31 Jan 2022 13:07:25 +0000 (14:07 +0100)]
[MLIR][arith] More float op folders
Fold `arith.fadd %x, -0.0 -> %x` and similarly for `fsub`, `fmul`, `fdiv`.
Fold `arith.fmin %x, %x -> %x`, `arith.fmin %x, +inf -> %x` and similarly for `fmax`.
Reviewed By: pifon2a, mehdi_amini, bondhugula
Differential Revision: https://reviews.llvm.org/D118244
Florian Hahn [Mon, 31 Jan 2022 18:20:46 +0000 (18:20 +0000)]
[AArch64] Bail out for float operands in SetCC optimization.
The optimization added in D118139 causes a crash on the added test case
while trying to zero extend an vector of floats.
Fix the crash by bailing out for floating point operands.
Reviewed By: DavidTruby
Differential Revision: https://reviews.llvm.org/D118615
Jon Chesterfield [Mon, 31 Jan 2022 18:02:31 +0000 (18:02 +0000)]
[OpenMP] Disable rpath test on hexagon as no linker available
Sam McCall [Mon, 31 Jan 2022 18:02:46 +0000 (19:02 +0100)]
Tweak formatting & wording in clangd release notes
Philip Reames [Mon, 31 Jan 2022 17:56:14 +0000 (09:56 -0800)]
[Statepoint] Remove another use of getActualReturnType [NFC]
For the cross block gc.result projection case, we only care about the return type if there is a cross block gc.result, and if there is one, we can take the type from the gc.result.
At the moment, this makes little difference, but for opaque pointers we need a means to get result typing without relying on pointee types.
Alexander Belyaev [Mon, 31 Jan 2022 17:51:39 +0000 (18:51 +0100)]
Revert "[mlir] Purge `linalg.copy` and use `memref.copy` instead."
This reverts commit
016956b68081705ffee511c334e31e414fa1ddbf.
Reverting it to fix NVidia build without being in a hurry.
Adrian Prantl [Thu, 27 Jan 2022 23:43:43 +0000 (15:43 -0800)]
Fix a fragment overflow problem when composing super-registers.
Addresses https://github.com/llvm/llvm-project/issues/53342
Differential Revision: https://reviews.llvm.org/D118412
Philip Reames [Mon, 31 Jan 2022 17:42:34 +0000 (09:42 -0800)]
[Statepoints] Take result type from gc.result [NFC]
When lowering a gc.result, we can assume that the result type of the gc.result matches the type of the underlying call. This is explicitly required in LangRef.
At the moment, this makes little difference, but for opaque pointers we need a means to get result typing without relying on pointee types.
Philip Reames [Mon, 31 Jan 2022 17:33:41 +0000 (09:33 -0800)]
Sink getGCResultLocality to sole use [NFC]
Valentin Clement [Mon, 31 Jan 2022 17:29:06 +0000 (18:29 +0100)]
[flang][NFC] Remove obsolete Character helper
During the upstreaming process from fir-dev some
new builder have been introduced in the `flang/Optimizer/Builder/Character.h`
and `flang/include/Builder/Runtime/Character.h` files.
This patch removes the obsolete Charachter helpers still present
in the lowering directories.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D118594
Alexander Belyaev [Mon, 31 Jan 2022 17:18:28 +0000 (18:18 +0100)]
[mlir] Purge `linalg.copy` and use `memref.copy` instead.
Differential Revision: https://reviews.llvm.org/D118028
Simon Pilgrim [Mon, 31 Jan 2022 17:23:03 +0000 (17:23 +0000)]
[clang-tidy] getLambdaProperties - use cast<> instead of dyn_cast<> to avoid dereference of nullptr
The pointers are dereferenced immediately, so assert the cast is correct instead of returning nullptr
Arthur O'Dwyer [Fri, 21 Jan 2022 20:51:46 +0000 (15:51 -0500)]
[libc++] [ranges] Implement std::ranges::distance
This includes an experimental workaround for
LWG3664 "LWG3392 broke std::ranges::distance(a, a+3)",
but the workaround may be incomplete, I'm not sure.
This should be re-audited when LWG3664 is actually adopted,
to see if we need to change anything about our implementation.
See also https://github.com/microsoft/STL/pull/2500
Differential Revision: https://reviews.llvm.org/D117940
Jon Chesterfield [Mon, 31 Jan 2022 17:22:50 +0000 (17:22 +0000)]
[OpenMP] Disable rpath test in windows for lack of a libomp.lib stub
Craig Topper [Mon, 31 Jan 2022 17:08:17 +0000 (09:08 -0800)]
[RISCV] Add a fatal error if ISD::VSCALE is used with Zvl32b.
We convert VLEN to vscale by dividing by RVVBitsPerBlock which is
currently 64. This is only correct if VLEN is evenly divisible by
64. With only Zvl32b we can't assume that.
This patch adds a fatal_error to prevent generating code that may
be broken.
We probably need to look at how we size stack frame objects too.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D118583
Craig Topper [Mon, 31 Jan 2022 17:08:05 +0000 (09:08 -0800)]
[RISCV] Update the computeKnownBitsForTargetNode for RISCVISD::READ_VLENB to consider Zve/Zvl.
We had previously hardcoded this to assume that vector registers
are 128 bits. This was true when only V existed, but after Zve
extensions were added this became incorrect.
This patch adjusts it to support 128, 64, or 32 bit vectors depending
on Zvl. The 128-bit limit is artificial, but we don't have any test
coverage showing that we larger values so I was being conservative.
None of our lit tests depend on this code today due to the custom
lowering of ISD::VSCALE that inserts the appropriate left or right
shift to convert from VLENB to VSCALE. That code was added after
this code in computeKnownBitsForTargetNode.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D118582
Arthur O'Dwyer [Sat, 22 Jan 2022 17:26:27 +0000 (12:26 -0500)]
[libc++] [NFC] Audit LWG issues for "Nothing To Do" and "Complete".
Each "Nothing To Do" issue only changed nits in the English wording,
not anything to do with the code.
Each "Complete" issue was completed already, as far as I can tell.
I tried to err on the side of caution: I didn't mark a few issues
whose P/Rs were very invasive and would take time to verify, and I
didn't mark a lot of issues involving features we haven't even started
yet.
Differential Revision: https://reviews.llvm.org/D117960
Arthur O'Dwyer [Mon, 31 Jan 2022 17:04:08 +0000 (12:04 -0500)]
[libc++] Merge _LIBCPP_HAS_NO_RANGES into _LIBCPP_HAS_NO_CONCEPTS. NFC.
The macro that opts out of `std::ranges::` functionality is called
`_LIBCPP_HAS_NO_INCOMPLETE_RANGES`, and is unrelated to this macro
which is specifically about _compiler_ support for the _syntax_.
The only non-mechanical diff here is in `<__config>`.
Differential Revision: https://reviews.llvm.org/D118507
Craig Topper [Mon, 31 Jan 2022 16:56:32 +0000 (08:56 -0800)]
[RISCV] Separate the Zfhmin and Zfh extensions.
The spec doesn't seem to be written as if Zfh implies Zfhmin. They
seem to be separate extensions.
This patch moves the instructions from Zfhmin to be enabled with
either the Zfh or Zfhmin extensions.
Reviewed By: achieveartificialintelligence
Differential Revision: https://reviews.llvm.org/D118581
Craig Topper [Mon, 31 Jan 2022 16:56:23 +0000 (08:56 -0800)]
[RISCV] Make Zfhmin in march imply F.
Zfhmin should imply F just like Zfh.
Reviewed By: achieveartificialintelligence
Differential Revision: https://reviews.llvm.org/D118578
Josh Mottley [Tue, 14 Dec 2021 14:23:11 +0000 (14:23 +0000)]
[flang] Upstream partial lowering of COMMAND_ARGUMENT_COUNT intrinsic
This patch adds partial lowering of the "COMMAND_ARGUMENT_COUNT" intrinsic
to the backend runtime hook implemented in patch D109048. Also adds a
"helper" function for retrieving the default integer type from
FIRBuilder, which will be used later when finishing the lowering of
intrinsic.
Differential Revision: https://reviews.llvm.org/D117869
Nikolas Klauser [Sat, 29 Jan 2022 16:58:05 +0000 (17:58 +0100)]
[libc++][test] add vector<bool>::reference tests
Add test coverage for `vector<bool>::reference`
Reviewed By: Quuxplusone, ldionne, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D117780
Jeremy Morse [Mon, 31 Jan 2022 16:24:20 +0000 (16:24 +0000)]
[DebugInfo][InstrRef][NFC] Refactor ahead of further optimisations
This patch shuffles some functions around so that some blocks of code can
be reused. In particular,
* Move the determination of "which blocks are in scope" to its own
function, as it's non-trivial to solve. Delete the "InScopeBlocks"
collection too, which nothing reads from.
* Split transfer emission (i.e., installing DBG_VALUEs into blocks) into
its own function.
* Name some useful types.
* Rename "ScopeToBlocks" to "ScopeToAssignBlocks", as that's what the
collection contains, blocks where assignments happen.
Differential Revision: https://reviews.llvm.org/D118454
Hans Wennborg [Mon, 31 Jan 2022 15:13:03 +0000 (16:13 +0100)]
Add llvm-pdbutil in LLVM_TOOLCHAIN_TOOLS
One can argue that it qualifies as a toolchain tool rather than "internal llvm
tool". This will make it part of builds which set the
LLVM_INSTALL_TOOLCHAIN_ONLY cmake option, such as the Windows installer.
Fixes https://github.com/llvm/llvm-project/issues/53461
Differential revision: https://reviews.llvm.org/D118606
Jon Chesterfield [Mon, 31 Jan 2022 16:26:32 +0000 (16:26 +0000)]
Set rpath on openmp executables
Openmp executables need to find libomp and libomptarget at runtime.
This currently requires LD_LIBRARY_PATH or the user to specify rpath. Change
that to set the expected location of the openmp libraries in the install tree.
Whether rpath means rpath or runpath is system dependent. The attached test
shows that the Wl,--disable-new-dtags control interacts correctly with this feature.
The implicit rpath field is appended to any user specified ones which is ideal.
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D118493
Jon Chesterfield [Mon, 31 Jan 2022 16:16:55 +0000 (16:16 +0000)]
Revert "Set rpath on openmp executables"
Failed some buildbots, bad assumptions about structure of install path
This reverts commit
a80d5c34e4b99f21fa371160ac7eb7e9db093997.
Jeremy Morse [Mon, 31 Jan 2022 16:14:20 +0000 (16:14 +0000)]
Revert "[DebugInfo][InstrRef][NFC] Add a missing assignment operator"
This reverts commit
f18429372f12b571aef539855c4dbef23a96f494.
Bitten by -Werror,-Wdeprecated-copy on a buildbot, alas!
Sanjay Patel [Mon, 31 Jan 2022 15:57:58 +0000 (10:57 -0500)]
[InstCombine] add tests for potential mul demanded bits fold; NFC
This is discussed as an enhancement in D118539.
Jeremy Morse [Sun, 30 Jan 2022 20:25:00 +0000 (20:25 +0000)]
[DebugInfo][InstrRef][NFC] Add a missing assignment operator
ValueIDNum is supposed to be a value type that boils down to a uint64_t,
that has some bitfields for convenience. If we use the default operator=,
we end up with each bit field being individually assigned, which is
un-necessarily slow.
Implement the assignment operator by just copying the uint64_t value of
the object. This is quicker, and matches how the comparison operators
work already. Doing so is 0.1% faster on the compile-time-tracker.
Jon Chesterfield [Mon, 31 Jan 2022 16:01:04 +0000 (16:01 +0000)]
Set rpath on openmp executables
Openmp executables need to find libomp and libomptarget at runtime.
This currently requires LD_LIBRARY_PATH or the user to specify rpath. Change
that to set the expected location of the openmp libraries in the install tree.
Whether rpath means rpath or runpath is system dependent. The attached test
shows that the Wl,--disable-new-dtags control interacts correctly with this feature.
The implicit rpath field is appended to any user specified ones which is ideal.
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D118493
LLVM GN Syncbot [Mon, 31 Jan 2022 15:38:08 +0000 (15:38 +0000)]
[gn build] Port
f3514af492ee
Nikolas Klauser [Tue, 25 Jan 2022 10:21:47 +0000 (11:21 +0100)]
[libc++][ranges] Add ranges::in_in_out_result
Add `ranges::in_in_out_result`
Reviewed By: Quuxplusone, Mordante, #libc
Spies: CaseyCarter, libcxx-commits, mgorny
Differential Revision: https://reviews.llvm.org/D117512
Valentin Clement [Mon, 31 Jan 2022 15:32:54 +0000 (16:32 +0100)]
[flang][NFC] Remove out of date IO helper
Functionality in IO.h and IO.cpp have been upstreamed together with the frontend
when flang landed upstream. Those files are out of date compared with fir-dev.
These functionality will be upstreamed again when needed in the lowering process
with an up to date code and a proper review.
These files (and the functions it contains) are not currently used. Hence
removing it is NFC.
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D118593
Kadir Cetinkaya [Mon, 31 Jan 2022 11:01:24 +0000 (12:01 +0100)]
[cte] Add release notes for clangd-14
Differential Revision: https://reviews.llvm.org/D118592
Matthias Springer [Mon, 31 Jan 2022 15:27:13 +0000 (00:27 +0900)]
[mlir][bufferize][NFC] Move vector BufferizableOpInterface impl to vector dialect
Differential Revision: https://reviews.llvm.org/D118540
Kadir Cetinkaya [Fri, 28 Jan 2022 15:18:24 +0000 (16:18 +0100)]
[clang][Lexer] Make raw and normal lexer behave the same for line comments
Normally there are heruistics in lexer to treat `//*` specially in
language modes that don't have line comments (to emit `/`). Unfortunately this
only applied to the first occurence of a line comment inside the file, as the
subsequent line comments were treated as if language had support for them.
This unfortunately only holds in normal lexing mode, as in raw mode all
occurences of line comments received this treatment, which created discrepancies
when comparing expanded and spelled tokens.
The proper fix would be to just make sure we treat all the line comments with a
subsequent `*` the same way, but it would imply breaking some code that's
accepted by clang today. So instead we introduce the same bug into raw lexing
mode.
Fixes https://github.com/clangd/clangd/issues/1003.
Differential Revision: https://reviews.llvm.org/D118471
Jay Foad [Mon, 31 Jan 2022 14:55:36 +0000 (14:55 +0000)]
Revert "[Local] invertCondition: try modifying an existing ICmpInst"
This reverts commit
a6b54ddaba2d5dc0f72dcc4591c92b9544eb0016.
Apparently it is not safe to modify the condition even if it passes the
hasOneUse test, because StructurizeCFG might have other references to
the condition that are not manifest in the IR use-def chains.
Kerry McLaughlin [Mon, 31 Jan 2022 13:25:02 +0000 (13:25 +0000)]
[SVE] Fix TypeSize->uint64_t implicit conversion in visitAlloca()
Fixes a crash ('Invalid size request on a scalable vector') in visitAlloca()
when we call this function for a scalable alloca instruction, caused
by the implicit conversion of TySize to uint64_t.
This patch changes TySize to a TypeSize as returned by getTypeAllocSize()
and ensures the allocation size is multiplied by vscale for scalable vectors.
Reviewed By: sdesmalen, david-arm
Differential Revision: https://reviews.llvm.org/D118372
Ties Stuij [Mon, 31 Jan 2022 14:02:51 +0000 (14:02 +0000)]
[ARM] Add Cortex-X1C Support for Clang and LLVM
This patch upstreams support for the Arm-v8 Cortex-X1C processor for AArch64 and
ARM.
For more information, see:
- https://community.arm.com/arm-community-blogs/b/announcements/posts/arm-cortex-x1c
- https://developer.arm.com/documentation/101968/0002/Functional-description/Technical-overview/Components
The following people contributed to this patch:
- Simon Tatham
- Ties Stuij
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D117202
Dávid Bolvanský [Mon, 31 Jan 2022 12:45:07 +0000 (13:45 +0100)]
[Analysis] Attribute noundef should not prevent tail call optimization
Very similar to https://reviews.llvm.org/D101230
Fixes https://github.com/llvm/llvm-project/issues/53501
Simon Pilgrim [Mon, 31 Jan 2022 13:57:47 +0000 (13:57 +0000)]
[X86] combineAnd() - per-element simplification - call SimplifyDemandedBits using mask demanded bits if SimplifyDemandedVectorElts fails
We already call SimplifyDemandedVectorElts using whether each vector mask element is zero/nonzero, this just extends this to also try SimplifyDemandedBits using the demanded bits mask generated from the nonzero elements.
This also requires an additional TargetLowering::SimplifyDemandedBits DemandedBits/DemandedElts wrapper.
Jeremy Morse [Mon, 31 Jan 2022 12:38:59 +0000 (12:38 +0000)]
[DebugInfo][InstrRef] Don't fully propagate single assigned variables
If we only assign a variable value a single time, we can take a short-cut
when computing its location: the variable value is only valid up to the
dominance frontier of where the assignemnt happens. Past that point, there
are other predecessors from where the variable has no value, meaning the
variable has no location past that point.
This patch recognises this scenario, and avoids expensive SSA computation,
to improve compile-time performance.
Differential Revision: https://reviews.llvm.org/D117877
Benjamin Kramer [Mon, 31 Jan 2022 12:50:05 +0000 (13:50 +0100)]
Don't rely on clang being named clang in test
Nico Weber [Mon, 31 Jan 2022 12:15:36 +0000 (07:15 -0500)]
Revert "[gn build] (manually) port
36892727e4f1"
This reverts commit
7b2dfe1c226a4e9f193b8432c64c32c58ca9990a.
Matches
ab3b89855c53.
Momchil Velikov [Mon, 31 Jan 2022 10:48:14 +0000 (10:48 +0000)]
Save some `std::string` allocations/deallocations when formatting attributes (NFC)
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D118451
Simon Pilgrim [Mon, 31 Jan 2022 12:00:51 +0000 (12:00 +0000)]
[DAG] SimplifyDemandedBits - mul(x,x) - if only demand bit[1] then fold to zero
Simon Pilgrim [Mon, 31 Jan 2022 11:36:03 +0000 (11:36 +0000)]
[X86] Limit mul(x,x) knownbits tests with not undef/poison check
We can only assume bit[1] == zero if its the only demanded bit or the source is not undef/poison
Jay Foad [Mon, 31 Jan 2022 11:22:00 +0000 (11:22 +0000)]
[AMDGPU] AMDGPUAnnotateUniformValues: inline a single-use lambda. NFC.
Jay Foad [Fri, 28 Jan 2022 13:05:39 +0000 (13:05 +0000)]
[AMDGPU] Add test for a problem with noclobber metadata
If AMDGPUAnnotateUniformValues finds a load from a uniform pointer with
no potentially clobbering stores between the kernel entry point and the
load instruction, it adds noclobber metadata to the *address*. This is
unsafe because it can get applied to other loads in the same which do
have aliasing stores.
Differential Revision: https://reviews.llvm.org/D118458
Simon Pilgrim [Mon, 31 Jan 2022 11:06:02 +0000 (11:06 +0000)]
[X86] Add mul(x,x) tests showing miscompile
As raised by @efriedma on D117995 - the source must not be undef/poison to demand any bits in mul(x,x) other than bit[1]
https://alive2.llvm.org/ce/z/Cxkjen
Jay Foad [Fri, 28 Jan 2022 14:45:06 +0000 (14:45 +0000)]
[Local] invertCondition: try modifying an existing ICmpInst
This avoids various cases where StructurizeCFG would otherwise insert an
xor i1 instruction, and it since it generally runs late in the pipeline,
instcombine does not clean up the xor-of-cmp pattern.
Differential Revision: https://reviews.llvm.org/D118478
Paulo Matos [Mon, 31 Jan 2022 10:42:02 +0000 (11:42 +0100)]
[WebAssembly] Refactor and fix emission of external IR global decls
This patches fixes the visibility and linkage information of symbols
referring to IR globals.
Emission of external declarations is now done in the first execution
of emitConstantPool rather than in emitLinkage (and a few other
places). This is the point where we have already gathered information
about used symbols (by running the MC Lower PrePass) and not yet
started emitting any functions so that any declarations that need to
be emitted are done so at the top of the file before any functions.
This changes the order of a few directives in the final asm file which
required an update to a few tests.
Reviewed By: sbc100
Differential Revision: https://reviews.llvm.org/D118122
Andrzej Warzynski [Thu, 27 Jan 2022 16:44:44 +0000 (16:44 +0000)]
[flang][driver][nfc] Fix capitalisation
As pointed out in https://reviews.llvm.org/D93401, some methods in the
Flang driver are named inconsistently. The driver strives to follow
Flang's C++ style [1] and this patch updates these methods accordingly.
[1]
https://github.com/llvm/llvm-project/blob/main/flang/docs/C%2B%2Bstyle.md
Differential Revision: https://reviews.llvm.org/D118381
Gabor Marton [Tue, 18 Jan 2022 16:47:32 +0000 (17:47 +0100)]
[Analyzer] Add docs to StdCLibraryFunctionArgsChecker
Differential Revision: https://reviews.llvm.org/D117568
Sven van Haastregt [Mon, 31 Jan 2022 10:21:05 +0000 (10:21 +0000)]
[OpenCL] Make generic addrspace optional for -fdeclare-opencl-builtins
Currently, -fdeclare-opencl-builtins always adds the generic address
space overloads of e.g. the vload builtin functions in OpenCL 3.0
mode, even when the generic address space feature is disabled.
Guard the generic address space overloads by the
`__opencl_c_generic_address_space` feature instead of by OpenCL
version.
Guard the private, global, and local overloads using the internal
`__opencl_c_named_address_space_builtins` feature.
Differential Revision: https://reviews.llvm.org/D107769
Florian Hahn [Mon, 31 Jan 2022 10:18:28 +0000 (10:18 +0000)]
[AArch64] Fix costs of float vector compare/selects pairs.
The current cost-model overestimates the cost of vector compares &
selects for ordered floating point compares. This patch fixes that by
extending the existing logic for integer predicates.
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D118256