platform/upstream/llvm.git
2 years ago[builtins] Use mcr for dmb instruction on armv6
Khem Raj [Fri, 11 Mar 2022 03:30:00 +0000 (19:30 -0800)]
[builtins] Use mcr for dmb instruction on armv6

At present compiler-rt cross compiles for armv6 ( -march=armv6 ) but includes
dmb instructions which are only available in armv7+ this causes SIGILL on
clang+compiler-rt compiled components on rpi0w platforms.

Reviewed By: MaskRay

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

2 years agoSplit up large test files(over 10k lines) under clang/test/CodeGen/RISCV including:
4vtomat [Fri, 11 Mar 2022 01:26:48 +0000 (17:26 -0800)]
Split up large test files(over 10k lines) under clang/test/CodeGen/RISCV including:

The llvm pre-merge test got timeout due to large test files, this commit
split up the files that have over 10k lines under clang/test/CodeGen/RISCV
into even smaller ones.

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

2 years ago[mlir] Support verification order (3/3)
Chia-hung Duan [Thu, 10 Mar 2022 22:10:45 +0000 (22:10 +0000)]
[mlir] Support verification order (3/3)

In this CL, update the function name of verifier according to the
behavior. If a verifier needs to access the region then it'll be updated
to `verifyRegions`.

Reviewed By: rriddle

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

2 years ago[lld-macho][nfc] Fix formatting in ld64-vs-lld.rst
Jez Ng [Thu, 10 Mar 2022 23:33:18 +0000 (18:33 -0500)]
[lld-macho][nfc] Fix formatting in ld64-vs-lld.rst

2 years ago[x86] add tests for and+setcc; NFC
Sanjay Patel [Thu, 10 Mar 2022 22:56:15 +0000 (17:56 -0500)]
[x86] add tests for and+setcc; NFC

2 years ago[ARM] Fix 8-bit immediate overflow in the instruction of segmented stack prologue.
Zhiyao Ma [Thu, 10 Mar 2022 23:13:41 +0000 (15:13 -0800)]
[ARM] Fix 8-bit immediate overflow in the instruction of segmented stack prologue.

It fixes the overflow of 8-bit immediate field in the emitted
instruction that allocates large stacklet.

For thumb2 targets, load large immediate by a pair of movw and movt
instruction. For thumb1 and ARM targets, load large immediate by reading
from literal pool.

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

2 years ago[AArch64] Use correct calling convention for each vararg
Philippe Valembois [Thu, 10 Mar 2022 23:05:29 +0000 (15:05 -0800)]
[AArch64] Use correct calling convention for each vararg

While checking is tail call optimization is possible, the calling
convention applied to fixed arguments is not the correct one.
This implies for DarwinPCS that all arguments of a vararg function will
go to the stack although fixed ones can go in registers.

This prevents non-virtual thunks to be tail optimized although they are
marked as musttail.

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

2 years ago[clang-format] Fix namespace format when the name is followed by a macro
Zequan Wu [Wed, 9 Mar 2022 02:59:46 +0000 (18:59 -0800)]
[clang-format] Fix namespace format when the name is followed by a macro

Example:
```
$ cat a.cpp
namespace my_namespace::yeah API_AVAILABLE(macos(10.15)) {
void test() {}
}

$ clang-format a.cpp
namespace my_namespace::yeah API_AVAILABLE(macos(10.15)) {
void test() {}
}// namespace my_namespace::yeahAPI_AVAILABLE(macos(10.15))
```
After:
```
$ clang-format a.cpp
namespace my_namespace::yeah API_AVAILABLE(macos(10.15)) {
void test() {}
}// namespace my_namespace::yeah
```

Reviewed By: MyDeveloperDay, owenpan, curdeius

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

2 years ago[clang-tools-extra] Don't consider python below LLVM_MINIMUM_PYTHON_VERSION. NFC
Sam McCall [Thu, 10 Mar 2022 22:57:05 +0000 (23:57 +0100)]
[clang-tools-extra] Don't consider python below LLVM_MINIMUM_PYTHON_VERSION. NFC

2 years ago[lldb] Remove unused include in ScriptedProcessInterface.h
Dave Lee [Thu, 10 Mar 2022 22:51:11 +0000 (14:51 -0800)]
[lldb] Remove unused include in ScriptedProcessInterface.h

2 years ago[Sema][Windows] Don't special-case void* in __unaligned conversions.
Eli Friedman [Thu, 3 Mar 2022 20:29:59 +0000 (12:29 -0800)]
[Sema][Windows] Don't special-case void* in __unaligned conversions.

As far as I can tell, MSVC allows the relevant conversions for all
pointer types. Found compiling a Windows SDK header.

