Fangrui Song [Tue, 6 Jun 2023 04:33:10 +0000 (21:33 -0700)]
[AArch64,AVR,PowerPC] Migrate to new encodeInstruction that uses SmallVectorImpl<char>. NFC
Similar to
49488490d195591bfc90daef111cd7293f8c80aa.
khei4 [Sun, 4 Jun 2023 04:07:02 +0000 (13:07 +0900)]
[InstCombine] add overflow checking on Add ~X + C --> (C-1) - X
Differential Revision: https://reviews.llvm.org/D152088
khei4 [Sun, 4 Jun 2023 04:06:06 +0000 (13:06 +0900)]
[InstCombine] precommit test for D152088(NFC)
Differential Revision: https://reviews.llvm.org/D152089
Ben Shi [Mon, 5 Jun 2023 08:23:38 +0000 (16:23 +0800)]
[AVR][NFC][test] Supplement more tests of 8-bit rotation
Reviewed By: Patryk27, jacquesguan
Differential Revision: https://reviews.llvm.org/D152129
Phoebe Wang [Tue, 6 Jun 2023 02:46:37 +0000 (10:46 +0800)]
Reland "[X86][NFC] Refactor: there's only v16bf16 in 256-bit shuffle"
Phoebe Wang [Tue, 6 Jun 2023 02:41:26 +0000 (10:41 +0800)]
Revert "[X86][NFC] Refactor: there's only v16bf16 in 256-bit shuffle"
This reverts commit
50a2341fe92f8a5ff934bd279450581e9cbcf103.
This results in buildbot fail.
Peter Klausler [Fri, 2 Jun 2023 23:30:43 +0000 (16:30 -0700)]
[flang] Fix crash in shape analysis of PACK()
A CHECK() was firing when a call to the PACK intrinsic does not have a
VECTOR= argument and at least one dimension of the shape of the ARRAY=
argument could not be determined. The CHECK was inappropriate, since
this can of course happen, such as when that argument is the result
of the SPREAD() intrinsic with non-constant DIM= or NCOPIES= arguments.
Replace with an if() statement.
Differential Revision: https://reviews.llvm.org/D152212
Phoebe Wang [Tue, 6 Jun 2023 02:24:37 +0000 (10:24 +0800)]
[X86][NFC] Refactor: there's only v16bf16 in 256-bit shuffle
Jianjian GUAN [Fri, 2 Jun 2023 04:01:10 +0000 (12:01 +0800)]
[RISCV] Improve selection for vector fpclass.
Since vfclass intruction will only set one single bit in the result, so if we only want to check 1 fp class, we could use vmseq to do it.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D151967
varconst [Sat, 3 Jun 2023 02:23:29 +0000 (19:23 -0700)]
[libc++][ranges] Implement the changes to container adaptors from P1206 (`ranges::to`):
- add the `from_range_t` constructors and the related deduction guides;
- add the `push_range` member function.
(Note: this patch is split from https://reviews.llvm.org/D142335)
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D149829
Sam James [Tue, 6 Jun 2023 01:08:01 +0000 (02:08 +0100)]
[CMake] Quote variables where "TARGET" may be a value
In CMake, "TARGET" is a special keyword. But it's also an LLVM component, which
means downstreams may request "target" or "TARGET" from CMake. Quote such input
so "TARGET" is interpreted as a string rather than a keyword.
This is a followup to
75a0502fe0053c72b57b61143a55600814d931fd (D150884).
Fixes Meson's test suite and an issue which manifested identically to #61436
but appears to have been a slightly different problem.
Bug: https://github.com/mesonbuild/meson/issues/11642
Bug: https://github.com/llvm/llvm-project/issues/61436
Reviewed By: tstellar
Differential Revision: https://reviews.llvm.org/D152121
Matt Arsenault [Tue, 6 Jun 2023 00:44:38 +0000 (20:44 -0400)]
AMDGPU: Fix broken test
Matt Arsenault [Mon, 5 Jun 2023 13:03:54 +0000 (09:03 -0400)]
AutoUpgrade: Fix crash when tbaa has an empty argument
Produce a verifier error instead.
Aiden Grossman [Mon, 5 Jun 2023 19:57:13 +0000 (19:57 +0000)]
[CMake][libc] Don't put archive in build/lib/<target triple> by default
ea8f4b98419750c8cc7c60ea43b570adf47b3f78 broke some build configurations
because it was enabled by default and some people are using a just built
libc/clang/LLVM to work on other projects where having a just built LLVM
libc in one of Clang's default include directories can make things
unusable.
Differential Revision: https://reviews.llvm.org/D152190
Joseph Huber [Mon, 5 Jun 2023 23:56:26 +0000 (18:56 -0500)]
[libc] Replace the `PRINT_TO_STDERR` opcode for RPC printing.
A previous patch added general support for printing via the RPC
interface. we should consolidate this functionality and get rid of the
old opcode that was used for simple testing.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D152211
Aart Bik [Tue, 6 Jun 2023 00:16:18 +0000 (17:16 -0700)]
bazel build fix
Reviewed By: Peiming, manishucsd
Differential Revision: https://reviews.llvm.org/D152214
Johannes Doerfert [Thu, 18 May 2023 23:46:11 +0000 (16:46 -0700)]
[Attributor] Identify and remove no-op fences
The logic and implementation follows the removal of no-op barriers. If
the fence is not making updates visible, either to the world or the
current thread, it is not needed. Said differently, the fences we remove
do not establish synchronization (happens-before) edges.
This allows us to eliminate some of the regression caused by:
https://reviews.llvm.org/D145290
NAKAMURA Takumi [Mon, 5 Jun 2023 23:29:08 +0000 (08:29 +0900)]
test/AMDGPU: REQUIRES asserts (D148184)
NAKAMURA Takumi [Mon, 5 Jun 2023 23:34:01 +0000 (08:34 +0900)]
RISCVISelLowering.cpp: Suppress a warning. (D150824)
Johannes Doerfert [Sat, 3 Jun 2023 02:30:17 +0000 (19:30 -0700)]
[Attributor] Merge ranges by expansion, avoid unknown ranges
Different offsets can be handled by expansion rather than defaulting to
an unknown offset. Thus, [4,4] & [8,8] will result in [4, 12] rather
than [unknown, unknown].
Johannes Doerfert [Sat, 3 Jun 2023 04:46:43 +0000 (21:46 -0700)]
[Attributor][NFC] Precommit vector write range tests
Joseph Huber [Mon, 5 Jun 2023 23:49:35 +0000 (18:49 -0500)]
[libc][obvious] Fix conditional when CUDA is not found
If CUDA is not found this string will expand into nothing. We need to
surround it with a string otherwise it will cause build failures.
Differential Revision: https://reviews.llvm.org/D152209
Peiming Liu [Mon, 5 Jun 2023 22:26:30 +0000 (22:26 +0000)]
[mlir][sparse] fix crashes when using custom reduce with unary operation.
The tests case is directly copied from https://reviews.llvm.org/D152179 authored by @aartbik
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D152204
Johannes Doerfert [Thu, 18 May 2023 21:49:40 +0000 (14:49 -0700)]
[OpenMP] Improve default block count selection fow low block counts
If a combined loop has insufficient parallelism (= low trip count), we
might end up with too few teams/blocks. To counter that we can reduce
the number of threads per team we use. This patch implements a heuristic
and exposes a new environment variable to control the minimum of threads
to be employed in this case.
Issue reported by:
Felipe Cabarcas Jaramillo <cabarcas@udel.edu> (@fel-cab).
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D152014
Johannes Doerfert [Sat, 3 Jun 2023 01:35:53 +0000 (18:35 -0700)]
[OpenMP] Use "kernel" attribute consistently
Johannes Doerfert [Thu, 18 May 2023 20:39:57 +0000 (13:39 -0700)]
[OpenMP] Mark kernels as mustprogress
Johannes Doerfert [Mon, 15 May 2023 22:53:44 +0000 (15:53 -0700)]
[Attributor] Create `AAMustProgress` for the `mustprogress` attribute
Derive the mustprogress attribute based on the willreturn attribute
or the fact that all callers are mustprogress.
Differential Revision: https://reviews.llvm.org/D94740
usama hameed [Fri, 2 Jun 2023 20:46:10 +0000 (13:46 -0700)]
[Sanitizers][Darwin] In DlAddrSymbolizer, return only the module file name instead of the comlpete module path during symbolication.
rdar://
108858834
Differential Revision: https://reviews.llvm.org/D152029
Manish Gupta [Thu, 1 Jun 2023 02:00:56 +0000 (02:00 +0000)]
[mlir][Vector] Adds a pattern to fold `arith.extf` into `vector.contract`
Consider mixed precision data type, i.e., F16 input lhs, F16 input rhs, F32 accumulation, and F32 output. This is typically written as F32 <= F16*F16 + F32.
During vectorization from linalg to vector for mixed precision data type (F32 <= F16*F16 + F32), linalg.matmul introduces arith.extf on input lhs and rhs operands.
"linalg.matmul"(%lhs, %rhs, %acc) ({
^bb0(%arg1: f16, %arg2: f16, %arg3: f32):
%lhs_f32 = "arith.extf"(%arg1) : (f16) -> f32
%rhs_f32 = "arith.extf"(%arg2) : (f16) -> f32
%mul = "arith.mulf"(%lhs_f32, %rhs_f32) : (f32, f32) -> f32
%acc = "arith.addf"(%arg3, %mul) : (f32, f32) -> f32
"linalg.yield"(%acc) : (f32) -> ()
})
There are backend that natively supports mixed-precision data type and does not need the arith.extf. For example, NVIDIA A100 GPU has mma.sync.aligned.*.f32.f16.f16.f32 that can support mixed-precision data type. However, the presence of arith.extf in the IR, introduces the unnecessary casting targeting F32 Tensor Cores instead of F16 Tensor Cores for NVIDIA backend. This patch adds a folding pattern to fold arith.extf into vector.contract
Differential Revision: https://reviews.llvm.org/D151918
Stevengre [Mon, 5 Jun 2023 23:06:33 +0000 (16:06 -0700)]
issue#62488: Correct some syntax errors. Leave location and custom-operation-format unchanged, because I'm not sure.
Reviewed By: Mogball
Differential Revision: https://reviews.llvm.org/D149810
Joseph Huber [Wed, 24 May 2023 03:35:21 +0000 (22:35 -0500)]
[libc] Add initial support for 'puts' and 'fputs' to the GPU
This patch adds the initial support required to support basic priting in
`stdio.h` via `puts` and `fputs`. This is done using the existing LLVM C
library `File` API. In this sense we can think of the RPC interface as
our system call to dump the character string to the file. We carry a
`uintptr_t` reference as our native "file descriptor" as it will be used
as an opaque reference to the host's version once functions like
`fopen` are supported.
For some unknown reason the declaration of the `StdIn` variable causes
both the AMDGPU and NVPTX backends to crash if I use the `READ` flag.
This is not used currently as we only support output now, but it needs
to be fixed
Reviewed By: sivachandra, lntue
Differential Revision: https://reviews.llvm.org/D151282
Joseph Huber [Tue, 30 May 2023 17:08:44 +0000 (12:08 -0500)]
[libc] Implement basic `malloc` and `free` support on the GPU
This patch adds support for the `malloc` and `free` functions. These
currently aren't implemented in-tree so we first add the interface
filies.
This patch provides the most basic support for a true `malloc` and
`free` by using the RPC interface. This is functional, but in the future
we will want to implement a more intelligent system and primarily use
the RPC interface more as a `brk()` or `sbrk()` interface only called
when absolutely necessary. We will need to design an intelligent
allocator in the future.
The semantics of these memory allocations will need to be checked. I am
somewhat iffy on the details. I've heard that HSA can allocate
asynchronously which seems to work with my tests at least. CUDA uses an
implicit synchronization scheme so we need to use an explicitly separate
stream from the one launching the kernel or the default stream. I will
need to test the NVPTX case.
I would appreciate if anyone more experienced with the implementation details
here could chime in for the HSA and CUDA cases.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D151735
Matt Arsenault [Mon, 5 Jun 2023 19:13:01 +0000 (15:13 -0400)]
AMDGPU: Add baseline test for undoing mul add 1 reassociation
Add some tests for combines to undo regressions caused by
0cfc6510323fbb5a56a5de23cbc65f7cc30fd34c.
Matt Arsenault [Mon, 5 Jun 2023 12:46:33 +0000 (08:46 -0400)]
DAG: Reorder conditions
Hansang Bae [Thu, 4 May 2023 14:35:38 +0000 (09:35 -0500)]
[OpenMP][libomp] Allow white spaces in OMP_TARGET_OFFLOAD value
Remove heading/trailing white spaces when matching OMP_TARGET_OFFLOAD
value.
Differential Revision: https://reviews.llvm.org/D149890
Matt Arsenault [Mon, 5 Jun 2023 17:04:37 +0000 (13:04 -0400)]
AMDGPU: Fold zext into result of v_mad_u16 on high zeroing targets
Avoids regressions in future patch.
Matt Arsenault [Mon, 5 Jun 2023 17:52:12 +0000 (13:52 -0400)]
AMDGPU: Add baseline 16-bit mad matching tests
Matt Arsenault [Mon, 5 Jun 2023 17:51:03 +0000 (13:51 -0400)]
AMDGPU: Convert test to generated checks
Peter Klausler [Mon, 5 Jun 2023 21:58:20 +0000 (14:58 -0700)]
[flang] Pad output correctly after tabbing with ADVANCE='no' (bug#63111)
Correct the code that implements the production of spaces to bring the
furthestPositionInRecord up to a positionInRecord that was tabbed forward
by a T or TR control edit descriptor.
Fixes bug https://github.com/llvm/llvm-project/issues/63111.
Differential Revision: https://reviews.llvm.org/D152201
Aart Bik [Mon, 5 Jun 2023 22:13:32 +0000 (15:13 -0700)]
fix build issue on bazel
Needed to fix:
https://github.com/llvm/llvm-project/commit/
53a5c3ab4dbe434753e0e4e3505efa2e5692e752
https://github.com/llvm/llvm-project/commit/
db7cc0348c9a0aa44b23948949afef488d5083dd
Reviewed By: Peiming, anlunx
Differential Revision: https://reviews.llvm.org/D152202
Florian Mayer [Mon, 5 Jun 2023 21:14:27 +0000 (14:14 -0700)]
[hwasan] Properly restore SP tag on exceptions
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D152036
Siva Chandra Reddy [Sat, 3 Jun 2023 23:04:20 +0000 (23:04 +0000)]
[bazel][libc] Add targets for integer abs and div functions.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D152084
Nikolas Klauser [Mon, 5 Jun 2023 22:07:42 +0000 (15:07 -0700)]
[libc++][NFC] Add __element_count and use it in the constexpr C functions
This makes it less ambiguous what the parameter is meant to get.
Reviewed By: #libc, ldionne
Spies: ldionne, libcxx-commits
Differential Revision: https://reviews.llvm.org/D152040
Craig Topper [Mon, 5 Jun 2023 22:02:11 +0000 (15:02 -0700)]
[RISCV] Lower experimental_get_vector_length intrinsic to vsetvli for some cases.
This patch lowers to vsetvli when the AVL is i32 or XLenVT and
the VF is a power of 2 in the range [1, 64]. VLEN=32 is not supported
as we don't have a valid type mapping for that. VF=1 is not supported
with Zve32* only.
The element width is used to set the SEW for the vsetvli if possible.
Otherwise we use SEW=8.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D150824
Nick Desaulniers [Mon, 5 Jun 2023 21:31:55 +0000 (14:31 -0700)]
[Demangle] refactor DLangDemangle to use std::string_view
Many existing methods of the D Language Demangler take a C style string
and return an adjusted pointer to the same object as the input string is
consumed.
Make it more obvious by changing the signatures to accept
std::string_view& when the input is modified vs a copy of a
std::string_view when the input is not.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D152177
Fangrui Song [Mon, 5 Jun 2023 21:36:19 +0000 (14:36 -0700)]
[lld] StringRef::{starts,ends}with => {starts,ends}_with. NFC
The latter form is now preferred to be similar to C++20 starts_with.
This replacement also removes one function call when startswith is not inlined.
Arthur Eubanks [Thu, 23 Feb 2023 19:21:33 +0000 (11:21 -0800)]
Reland [compiler-rt][CMake] Properly set COMPILER_RT_HAS_LLD
LLVM_TOOL_LLD_BUILD is a relic of the pre-monorepo times. This causes us to never set COMPILER_RT_HAS_LLD.
Instead, set it from the runtimes build if lld is being built and lld is used as the compiler-rt linker.
Mark a test that requires libstdc++ as requiring Android, as other platforms may not have a libstdc++ lying around.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D144660
Craig Topper [Mon, 5 Jun 2023 20:47:28 +0000 (13:47 -0700)]
[RISCV] Add RISCVISD nodes for vfwadd/vfwsub.
Add a DAG combine to form these from FADD_VL/FSUB_VL and FP_EXTEND_VL.
This makes it similar to other widening ops and allows us to handle
using the same FP_EXTEND_VL for both operands.
Differential Revision: https://reviews.llvm.org/D151969
Craig Topper [Mon, 5 Jun 2023 20:47:22 +0000 (13:47 -0700)]
[RISCV] Rename SDT_RISCVVWBinOpW_VL->SDT_RISCVVWIntBinOpW_VL. NFC
Preparation for D151969 which adds an FP version.
Alex Langford [Fri, 2 Jun 2023 01:26:33 +0000 (18:26 -0700)]
[lldb][NFCI] Change the way Process stores StructuredData plugins
Instead of having a map from ConstString to StructuredDataPluginSP, we
can use an llvm::StringMap. The keys themselves don't need to be
ConstStrings, so an llvm::StringMap feels most natural.
Differential Revision: https://reviews.llvm.org/D151960
Sami Tolvanen [Mon, 5 Jun 2023 16:37:12 +0000 (16:37 +0000)]
[Driver] Allow -fsanitize=kcfi with -fsanitize-minimal-runtime
Having both UBSan with the minimal runtime and KCFI enabled can be
useful in low-level software. As there are no conflicts between the
flags, add KCFI to the list of compatible sanitizers.
Jessica Clarke [Mon, 5 Jun 2023 20:25:04 +0000 (21:25 +0100)]
[RISCV][test] Fix a couple of whitespace issues
Kazu Hirata [Mon, 5 Jun 2023 20:18:07 +0000 (13:18 -0700)]
[ADT] Deprecate StringRef::{starts,ends}with_insensitive
This patch deprecates StringRef::{starts,ends}with_insensitive as
their uses have migrated to {starts,ends}_with_insensitive,
respectively.
Differential Revision: https://reviews.llvm.org/D152108
Kazu Hirata [Mon, 5 Jun 2023 20:18:05 +0000 (13:18 -0700)]
[Support] Remove {Bits,Float,Double}To{Bits,Float,Double}
These functions have been deprecated since:
commit
0f52c1f86c62dadf69a7b732779abf59edea3d5c
Author: Kazu Hirata <kazu@google.com>
Date: Tue Feb 14 09:52:36 2023 -0800
Differential Revision: https://reviews.llvm.org/D152110
Kazu Hirata [Mon, 5 Jun 2023 20:18:03 +0000 (13:18 -0700)]
[Support] Remove PowerOf2Floor and ByteSwap_{16,32,64}
These functions have been deprecated since:
commit
b49b429fde3a282664289d7a2155d994085eb232
Author: Kazu Hirata <kazu@google.com>
Date: Sun Feb 12 21:42:07 2023 -0800
Differential Revision: https://reviews.llvm.org/D152111
Alex Langford [Fri, 2 Jun 2023 17:19:57 +0000 (10:19 -0700)]
[lldb][NFCI] ConstString methods should take StringRefs by value
StringRef was made to be passed by value efficiently.
Differential Revision: https://reviews.llvm.org/D152010
Amir Ayupov [Mon, 5 Jun 2023 20:02:59 +0000 (13:02 -0700)]
[BOLT][NFC] Drop MMap events for deleted files
Don't parse/handle mmap events with "(deleted)" filename.
Reviewed By: #bolt, rafauler
Differential Revision: https://reviews.llvm.org/D151948
Nick Desaulniers [Mon, 5 Jun 2023 19:53:38 +0000 (12:53 -0700)]
[Demangle] convert microsoftDemangle to take a std::string_view
This should be last of the "bottom-up conversions" of various demanglers
to accept std::string_view. After this, D149104 may be revisited.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D152176
Kazu Hirata [Mon, 5 Jun 2023 19:59:58 +0000 (12:59 -0700)]
[Sema] Fix a warning
This patch fixes:
clang/lib/Sema/SemaExprCXX.cpp:5591:3: error: default label in
switch which covers all enumeration values
[-Werror,-Wcovered-switch-default]
David Blaikie [Mon, 5 Jun 2023 19:57:11 +0000 (19:57 +0000)]
llvm-dwarfdump --verify: Add support for .debug_str_offsets[.dwo]
Had a couple of issues lately causing corrupted strings due to
problematic str_offsets (overflow due to >4GB .debug_str.dwo section in
a dwp and the dwp tool silently overflowing the 32 bit offsets updated
in the .debug_str_offsets.dwo section, and then more recently two CUs in
a dwo caused the dwp tool to reapply the offset adjustment twice
corrupting str_offsets.dwo as well) - so let's check that the offsets
are valid.
This assumes no suffix merging - if anyone implements that, then this
checking should just be removed for the most part (we could still check
the offsets are within the bounds of .debug_str[.dwo], but nothing more
- any offset in the range would be valid, the offsets wouldn't have to
land at the start of a string)
Alex Langford [Thu, 1 Jun 2023 23:23:25 +0000 (16:23 -0700)]
[lldb][NFCI] Use size_t in OptionValueProperties
In many places we're using uint32_t where we should be using size_t.
We should be consistent.
Differential Revision: https://reviews.llvm.org/D151949
Pierre Calixte [Mon, 5 Jun 2023 19:51:26 +0000 (12:51 -0700)]
Test case improvement (Do not optimize debug locations across section boundaries/D149294)
Ensure that the expected location directives are from different sections.
Differential Revision: https://reviews.llvm.org/D150308
Alex Langford [Fri, 2 Jun 2023 01:37:37 +0000 (18:37 -0700)]
[lldb][NFCI] Change return type of REPL::GetSourceFileBasename
These don't really need to be in the ConstString StringPool. I've
changed the return type to StringRef because on llvm.org and downstream
in the swift fork, this returns a constant value. We could change it to
return a std::string or something else if it needs to be able to change
between calls.
Differential Revision: https://reviews.llvm.org/D151962
Artem Belevich [Mon, 5 Jun 2023 19:44:05 +0000 (12:44 -0700)]
[NVPTX] fixed vector-compare test.
Apparently this test didn't actually test anything other that the IR compiles.
Peter Klausler [Mon, 5 Jun 2023 18:31:53 +0000 (11:31 -0700)]
[flang] Fix crash from bug#63099 (gfortran/regression/oldstyle_3.f90)
In InitElement() in flang/lib/Semantics/data-to-inits.cpp, don't
assume that values_.Location() can be called until after it has been
verified that values_.IsAtEnd() is not true.
Fixes https://github.com/llvm/llvm-project/issues/63099.
Differential Revision: https://reviews.llvm.org/D152183
Artem Belevich [Sat, 27 May 2023 00:11:23 +0000 (17:11 -0700)]
Coalesce 16-bit FP types to use integer register classes.
i16/f16/bf16 will use the same .b16 registers and
i32/v2f16 and v2bf16 will share .b32 registers.
The changes are mostly mechanical, intended to remove unnecessary register
classes which tend to produce redundant register moves.
Differential Revision: https://reviews.llvm.org/D151601
v2f16 regtype conversion to i32
Nathan Chancellor [Mon, 5 Jun 2023 19:12:21 +0000 (12:12 -0700)]
[Clang] Add release note for
877210faa447
Reviewed By: erichkeane, nickdesaulniers
Differential Revision: https://reviews.llvm.org/D152186
Mehdi Amini [Mon, 5 Jun 2023 19:10:24 +0000 (12:10 -0700)]
Fix MLIR build with Shared lib enabled
db7cc0348c9a0 added OpenMP support to the execution engine but didn't
add the explicit CMake dependency.
Rafael Ubal Tena [Mon, 5 Jun 2023 18:56:44 +0000 (11:56 -0700)]
Activate OpenMP translation in MLIR execution engine CAPI.
We've observed that the MLIR Jit Engine fails when the `omp` dialect is used due to a failure to register OpenMP-related translations. This small patch addresses this issue.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D151577
Dmitriy Filchenko [Mon, 5 Jun 2023 18:28:09 +0000 (18:28 +0000)]
[scudo] Change configuration for Trusty, use mmap()
Trusty runs in memory constrained environments, with many apps
having only one page (4KB) of heap memory available. However, we
still want to mmap() multiples of PAGE_SIZE at a time.
Additionally, switch Scudo from using sbrk() to mmap().
Reviewed By: cferris
Differential Revision: https://reviews.llvm.org/D151968
Aaron Ballman [Mon, 5 Jun 2023 18:14:23 +0000 (14:14 -0400)]
Fix LLVM sphinx build
Addresses the issue found by:
https://lab.llvm.org/buildbot/#/builders/30/builds/35886
Ramkumar Ramachandra [Mon, 20 Feb 2023 14:57:51 +0000 (15:57 +0100)]
tree-sitter-mlir: add a more complete grammar
Contribute a grammar, along with associated tests, from the upstream
project maintained at https://github.com/artagnon/tree-sitter-mlir. The
new grammar includes several fixes, and successfully parses 60-80% of
MLIR tests in the Arith, Math, ControlFlow, SCF, Tensor, Affine, and
Linalg dialects.
Differential Revision: https://reviews.llvm.org/D144408
Charalampos Mitrodimas [Mon, 5 Jun 2023 17:43:33 +0000 (17:43 +0000)]
Respect "-fdiagnostics-absolute-paths" on emit include location
This commit fixes "TextDiagnostic::emitIncludeLocation" when compiling
with "-fdiagnostics-absolute-paths" flag enabled by emitting the absolute
path of the included file.
Fixes #63026
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D151833
Christopher Di Bella [Fri, 2 Jun 2023 21:19:03 +0000 (21:19 +0000)]
[clang][NFC] refactors value type traits so we can have more than bools
Since all the type traits up until now have had Boolean vaules, we've
always been able to assume that the expressions are `bool`. This is
about to change (D151952 introduces a trait that returns `size_t`), so
we need to restructure the code so it doesn't become unwieldy.
This is achieved by giving traits a designated "return" type.
Differential Revision: https://reviews.llvm.org/D152034
Shao-Ce SUN [Mon, 5 Jun 2023 16:55:59 +0000 (00:55 +0800)]
[Flang] Map `ieee_fma` intrinsic to `llvm.fma`
Map `ieee_fma` intrinsic to LLVM IR as `llvm.fma`.
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D151872
Fangrui Song [Mon, 5 Jun 2023 18:01:27 +0000 (11:01 -0700)]
Replace deprecated startswith_insensitive with starts_with_insensitive
Noah Goldstein [Mon, 5 Jun 2023 07:37:08 +0000 (02:37 -0500)]
[InstCombine] Add transform `(icmp pred (shl {nsw and/or nuw} X, Y), C)` -> `(icmp pred X, C)`
Three new transforms:
1) `(icmp pred (shl nsw nuw X, Y), C)` [if `C <= 0`] -> `(icmp pred X, C)`
- ugt: https://alive2.llvm.org/ce/z/K_57J_
- sgt: https://alive2.llvm.org/ce/z/BL8u_a
- sge: https://alive2.llvm.org/ce/z/yZZVYz
- uge: https://alive2.llvm.org/ce/z/R4jwwJ
- ule: https://alive2.llvm.org/ce/z/-gbmth
- sle: https://alive2.llvm.org/ce/z/ycZVsh
- slt: https://alive2.llvm.org/ce/z/4MzHYm
- sle: https://alive2.llvm.org/ce/z/fgNfex
- ult: https://alive2.llvm.org/ce/z/cXfvH5
- eq : https://alive2.llvm.org/ce/z/sZh_Ti
- ne : https://alive2.llvm.org/ce/z/UrqSWA
2) `(icmp eq/ne (shl {nsw|nuw} X, Y), 0)` -> `(icmp eq/ne X, 0)`
- eq+nsw: https://alive2.llvm.org/ce/z/aSJN6D
- eq+nuw: https://alive2.llvm.org/ce/z/r2_-br
- ne+nuw: https://alive2.llvm.org/ce/z/RkETtu
- ne+nsw: https://alive2.llvm.org/ce/z/8iSfW3
3) `(icmp slt (shl nsw X, Y), 0/1)` -> `(icmp pred X, 0/1)`
`(icmp sgt (shl nsw X, Y), 0/-1)` -> `(icmp pred X, 0/-1)`
- slt: https://alive2.llvm.org/ce/z/eZYRan
- sgt: https://alive2.llvm.org/ce/z/QQeP26
Transform 3) is really sle/slt/sge/sgt with 0, but sle/sge
canonicalize to slt/sgt respectively so its implemented as such.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D145341
Noah Goldstein [Mon, 5 Jun 2023 07:37:06 +0000 (02:37 -0500)]
[InstCombine] Add tests for tranforming `(icmp pred (shl {nsw and/or nuw} X, Y), C)`; NFC
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D145340
Florian Mayer [Mon, 5 Jun 2023 17:57:49 +0000 (10:57 -0700)]
[sanitizer] add new symbolizer symbol
Peiming Liu [Mon, 5 Jun 2023 17:26:40 +0000 (17:26 +0000)]
[mlir][sparse] Make getNumTensors() consistent between LoopEmitter and Merger.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D152178
Nathan Chancellor [Mon, 5 Jun 2023 17:49:41 +0000 (10:49 -0700)]
[Sema] Do not emit -Wunused-variable for variables declared with cleanup attribute
A variable declared with __attribute__((cleanup)) cannot be unused, as
its address is passed to the clean up function. Do not emit
-Wunused-variable for variables declared with the cleanup attribute,
which matches GCC's behavior: https://godbolt.org/z/dz5YfTsan
Reviewed By: erichkeane, nickdesaulniers
Differential Revision: https://reviews.llvm.org/D152180
Philip Reames [Mon, 5 Jun 2023 17:46:49 +0000 (10:46 -0700)]
[IRBUilder] Introduce getAllOnesMask [nfc]
Simplify D99750 by factoring out a utility which we already have multiple instances of in tree.
Alan Hu [Mon, 5 Jun 2023 17:19:45 +0000 (13:19 -0400)]
Remove vestiges of removed OCaml modules
Several OCaml modules using the old PassManager API were removed in
https://reviews.llvm.org/D144751, but the META file still needed to be
updated to remove them. This diff also removes an unused macro definition
related to the module removals.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D152114
Florian Mayer [Mon, 5 Jun 2023 17:26:33 +0000 (10:26 -0700)]
Revert "Properly restore SP tag on exceptions"
This reverts commit
6a2e0cb418175bb985aa898604560110a77c43da.
Krzysztof Drewniak [Wed, 19 Apr 2023 15:19:14 +0000 (15:19 +0000)]
[AMDGPU] Add intrinsic for converting global pointers to resources
Define the function @llvm.amdgcn.make.buffer.rsrc, which take a 64-bit
pointer, the 16-bit stride/swizzling constant that replace the high 16
bits of an address in a buffer resource, the 32-bit extent/number of
elements, and the 32-bit flags (the latter two being the 3rd and 4th
wards of the resource), and combines them into a ptr addrspace(8).
This intrinsic is lowered during the early phases of the backend.
This intrinsic is needed so that alias analysis can correctly infer
that a certain buffer resource points to the same memory as some
global pointer. Previous methods of constructing buffer resources,
which relied on ptrtoint, would not allow for such an inference.
Depends on D148184
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D148957
Krzysztof Drewniak [Wed, 12 Apr 2023 23:18:17 +0000 (23:18 +0000)]
[AMDGPU] Use resource base for buffer instruction MachineMemOperands
1. Remove the existing code that would encode the constant offsets (if
there were any) on buffer intrinsic operations onto their
`MachineMemOperand`s. As far as I can tell, this use of `offset` has
no substantial impact on the generated code, especially since the same
reasoning is performed by areMemAccessesTriviallyDisjoint().
2. When a buffer resource intrinsic takes a pointer argument as the
base resource/descriptor, place that memory argument in the value
field of the MachineMemOperand attached to that intrinsic.
This is more conservative than what would be produced by more typical
LLVM code using GEP, as the Value (for alias analysis purposes)
corresponding to accessing buffer[0] and buffer[1] is the same.
However, the target-specific analysis of disjoint offsets covers a lot
of the simple usecases.
Despite this limitation, the new buffer intrinsics, combined with
LLVM's existing pointer annotations, allow for non-trivial
optimizations, as seen in the new tests, where marking two buffer
descriptors "noalias" allows merging together loads and stores in a
"load from A, modify loaded value, store to B" sequence, which would
not be possible previously.
Depends on D147547
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D148184
Nikolas Klauser [Mon, 5 Jun 2023 17:00:02 +0000 (10:00 -0700)]
Revert "[libc++] Optimize for_each for segmented iterators"
This reverts commit
b1dc43aa3a05c2f14725e2e6428544208ccbe161.
Krzysztof Drewniak [Tue, 4 Apr 2023 17:11:04 +0000 (17:11 +0000)]
[AMDGPU] Add buffer intrinsics that take resources as pointers
In order to enable the LLVM frontend to better analyze buffer
operations (and to potentially enable more precise analyses on the
backend), define versions of the raw and structured buffer intrinsics
that use `ptr addrspace(8)` instead of `<4 x i32>` to represent their
rsrc arguments.
The new intrinsics are named by replacing `buffer.` with `buffer.ptr`.
One advantage to these intrinsic definitions is that, instead of
specifying that a buffer load/store will read/write some memory, we
can indicate that the memory read or written will be based on the
pointer argument. This means that, for example, a read from a
`noalias` buffer can be pulled out of a loop that is modifying a
distinct buffer.
In the future, we will define custom PseudoSourceValues that will
allow us to package up the (buffer, index, offset) triples that buffer
intrinsics contain and allow for more precise backend analysis.
This work also enables creating address space 7, which represents
manipulation of raw buffers using native LLVM load and store
instructions.
Where tests simply used a buffer intrinsic while testing some other
code path (such as the tests for VGPR spills), they have been updated
to use the new intrinsic form. Tests that are "about" buffer
intrinsics (for instance, those that ensure that they codegen as
expected) have been duplicated, either within existing files or into
new ones.
Depends on D145441
Reviewed By: arsenm, #amdgpu
Differential Revision: https://reviews.llvm.org/D147547
Nick Desaulniers [Mon, 5 Jun 2023 16:33:44 +0000 (09:33 -0700)]
[Demangle] convert is*Encoding to use std::string_view
This was originally a part of D149104 which was backed out. This change
is uncontroversial though, so split it out and reland it.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D152042
Kiran Chandramohan [Mon, 5 Jun 2023 16:14:12 +0000 (16:14 +0000)]
[Flang][PFT] Skip continue insertion for OpenMP Loops
Unstructured regions presents some issues for OpenMP code generation.
While there are no branches out of the OpenMP region, there can be
branches inside. This required the availability of an artificial
target at the end of an OpenMP region. This was implemented by
insertion an artifical `continue` and marking it as a target for
a branch.
(https://github.com/flang-compiler/f18-llvm-project/pull/1178)
The artificial target is not required for OpenMP loops. Since the
DO loop end can itself be a target of a branch. Moreover, insertion
of the continue between the end of the loop and the end of the
OpenMP loop construct presents problems since the OpenMP MLIR
loop construct models both the loop and the construct. This can
cause the terminator of the OpenMP loop construct to be missed.
This patch solves the issue by skipping the insertion of the
continue.
Note: This issue is only hit if the `end openmp loop` directive
is missed.
This patch fixes the issues in:
-> https://github.com/llvm/llvm-project/issues/58378
-> https://github.com/flang-compiler/f18-llvm-project/issues/1426
Fixes #58378
Reviewed By: vdonaldson
Differential Revision: https://reviews.llvm.org/D151700
Craig Topper [Mon, 5 Jun 2023 16:24:50 +0000 (09:24 -0700)]
[RISCV] Switch vwsll.v* instructions to use the VSHT_IV_V_X_I class instead of VALU_IV_V_X_I.
This allows us to remove the uimm5 argument and changes the
scheduler class from ALU to Shift.
Ultimately we need a WShift scheduler class, but we need to scrub
all of the crypto instructions for scheduler classes so I'll leave
that for future work.
Reviewed By: 4vtomat, ego
Differential Revision: https://reviews.llvm.org/D152030
Michael Liao [Mon, 5 Jun 2023 16:19:58 +0000 (12:19 -0400)]
[TableGen] Fix indentation. NFC
Stefan Pintilie [Fri, 2 Jun 2023 18:46:25 +0000 (14:46 -0400)]
[LLD] Emit DT_PPC64_OPT into the dynamic section
As per section 4.2.2 of the PowerPC ELFv2 ABI, this value tells the dynamic linker which optimizations it is allowed to do.
Specifically, the higher order bit of the two tells the dynamic linker that there may be multiple TOC pointers in the binary.
When we resolve any NOTOC relocations during linking, we need to set this value because we may be calling
TOC functions from NOTOC functions when the NOTOC function already clobbered the TOC pointer.
In practice, this ensures that the PLT resolver always resolves the call to the GEP (global entry point) of
the TOC function (which will set up the TOC for the TOC function).
Original patch by nemanjai
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D150631
Sam McCall [Tue, 23 May 2023 20:39:55 +0000 (22:39 +0200)]
[clangd] Move completion signatures and labelDetails
(When clients support it, otherwise keep the existing rendering).
In VSCode this makes the signature darker.
Differential Revision: https://reviews.llvm.org/D151253
Kiran Chandramohan [Mon, 5 Jun 2023 15:43:37 +0000 (15:43 +0000)]
[Flang][OpenMP] Refactor to properly fix privatisation of loop bounds
The OpenMP loop Operations have the bounds attached to them. If the
loop bounds are privatised then the privatisation has to happen
before the loop operation is created. To do this the privatisation
is split into two steps. The first step performs cloning and
firstprivate handling, the second step performs lastprivate handling.
This also reverts the changes in the temporary fix (D127137).
Fixes https://github.com/flang-compiler/f18-llvm-project/issues/1171#issuecomment-
1143880545
Fixes https://github.com/flang-compiler/f18-llvm-project/issues/1171#issuecomment-
1119997442
Fixes #60872
Reviewed By: NimishMishra
Differential Revision: https://reviews.llvm.org/D151504
SR_team [Mon, 5 Jun 2023 15:52:06 +0000 (17:52 +0200)]
[clangd] Show size, offset and padding for bit fields on hover
Examle:
```
struct test {
char a;
char b : 3;
char c : 5;
int d;
int e : 27;
};
```
{
F27617774}
{
F27617776}
{
F27617777}
{
F27617780}
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D151128
Mark de Wever [Sun, 4 Jun 2023 15:41:17 +0000 (17:41 +0200)]
[libunwind] Removes CMake work-arounds.
CMake older than 3.20.0 is no longer supported.
This removes work-arounds for no longer supported versions.
Reviewed By: #libunwind, mstorsjo
Differential Revision: https://reviews.llvm.org/D152100
Tom Eccles [Mon, 5 Jun 2023 15:35:14 +0000 (15:35 +0000)]
[flang] [stack-arrays] fix unused variable warning
Aaron Ballman [Mon, 5 Jun 2023 15:34:17 +0000 (11:34 -0400)]
Silence C++17 extension warnings; NFC
Amends
12728e144994efe84715f4e5dbb8c3104e9f0b5a
Addresses issues found by:
https://lab.llvm.org/buildbot/#/builders/216/builds/22308
Amaury Séchet [Mon, 5 Jun 2023 15:32:33 +0000 (15:32 +0000)]
[NFC][DAG] Move isTruncateOf so that it can be used in foldBinOpIntoSelect.