I've verified that the updated errors in MicrosoftExtensions.cpp match
the ones that MSVC actually emits, except for the one with a FIXME. (Not
sure why this wasn't done for the patch that added the tests.)

To make up for the missing error, add a warning that triggers on
conversions that drop the __unaligned qualfier.

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

2 years ago[mlir][Vector] Modernize default lowering of vector transpose
Diego Caballero [Thu, 10 Mar 2022 20:44:24 +0000 (20:44 +0000)]
[mlir][Vector] Modernize default lowering of vector transpose

This patch removes an old recursive implementation to lower vector.transpose to extract/insert operations
and replaces it with a iterative approach that leverages newer linearization/delinearization utilities.
The patch should be NFC except by the order in which the extract/insert ops are generated.

Reviewed By: nicolasvasilache

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

2 years ago[FunctionAttrs] Add tests for argmemonly inference.
Florian Hahn [Thu, 10 Mar 2022 22:32:29 +0000 (22:32 +0000)]
[FunctionAttrs] Add tests for argmemonly inference.

2 years ago[clang-format][NFC] Group all C++ passes under isCpp()
owenca [Thu, 10 Mar 2022 22:20:24 +0000 (14:20 -0800)]
[clang-format][NFC] Group all C++ passes under isCpp()

Also removes a not very helpful comment.

2 years ago[clang-tools-extra] Remove unused lit features/substitutions. NFCI
Sam McCall [Thu, 10 Mar 2022 22:28:43 +0000 (23:28 +0100)]
[clang-tools-extra] Remove unused lit features/substitutions. NFCI

2 years agoFix reference to execute_external leftover in 69924ccf7a328f
Sam McCall [Thu, 10 Mar 2022 22:20:03 +0000 (23:20 +0100)]
Fix reference to execute_external leftover in 69924ccf7a328f

2 years agoRemove redundant lit config already handled in llvm_config. NFCI
Sam McCall [Thu, 10 Mar 2022 22:09:46 +0000 (23:09 +0100)]
Remove redundant lit config already handled in llvm_config. NFCI

This logic duplicates lit.llvm.initialize, which we're already calling
(in lit.site.cfg.py.in).
The equivalent logic was removed from clang in d4401d354a938dd366bf but
never cleaned up here.

2 years ago[lldb] Call ThreadPlan::DiscardPlan from Thread::DiscardPlan
Dave Lee [Thu, 10 Mar 2022 20:11:57 +0000 (12:11 -0800)]
[lldb] Call ThreadPlan::DiscardPlan from Thread::DiscardPlan

Correct `Thread::DiscardPlan` to call `DiscardPlan` instead of `PopPlan`.

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

2 years agollvm-ifs doc: Replace a utf-8 char by a more classic one
Sylvestre Ledru [Thu, 10 Mar 2022 21:40:18 +0000 (22:40 +0100)]
llvm-ifs doc: Replace a utf-8 char by a more classic one

Fails on old python (like on ubuntu bionic) otherwise with:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 2130: ordinal not in range(128)

2 years ago[ASan] Added back @PLT to __asan_report_* calls to avoid compile errors.
Kirill Stoimenov [Thu, 10 Mar 2022 21:29:55 +0000 (21:29 +0000)]
[ASan] Added back @PLT to __asan_report_* calls to avoid compile errors.

Reviewed By: vitalybuka

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

2 years agolldb/ObjectFile,Disassembler: read some state from the executable
Saleem Abdulrasool [Thu, 10 Mar 2022 20:55:46 +0000 (20:55 +0000)]
lldb/ObjectFile,Disassembler: read some state from the executable

Add support to inspect the ELF headers for RISCV targets to determine if
RVC or RVE are enabled and the floating point support to enable.  As per
the RISCV specification, d implies f, q implies d implies f, which gives
us the cascading effect that is used to enable the features when setting
up the disassembler.  With this change, it is now possible to attach the
debugger to a remote process and be able to disassemble the instruction
stream.

~~~
$ bin/lldb tmp/reduced
(lldb) target create "reduced"
Current executable set to '/tmp/reduced' (riscv64).
(lldb) gdb-remote localhost:1234
(lldb) Process 5737 stopped
* thread #1, name = 'reduced', stop reason = signal SIGTRAP
    frame #0: 0x0000003ff7fe1b20
->  0x3ff7fe1b20: mv     a0, sp
    0x3ff7fe1b22: jal    1936
    0x3ff7fe1b26: mv     s0, a0
    0x3ff7fe1b28: auipc  a0, 27
~~~

2 years ago[libc][Obvious] Destroy the block store var in block store test.
Siva Chandra Reddy [Thu, 10 Mar 2022 21:35:43 +0000 (21:35 +0000)]
[libc][Obvious] Destroy the block store var in block store test.

2 years ago[clang-format] Handle "// clang-format off" for RemoveBracesLLVM
owenca [Thu, 10 Mar 2022 04:38:43 +0000 (20:38 -0800)]
[clang-format] Handle "// clang-format off" for RemoveBracesLLVM

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

2 years ago[libc] Add a resizable container with constexpr constructor and destructor.
Siva Chandra Reddy [Wed, 9 Mar 2022 20:54:06 +0000 (20:54 +0000)]
[libc] Add a resizable container with constexpr constructor and destructor.

The new container is used to store atexit callbacks. This way, we avoid
the possibility of the destructor of the container itself getting added
as an at exit callback.

Reviewed By: abrachet

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

2 years agoDiagnose when `#pragma clang fp eval_method` doesn't have a supported value.
Zahira Ammarguellat [Thu, 10 Mar 2022 16:08:12 +0000 (08:08 -0800)]
Diagnose when `#pragma clang fp eval_method` doesn't have a supported value.
Currently the compiler is crashing.

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

2 years ago[ASan] Moved optimized callbacks out of asan_static to avoid DSO size increase.
Kirill Stoimenov [Thu, 10 Mar 2022 20:38:37 +0000 (20:38 +0000)]
[ASan] Moved optimized callbacks out of asan_static to avoid DSO size increase.

Reviewed By: vitalybuka

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

2 years ago[FunctionAttrs] Add initial test for pass statistics.
Florian Hahn [Thu, 10 Mar 2022 21:02:41 +0000 (21:02 +0000)]
[FunctionAttrs] Add initial test for pass statistics.

2 years ago[X86] Add (u)comiss/sd tests showing eflags handling (PR38960)
Simon Pilgrim [Thu, 10 Mar 2022 20:59:31 +0000 (20:59 +0000)]
[X86] Add (u)comiss/sd tests showing eflags handling (PR38960)

2 years ago[libc++] Add tests for the content of <cstddef>
Louis Dionne [Mon, 7 Mar 2022 13:43:14 +0000 (08:43 -0500)]
[libc++] Add tests for the content of <cstddef>

As discussed in D114786.

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

2 years ago[libc++] Remove operator-> from iterator archetypes that don't need it
Louis Dionne [Thu, 27 Jan 2022 18:57:49 +0000 (13:57 -0500)]
[libc++] Remove operator-> from iterator archetypes that don't need it

operator-> is not a requirement for most iterators, so remove it. To
account for this change, the `common_iterator.operator->` test needs to
be refactored quite a bit -- improve test coverage while we're at it.

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

2 years ago[lldb] Always listen for progress events in the default event handler
Jonas Devlieghere [Thu, 10 Mar 2022 20:48:46 +0000 (12:48 -0800)]
[lldb] Always listen for progress events in the default event handler

We came to the conclusion that this doesn't matter for VSCode/Xcode
because they don't use the default event loop and that other clients
who might care should use the setting.

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

2 years ago[LLDB][NativePDB] Add support for S_DEFRANGE_REGISTER and S_DEFRANGE_SUBFIELD_REGISTER
Zequan Wu [Fri, 11 Feb 2022 02:18:59 +0000 (18:18 -0800)]
[LLDB][NativePDB] Add support for S_DEFRANGE_REGISTER and S_DEFRANGE_SUBFIELD_REGISTER

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

2 years ago[mlir][NVVM] Add ldmatrix op to NVVM dialect
Thomas Raoux [Thu, 10 Mar 2022 01:21:07 +0000 (01:21 +0000)]
[mlir][NVVM] Add ldmatrix op to NVVM dialect

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

2 years ago[AMDGPU] Updated some tests to run on gfx940. NFC.
Stanislav Mekhanoshin [Thu, 10 Mar 2022 20:32:38 +0000 (12:32 -0800)]
[AMDGPU] Updated some tests to run on gfx940. NFC.

2 years ago[cmake] Remove unused OUTPUT_MAPPING param to configure_lit_site_cfg(). NFC
Sam McCall [Thu, 10 Mar 2022 20:18:37 +0000 (21:18 +0100)]
[cmake] Remove unused OUTPUT_MAPPING param to configure_lit_site_cfg(). NFC

Looks like it never did anything.
Added in 71deeee593c40ff01e529a6a4b30fa5b55494b82

2 years ago[lld-macho] Align cstrings less conservatively
Jez Ng [Thu, 10 Mar 2022 20:04:31 +0000 (15:04 -0500)]
[lld-macho] Align cstrings less conservatively

Previously, we aligned every cstring to 16 bytes as a temporary hack to
deal with https://github.com/llvm/llvm-project/issues/50135. However, it
was highly wasteful in terms of binary size.

To recap, in contrast to ELF, which puts strings that need different
alignments into different sections, `clang`'s Mach-O backend puts them
all in one section.  Strings that need to be aligned have the .p2align
directive emitted before them, which simply translates into zero padding
in the object file. In other words, we have to infer the alignment of
the cstrings from their addresses.

We differ slightly from ld64 in how we've chosen to align these
cstrings. Both LLD and ld64 preserve the number of trailing zeros in
each cstring's address in the input object files. When deduplicating
identical cstrings, both linkers pick the cstring whose address has more
trailing zeros, and preserve the alignment of that address in the final
binary. However, ld64 goes a step further and also preserves the offset
of the cstring from the last section-aligned address.  I.e. if a cstring
is at offset 18 in the input, with a section alignment of 16, then both
LLD and ld64 will ensure the final address is 2-byte aligned (since
`18 == 16 + 2`). But ld64 will also ensure that the final address is of
the form 16 * k + 2 for some k (which implies 2-byte alignment).

Note that ld64's heuristic means that a dedup'ed cstring's final address is
dependent on the order of the input object files. E.g. if in addition to the
cstring at offset 18 above, we have a duplicate one in another file with a
`.cstring` section alignment of 2 and an offset of zero, then ld64 will pick
the cstring from the object file earlier on the command line (since both have
the same number of trailing zeros in their address). So the final cstring may
either be at some address `16 * k + 2` or at some address `2 * k`.

I've opted not to follow this behavior primarily for implementation
simplicity, and secondarily to save a few more bytes. It's not clear to me
that preserving the section alignment + offset is ever necessary, and there
are many cases that are clearly redundant. In particular, if an x86_64 object
file contains some strings that are accessed via SIMD instructions, then the
.cstring section in the object file will be 16-byte-aligned (since SIMD
requires its operand addresses to be 16-byte aligned). However, there will
typically also be other cstrings in the same file that aren't used via SIMD
and don't need this alignment. They will be emitted at some arbitrary address
`A`, but ld64 will treat them as being 16-byte aligned with an offset of
`16 % A`.

I have verified that the two repros in https://github.com/llvm/llvm-project/issues/50135
work well with the new alignment behavior.

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

Reviewed By: #lld-macho, oontvoo

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

2 years ago[BOLT] Divide RegularPageSize for X86 and AArch64 cases
Elvina Yakubova [Thu, 10 Mar 2022 20:04:03 +0000 (23:04 +0300)]
[BOLT] Divide RegularPageSize for X86 and AArch64 cases

For AArch64 in some cases/some distributions ld uses 64K alignment of LOAD segments by default.

Reviewed By: yota9, maksfb

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

2 years ago[lldb] Remove extra space in step logging message
Dave Lee [Thu, 10 Mar 2022 20:01:15 +0000 (12:01 -0800)]
[lldb] Remove extra space in step logging message

When seeing the extra space in the log, it wasn't clear if there was a missing
printf argument. Removing the extra space removes the potential confusion.

2 years ago[mlir][sparse] Improving error messages for openSparseTensorCOO
wren romano [Wed, 9 Mar 2022 23:53:04 +0000 (15:53 -0800)]
[mlir][sparse] Improving error messages for openSparseTensorCOO

Reviewed By: aartbik

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

2 years ago[RISCV] Remove performANY_EXTENDCombine.
Craig Topper [Thu, 10 Mar 2022 19:26:05 +0000 (11:26 -0800)]
[RISCV] Remove performANY_EXTENDCombine.

This doesn't appear to be needed any more. I did some inspecting
of the gcc torture suite and SPEC2006 with this removed and didn't
find any meaningful changes.

I think we're more aggressive about forming ADDIW now using
sign_extend_inreg during type legalization and hasAllWUsers in isel.
This probably helps catch the cases this helped with before.

2 years ago[lldb/gdb-remote] Remove ancient debugserver workaround
Pavel Labath [Wed, 9 Mar 2022 17:19:58 +0000 (18:19 +0100)]
[lldb/gdb-remote] Remove ancient debugserver workaround

This workaround is the source of an awkwared Process->Platform
dependency. While this could be solved in various ways (the only thing
we really use is the plugin name), it may be better to just remove it --
the workaround was added 10 years ago (43c555dfc), and the affected
debugservers were "old" even then, so hopefully they are not in use
anymore.

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

2 years ago[flang] Lower pointer component in derived type
Valentin Clement [Thu, 10 Mar 2022 19:19:57 +0000 (20:19 +0100)]
[flang] Lower pointer component in derived type

This patch lowers pointer component part of derived types to
FIR.

This patch is part of the upstreaming effort from fir-dev branch.

Depends on D121383

Reviewed By: PeteSteinfeld, schweitz

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

Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[lldb/crashlog] Reformat module loading logs (NFC)
Med Ismail Bennani [Thu, 10 Mar 2022 19:06:42 +0000 (11:06 -0800)]
[lldb/crashlog] Reformat module loading logs (NFC)

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years ago[lldb/Plugin] Test that a scripted process blueprint can be loaded for the dSYM
Med Ismail Bennani [Wed, 9 Mar 2022 19:11:49 +0000 (11:11 -0800)]
[lldb/Plugin] Test that a scripted process blueprint can be loaded for the dSYM

This patch ensures that lldb can automatically load a scripted process
blueprint from a dSYM bundle and launch a scripted process with it.

rdar://74502750

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years ago[lldb/crashlog] Make interactive mode display more user-friendly
Med Ismail Bennani [Wed, 9 Mar 2022 00:34:31 +0000 (16:34 -0800)]
[lldb/crashlog] Make interactive mode display more user-friendly

This patch makes the crashlog interactive mode show the scripted process
status with the crashed scripted thread backtrace after launching it.

rdar://89634338

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years ago[JMCInstrument] infer proper path style based on debug info
Yuanfang Chen [Thu, 10 Mar 2022 18:50:30 +0000 (10:50 -0800)]
[JMCInstrument] infer proper path style based on debug info

By default, the path style is decided by the host. This patch makes JMC
uses the path style used by the SP directory. This makes JMC output
host-independent.

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

Reviewed By: rnk

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

2 years ago[flang] Lower general forall statement
Valentin Clement [Thu, 10 Mar 2022 18:43:11 +0000 (19:43 +0100)]
[flang] Lower general forall statement

This patch lowers general forall statements. The forall
are lowered to nested loops.

This patch is part of the upstreaming effort from fir-dev branch.

Depends on D121385

Reviewed By: PeteSteinfeld, schweitz

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

Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[CMake] Include runtimes test suites in check-all
Petr Hosek [Wed, 9 Mar 2022 08:48:49 +0000 (00:48 -0800)]
[CMake] Include runtimes test suites in check-all

Prior to this change, we would make check-all depend on check-runtimes
which is a target that runs tests in the runtimes build. This means that
the runtimes tests are going to run prior to other test suites in
check-all, and if one of them fails, we won't run the other test suites
at all.

To address this issue, we instead collect the list of test suites and
their dependencies from the runtimes subbuild, and include them in
check-all, so a failure of runtimes test suite doesn't prevent other
test suites from being executed.

This addresses https://github.com/llvm/llvm-project/issues/54154.

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

2 years ago[AMDGPU] Use subreg encoding instead of reassign
Joe Nash [Thu, 10 Mar 2022 17:25:11 +0000 (12:25 -0500)]
[AMDGPU] Use subreg encoding instead of reassign

The HWEncoding for these 64 bit registers should be the same as as the
encoding for the previously defined low halves of the registers. So
reuse that value instead of repeating the assignment. NFC.

Reviewed By: foad

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

2 years agoFix the dates for the C and C++ language working group
Aaron Ballman [Thu, 10 Mar 2022 18:08:08 +0000 (13:08 -0500)]
Fix the dates for the C and C++ language working group

It's 1st and 3rd Wed of the month instead of every other.

2 years ago[RISCV] Add isel patterns for masked RISCVISD::FMA_VL with RISCVISD::FNEG_VL.
Craig Topper [Thu, 10 Mar 2022 17:37:03 +0000 (09:37 -0800)]
[RISCV] Add isel patterns for masked RISCVISD::FMA_VL with RISCVISD::FNEG_VL.

This helps us form vfnmsub, vfnmadd, and vfmusb from masked VP
intrinsics.

I've used "srcvalue" for the mask parameter in the fneg nodes. We
can't match "V0" because that doesn't ensure the mask the is the same.
Instead it matches two different nodes and generates two copies to
V0 of those separate values.

Reviewed By: rogfer01

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

2 years ago[InstCombine] replace negated operand in fcmp with 0.0
Sanjay Patel [Thu, 10 Mar 2022 17:37:36 +0000 (12:37 -0500)]
[InstCombine] replace negated operand in fcmp with 0.0

X (any pred) -X --> X (any pred) 0.0

This works with all FP values and preserves FMF.
Alive2 examples:
https://alive2.llvm.org/ce/z/dj6jhp

This can also create one of the patterns that we match as "fabs"
as shown in one of the test diffs.

2 years ago[InstCombine] add tests for fcmp with fneg common operand; NFC
Sanjay Patel [Thu, 10 Mar 2022 16:35:23 +0000 (11:35 -0500)]
[InstCombine] add tests for fcmp with fneg common operand; NFC

2 years ago[VP] Strided loads/stores
Lorenzo Albano [Thu, 10 Mar 2022 15:39:12 +0000 (16:39 +0100)]
[VP] Strided loads/stores

This patch introduces two new experimental IR intrinsics and SDAG nodes
to represent vector strided loads and stores.

Reviewed By: simoll

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

2 years ago[flang] Lower where statement
Valentin Clement [Thu, 10 Mar 2022 17:43:40 +0000 (18:43 +0100)]
[flang] Lower where statement

This patch lowers where statement to FIR.
The where statement is lowered to a conbination of
loops and if conditions.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[mlir][linalg] Add a few unary operations.
Bixia Zheng [Thu, 10 Mar 2022 17:08:41 +0000 (09:08 -0800)]
[mlir][linalg] Add a few unary operations.

Add operations abs, ceil, floor, and neg to the C++ API and Python API.

Add test cases.

Reviewed By: gysit

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

2 years ago[flang] Added basic connect to lower OpenMP constructs
Shraiysh Vaishay [Thu, 10 Mar 2022 17:10:23 +0000 (22:40 +0530)]
[flang] Added basic connect to lower OpenMP constructs

Reviewed By: clementval

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

2 years ago[flang] Lower basic derived types
Valentin Clement [Thu, 10 Mar 2022 17:06:20 +0000 (18:06 +0100)]
[flang] Lower basic derived types

This patch lowers basic derived type to FIR.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[MLIR][Presburger] Remove `spaceKind` from PresburgerSpace
Groverkss [Thu, 10 Mar 2022 16:48:44 +0000 (22:18 +0530)]
[MLIR][Presburger] Remove `spaceKind` from PresburgerSpace

This patch remove `spaceKind` from PresburgerSpace, making PresburgerSpace only
a space supporting relations.

Sets are still implemented in the same way, i.e. with a zero domain but instead
the asserts to check if the space is still set are added to users of
PresburgerSpace which treat it as a Set space.

Reviewed By: arjunp

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

2 years ago[BOLT] LongJmp: Use per-function alignment values
Vladislav Khmelevsky [Wed, 9 Mar 2022 16:28:06 +0000 (19:28 +0300)]
[BOLT] LongJmp: Use per-function alignment values

The per-function alignment values must be used in order to create
tentative layout.

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

2 years ago[mlir] ExecutionEngine: default enableObjectCache to false
Emilio Cota [Wed, 9 Mar 2022 15:08:17 +0000 (10:08 -0500)]
[mlir] ExecutionEngine: default enableObjectCache to false

The enableObjectCache option was added in
https://reviews.llvm.org/rG06e8101034e, defaulting to false. However,
the init code added there got its logic reversed
(cache(enableObjectCache ? nullptr : new SimpleObjectCache()), which was
fixed in https://reviews.llvm.org/rGd1186fcb04 by setting the default to
true, thereby preserving the existing behavior even if it was
unintentional.

Default now the object cache to false as it was originally intended.
While at it, mention in enableObjectCache's documentation how the
cache can be dumped.

Reviewed-by: mehdi_amini
Differential Revision: https://reviews.llvm.org/D121291

2 years agoCleanup includes: WindowsDriver & WindowsManifest
serge-sans-paille [Wed, 9 Mar 2022 21:27:35 +0000 (22:27 +0100)]
Cleanup includes: WindowsDriver & WindowsManifest

Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup
Differential Revision: https://reviews.llvm.org/D121330

2 years agotsan: fix another false positive related to open/close
Dmitry Vyukov [Thu, 10 Mar 2022 09:35:32 +0000 (10:35 +0100)]
tsan: fix another false positive related to open/close

The false positive fixed by commit f831d6fc80
("tsan: fix false positive during fd close") still happens episodically
on the added more stressful test which does just open/close.

I don't have a coherent explanation as to what exactly happens
but the fix fixes the false positive on this test as well.
The issue may be related to lost writes during asynchronous MADV_DONTNEED.
I've debugged similar unexplainable false positive related to freed and
reused memory and at the time the only possible explanation I found is that
an asynchronous MADV_DONTNEED may lead to lost writes. That's why commit
302ec7b9bc ("tsan: add memory_limit_mb flag") added StopTheWorld around
the memory flush, but unfortunately the commit does not capture these findings.

Reviewed By: melver

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

2 years ago[MLIR][OpenMP][NFC] Move the modifier testcases to correct directory
Shraiysh Vaishay [Thu, 10 Mar 2022 15:55:05 +0000 (21:25 +0530)]
[MLIR][OpenMP][NFC] Move the modifier testcases to correct directory

This patch moves the testcases from
`mlir/test/Target/LLVMIR/openmp-llvm-bad-schedule-modifier.mlir` to
`mlir/test/Dialect/OpenMP/invalid.mlir` as they test the verifier
(not the translation to LLVM IR).

Reviewed By: NimishMishra

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

2 years ago[MLIR] [CMake/Python] Fix ignored Python3_EXECUTABLE
John Demme [Thu, 10 Mar 2022 15:43:43 +0000 (07:43 -0800)]
[MLIR] [CMake/Python] Fix ignored Python3_EXECUTABLE

On Windows (at least), cmake ignores Python3_EXECUTABLE unless the
'Interpreter' component is being found. If the user is specifying a
different version than the latest installed (say, 3.8 vs 3.9) with the
Python3_EXECUTABLE, cmake was using a combination of the newest version
and the desired version. Mitigated by adding 'Interpreter' in the first
invocation like the second one.

2 years agoRevert "[InstCombine] fold fcmp with lossy casted constant"
Sanjay Patel [Thu, 10 Mar 2022 15:22:22 +0000 (10:22 -0500)]
Revert "[InstCombine] fold fcmp with lossy casted constant"

This reverts commit 9397bdc67eb2b9eedc247a89bef01c2484b48b89.

This optimization is likely to surprise programmers as seen
in post-commit comments, so we should add a clang warning
first (that is proposed in D121306).

2 years ago[AArch64] Fix type in comment. NFC
David Green [Thu, 10 Mar 2022 15:03:27 +0000 (15:03 +0000)]
[AArch64] Fix type in comment. NFC

2 years ago[GlobalOpt] Handle undef global_ctors gracefully
Nikita Popov [Thu, 10 Mar 2022 15:01:09 +0000 (16:01 +0100)]
[GlobalOpt] Handle undef global_ctors gracefully

If there are no ctors, then this can have an arbirary zero-sized
value. The current code checks for null, but it could also be
undef or poison.

Replacing the specific null check with a check for
non-ConstantArray.

2 years ago[BitcodeReader] Support GEP without indices
Nikita Popov [Thu, 10 Mar 2022 14:47:58 +0000 (15:47 +0100)]
[BitcodeReader] Support GEP without indices

LLVM considers these to be legal, so make sure the bitcode reader
can read them. I broke this when implementing opaque pointer
auto upgrade support.

2 years ago[AArch64] TBL uses zero for out of range elements.
David Green [Thu, 10 Mar 2022 14:45:13 +0000 (14:45 +0000)]
[AArch64] TBL uses zero for out of range elements.

A TBL instruction will use zero for any out of range values. We can use
this in GenerateTBL to help turn a TBL2 into a TBL1, avoiding the need
to materialise the zero.

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

2 years ago[libc] Initial support for darwin-aarch64.
Tue Ly [Thu, 10 Mar 2022 14:25:54 +0000 (09:25 -0500)]
[libc] Initial support for darwin-aarch64.

Add initial support for darwin-aarch64 (macOS M1).

Some differences compared to linux-aarch64:
- `math.h` defined `math_errhandling` by the compiler builtin `__math_errhandling()` but Apple Clang 13.0.0 on M1 does not support `__math_errhandling()` builtin as a macro function or a constexpr function.
- `math.h` defines `UNDERFLOW` and `OVERFLOW` macros.
- Besides 5 usual floating point exceptions: `FE_INEXACT`, `FE_UNDERFLOW`, `FE_OVERFLOW`, `FE_DIVBYZERO`, and `FE_INVALID`, `fenv.h` also has another floating point exception: `FE_FLUSHTOZERO`.  The corresponding trap for `FE_FLUSHTOZERO` in the control register is at the different location compared to the status register.
- `FE_FLUSHTOZERO` exception flag cannot be raised with the default CPU floating point operation mode.

Reviewed By: sivachandra

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

2 years ago[libc++] Bump minimum compiler requirements
Louis Dionne [Wed, 2 Feb 2022 18:08:52 +0000 (13:08 -0500)]
[libc++] Bump minimum compiler requirements

Now that we've branched for the LLVM 14 release, our support window
moves to clang-13 and clang-14. Similarly, AppleClang 13 has been
released for some time now, so that should be the oldest compiler
we support, per our policy.

A possible follow-up would be to remove _LIBCPP_HAS_NO_CONCEPTS, since
I don't think we support any compiler that doesn't support concepts
anymore.

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

2 years ago[AArch64] Extra tests for tbl with zero elements. NFC
David Green [Thu, 10 Mar 2022 13:51:04 +0000 (13:51 +0000)]
[AArch64] Extra tests for tbl with zero elements. NFC

2 years ago[libc++] Add test coverage for std::shared_ptr<const T>
Louis Dionne [Wed, 9 Mar 2022 22:06:16 +0000 (17:06 -0500)]
[libc++] Add test coverage for std::shared_ptr<const T>

Those tests were extracted from D120996.

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

2 years agoCleanup includes: MCDisassembler
serge-sans-paille [Wed, 9 Mar 2022 21:26:23 +0000 (22:26 +0100)]
Cleanup includes: MCDisassembler

Some extra minor cleanup.

Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup
Differential Revision: https://reviews.llvm.org/D121329

2 years ago[FuzzMutate] Support opaque pointers
Nikita Popov [Thu, 10 Mar 2022 13:18:37 +0000 (14:18 +0100)]
[FuzzMutate] Support opaque pointers

Avoid checks that are irrelevant for opaque pointers, and pick
load/GEP types independently of the pointer type.

The GEP case at least could be done more efficiently by directly
generating a type, but this would require some significant API
changes.

2 years ago[InstCombine] Add vector support to icmp(add(X,C1),add(Y,C2)) -> icmp(add(X,C1-C2...
Simon Pilgrim [Thu, 10 Mar 2022 13:30:42 +0000 (13:30 +0000)]
[InstCombine] Add vector support to icmp(add(X,C1),add(Y,C2)) -> icmp(add(X,C1-C2),Y) fold

As discussed on Issue #32161 this fold can be generalized a lot more than it currently is, but this patch at least adds vector support.

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

2 years ago[X86] Add GFNI shift/rotate/funnel-shift vXi8 by constant splat tests
Simon Pilgrim [Thu, 10 Mar 2022 13:25:06 +0000 (13:25 +0000)]
[X86] Add GFNI shift/rotate/funnel-shift vXi8 by constant splat tests

GFNI can efficiently perform vXi8 shift/rotates by constant splats using X86ISD::GF2P8AFFINEQB

2 years agoFix M68k missing header errors.
Simon Pilgrim [Thu, 10 Mar 2022 13:18:10 +0000 (13:18 +0000)]
Fix M68k missing header errors.

2 years ago[PhaseOrdering][x86] add TODO comments to test files; NFC
Sanjay Patel [Thu, 10 Mar 2022 13:08:33 +0000 (08:08 -0500)]
[PhaseOrdering][x86] add TODO comments to test files; NFC

The intended folds were removed because an underlying
analysis was not correct ( b48fe158e0a8 ).

2 years agoRevert "Cleanup codegen includes"
Nico Weber [Thu, 10 Mar 2022 12:54:41 +0000 (07:54 -0500)]
Revert "Cleanup codegen includes"

This reverts commit 7f230feeeac8a67b335f52bd2e900a05c6098f20.
Breaks CodeGenCUDA/link-device-bitcode.cu in check-clang,
and many LLVM tests, see comments on https://reviews.llvm.org/D121169

2 years ago[OpenMP][mlir] Lowering for omp.atomic.update
Shraiysh Vaishay [Thu, 10 Mar 2022 12:58:08 +0000 (18:28 +0530)]
[OpenMP][mlir] Lowering for omp.atomic.update

This patch adds lowering from omp.atomic.update to LLVM IR. Whenever a
special LLVM IR instruction is available for the operation, `atomicrmw`
instruction is emitted, otherwise a compare-exchange loop based update
is emitted.

Depends on D119522

Reviewed By: ftynse, peixin

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

2 years ago[AArch64] Move fp16 cast tests.
Florian Hahn [Thu, 10 Mar 2022 12:22:05 +0000 (12:22 +0000)]
[AArch64] Move fp16 cast tests.

Move FP16 tests to fp16cast function, as suggested in D113700.

2 years ago[gn build] (manually) port af98b0af6705
Nico Weber [Thu, 10 Mar 2022 12:14:07 +0000 (07:14 -0500)]
[gn build] (manually) port af98b0af6705

2 years ago[AMDGPU] Enable divergence predicates for negative inline constant subtraction
alex-t [Thu, 10 Mar 2022 09:57:15 +0000 (12:57 +0300)]
[AMDGPU] Enable divergence predicates for negative inline constant subtraction

We have a pattern that undo sub x, c -> add x, -c canonicalization since c is more likely
 an inline immediate than -c. This patch enables it to select scalar or vector subtracion by the input node divergence.

Reviewed By: foad

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

2 years ago[clang][dataflow] Add analysis that detects unsafe accesses to optionals
Stanislav Gatev [Thu, 10 Mar 2022 08:57:32 +0000 (08:57 +0000)]
[clang][dataflow] Add analysis that detects unsafe accesses to optionals

This commit reverts e0cc28dfdc67105974924cce42bb8c85bd44925a and moves
UncheckedOptionalAccessModelTest.cpp into clang/unittests/Analysis/FlowSensitive,
to avoid build failures. The test will be moved back into a Models subdir
in a follow up patch that will address the build configuration issues.

Original description:

Adds a dataflow analysis that detects unsafe accesses to values of type
`std::optional`, `absl::optional`, or `base::Optional`.

Reviewed-by: ymandel, xazax.hun
Differential Revision: https://reviews.llvm.org/D121197

2 years ago[AMDGPU] Fix regenerated test checks (NFC)
Nikita Popov [Thu, 10 Mar 2022 10:55:58 +0000 (11:55 +0100)]
[AMDGPU] Fix regenerated test checks (NFC)

I used the wrong build to generate the checks, sorry :(

2 years ago[AMDGPU] Regenerate test checks (NFC)
Nikita Popov [Thu, 10 Mar 2022 10:53:45 +0000 (11:53 +0100)]
[AMDGPU] Regenerate test checks (NFC)

2 years ago[AMDGPU] Regenerate test checks (NFC)
Nikita Popov [Thu, 10 Mar 2022 10:14:45 +0000 (11:14 +0100)]
[AMDGPU] Regenerate test checks (NFC)

Also rename variables to avoid file check clash.

2 years ago[MLIR][Presburger] fix vector update in coalesce
Michel Weber [Thu, 10 Mar 2022 10:12:06 +0000 (15:42 +0530)]
[MLIR][Presburger] fix vector update in coalesce

When `addCoalescedPolyhedron` was called with `j == n - 1`,
the `polyhedrons`-vector was not properly updated (the
`IntegerPolyhedron` at position `n - 2` was "lost"). This patch adds
special handling to that case and a regression testcase.

Reviewed By: Groverkss

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

2 years ago[MLIR][Presburger] Use IdKind for removeIdRange in PresburgerSpace
Groverkss [Thu, 10 Mar 2022 10:09:32 +0000 (15:39 +0530)]
[MLIR][Presburger] Use IdKind for removeIdRange in PresburgerSpace

This patch moves PresburgerSpace::removeIdRange(idStart, idLimit) to
PresburgerSpace::removeIdRange(kind, idStart, idLimit), i.e. identifiers
can only be removed at once for a single kind.

This makes users of PresburgerSpace to not assume any inside ordering of
identifier kinds.

Reviewed By: arjunp

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

2 years ago[LoongArch] Add basic support to Disassembler
Weining Lu [Thu, 10 Mar 2022 08:35:38 +0000 (16:35 +0800)]
[LoongArch] Add basic support to Disassembler

With the addition of disassembler now we can do instructions 'round-trip' test
that assembles `.s` to obj with `llvm-mc` and disassembles it with `llvm-objdump`
to check instruction mnemonics.

Reviewed By: xen0n, MaskRay

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

2 years agoAdd missing include in llvm/CodeGen/CodeGenPassBuilder.h
serge-sans-paille [Thu, 10 Mar 2022 09:05:14 +0000 (10:05 +0100)]
Add missing include in llvm/CodeGen/CodeGenPassBuilder.h

As a follow-up to 7f230feeeac8

2 years ago[InstCombine] Add vector tests for icmp_eq(add(X,C1),add(Y,C2)) -> icmp_eq(add(X...
Simon Pilgrim [Thu, 10 Mar 2022 09:00:40 +0000 (09:00 +0000)]
[InstCombine] Add vector tests for icmp_eq(add(X,C1),add(Y,C2)) -> icmp_eq(add(X,C1-C2),Y)

As mentioned on Issue #32161 we don't even have uniform vector support for this fold

2 years agoCleanup codegen includes
serge-sans-paille [Mon, 7 Mar 2022 23:25:52 +0000 (00:25 +0100)]
Cleanup codegen includes

after:  1061034926
before: 1063332844

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

2 years agoCleanup includes: LLVMTarget
serge-sans-paille [Mon, 7 Mar 2022 23:25:11 +0000 (00:25 +0100)]
Cleanup includes: LLVMTarget

Most notably, Pass.h is no longer included by TargetMachine.h
before: 1063570306
after:  1063332844

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

2 years ago[Coroutines] Support opaque pointers in solveTypeName()
Nikita Popov [Fri, 4 Mar 2022 12:25:05 +0000 (13:25 +0100)]
[Coroutines] Support opaque pointers in solveTypeName()

As far as I can tell, these names are only intended to be
informative, so just use a generic "PointerType" for opaque pointers.

The code in solveDIType() also treats pointers as basic types (and
does not try to encode the pointed-to type further), so I believe
this should be fine.

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

2 years ago[RISCV] Add fixed-length vector instrinsics for segment load
Luke [Sun, 13 Feb 2022 14:22:34 +0000 (22:22 +0800)]
[RISCV] Add fixed-length vector instrinsics for segment load

Inspired by reviews.llvm.org/D107790.

Reviewed By: craig.topper

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

2 years ago[RISCV] Remove RISCVISD::VLE_VL/VSE_VL. Use intrinsics instead.
Craig Topper [Thu, 10 Mar 2022 06:44:27 +0000 (22:44 -0800)]
[RISCV] Remove RISCVISD::VLE_VL/VSE_VL. Use intrinsics instead.

Similar to what we do for other loads/stores, use the intrinsic
version that we already have custom isel for.

Reviewed By: rogfer01

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

2 years ago[RISCV] Add tests showing the optimization pipeline for O0 and O3.
Craig Topper [Thu, 10 Mar 2022 04:39:14 +0000 (20:39 -0800)]
[RISCV] Add tests showing the optimization pipeline for O0 and O3.

Other targets like ARM, AArch64, and X86 have similar tests.

Reviewed By: asb

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