Joseph Huber [Wed, 22 Feb 2023 17:36:12 +0000 (11:36 -0600)]
[libc] Fix amdgpu startup code flags
Summary:
Currently AMDGPU only barely supports cross-TU ELF linking. Full linking
is usually done via LTO. This requires passing the architecture to the
link job. This is done automatically via `-flto` since D144505. Add this
to the link options.
Petr Hosek [Wed, 22 Feb 2023 17:32:07 +0000 (17:32 +0000)]
Revert "[CMake] Unify llvm_check_linker_flag and llvm_check_compiler_linker_flag"
This reverts commit
efae3174f09560353fb0f3d528bcbffe060d5438 since
it broke the standalone Flang build.
Konstantina Mitropoulou [Fri, 17 Feb 2023 22:16:39 +0000 (14:16 -0800)]
[AMDGPU] Improve the lowering of raw_buffer_load_{i8,i16} and struct_buffer_load_{i8,i16} intrinsics
Currently, raw_buffer_load_{i8,i16} and struct_buffer_load_{i8,i16}
intrinsics are lowered as buffer_load_{u8,u16}. This patch combines
buffer_load_{u8,u16} and sign extension instructions in order to
generate buffer_load_{i8,i16} instructions.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D144313
OCHyams [Wed, 22 Feb 2023 16:29:44 +0000 (16:29 +0000)]
[Assignment Tracking] Only set module flag if pass modifies a function
The module flag "debug-info-assignment-tracking" is set by the
declare-to-assign pass to indicate that assignment tracking is enabled. This
patch changes declare-to-assign to only set the flag if it makes a
modification. This lets the compiler avoid doing extra work for no benefit,
such as is currently the case if assignment tracking is requested for a build
with line tables only (-gmlt) or a build without debug info.
Reviewed By: scott.linder
Differential Revision: https://reviews.llvm.org/D144481
Joe Nash [Tue, 21 Feb 2023 21:14:27 +0000 (16:14 -0500)]
[AMDGPU] Don't set src mods on permlane16
v_permlane16_b32 and v_permlanex16_b32 should not set abs and neg src
modifiers on any input, but they can set op_sel on src0 or src1 to
represent fi or bc when desired. The ISel patterns were setting
the src_modifier bits to -1, effectively setting abs and neg as well,
whenever it was intended to set op_sel, due to an error in ISel. ISel
should now correctly only set the op_sel bits.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D144519
OCHyams [Wed, 22 Feb 2023 14:23:08 +0000 (14:23 +0000)]
[Assignment Tracking] Choose better passes for RemoveRedundantDbgInstrs call
Enabling assignment tracking without this patch, a significant amount of
additional compiler run time comes from the RemoveRedundantDbgInstrs call in
InstCombine. This patch reduces compiler run time by choosing better places to
call RemoveRedundantDbgInstrs.
In non-assignment-tracking builds, RemoveRedundantDbgInstrs is called by
InstCombine if LowerDbgDeclare makes a change (i.e. it is _sometimes_
called). In assignment tracking builds LowerDbgDeclare doesn't do anything. We
still need to clean up redundant intrinsics to avoid a large performance hit
due to the number of instructions, so the current approach is to have
InstCombine _always_ call RemoveRedundantDbgInstrs.
Instrumenting the compiler to run RemoveRedundantDbgInstrs after every pass and
dump the numbers and building CTMark/tramp3d-v4 indicates that SROA and
LoopVectorize give us a bigger bang (number removed) for buck (times pass is
run).
The compile time tracker reports that this patch reduces the number of
instructions retired building CTMark projects by an average of 1.1%.
Reviewed By: scott.linder
Differential Revision: https://reviews.llvm.org/D144483
Jay Foad [Wed, 22 Feb 2023 15:51:29 +0000 (15:51 +0000)]
[AMDGPU] Move splitMUBUFOffset from AMDGPUBaseInfo to SIInstrInfo
Moving this out of AMDGPUBaseInfo enforces that AMDGPUBaseInfo should
not be calling into GCNSubtarget.
Differential Revision: https://reviews.llvm.org/D144564
Mark de Wever [Tue, 21 Feb 2023 16:31:44 +0000 (17:31 +0100)]
[libc++][format] Removes transitive type_traits.
Reviewed By: #libc, philnik
Differential Revision: https://reviews.llvm.org/D144498
Mark de Wever [Tue, 21 Feb 2023 16:26:52 +0000 (17:26 +0100)]
[clang][doc] Removes obsolete comment.
After reading about the documentation improvements on LLVM weekly this
part seems obsolete.
Reviewed By: ChuanqiXu
Differential Revision: https://reviews.llvm.org/D144497
Joseph Huber [Tue, 21 Feb 2023 17:42:22 +0000 (11:42 -0600)]
[Clang] Add options in LTO mode when cross compiling for AMDGPU
The AMDGPU toolchain support directly compiling GPU images using
cross-compilation such as `clang --target=amdgcn-amd-amdhsa foo.c`.
However, when attempting to link bitcode this does not work because the
`-mcpu` options are not forwarded to the linker among others. This patch
simply adds them so that `clang --target=amdgcn-amd-amdhsa foo.c -flto`
works correctly.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D144505
Nikita Popov [Wed, 22 Feb 2023 15:58:29 +0000 (16:58 +0100)]
[SCEV] Remove unused alignof/offsetof print special cases (NFC)
These shouldn't really reach SCEV without being folded away first,
and we don't have any tests that hit these cases.
The sizeof case does occur with scalable types.
ShangwuYao [Tue, 14 Feb 2023 22:05:41 +0000 (22:05 +0000)]
[CUDA][SPIRV] Match builtin types and __GCC_ATOMIC_XXX_LOCK_FREE macros on host/device
This change matches the CUDA/SPIRV behavior with CUDA/NVPTX, and makes some builtin types
and __GCC_ATOMIC_XXX_LOCK_FREE macros the same between the host and device. This is only
done when host triple is provided and known, otherwise the behavior is unchanged.
Reviewed By: yaxunl
Differential Revision: https://reviews.llvm.org/D144047
Matthias Springer [Wed, 22 Feb 2023 14:25:57 +0000 (15:25 +0100)]
[flang] Fix build after D143339
This change silences a compiler warning: `base class should be explictily initialized in the copy constructor`.
Differential Revision: https://reviews.llvm.org/D144556
Jessica Del [Tue, 21 Feb 2023 08:40:07 +0000 (09:40 +0100)]
[AMDGPU] Improved wide multiplies
These checks show optimized instructions if an operand is known to be
(partially) zero.
Change-Id: Ie2f6d0d3ee9d5b279d1f4c1dd0787492e39cc77a
Differential Revision: https://reviews.llvm.org/D140208
Nikita Popov [Fri, 15 Jul 2022 14:36:46 +0000 (16:36 +0200)]
[GlobalOpt] Add struct for parts during GlobalSRA (NFC)
This is in preparation for https://reviews.llvm.org/D129857.
Matthias Springer [Wed, 22 Feb 2023 15:12:27 +0000 (16:12 +0100)]
[mlir][IR][NFC] Rename RewriterBase::replaceUseIf to replaceUsesWithIf
This is for consistency with `Value::replaceUsesWithIf`.
Differential Revision: https://reviews.llvm.org/D144547
Kadir Cetinkaya [Tue, 21 Feb 2023 08:44:25 +0000 (09:44 +0100)]
[clangd] Publish diagnostics with stale preambles
This patch achieves this by building an AST and invoking main file
callbacks on each update, in addition to preamble updates.
It means we might have some extra AST builds now (e.g. if an update was
with a stale preamble and there were no reads on it, we would only build
an AST once we had the fresh preamble. Now we'll build 2, once with the
stale preamble and another with the fresh one, but we'll have one more
diagnostics cycle in between.).
This patch preserves forward progress of diagnostics by always using the
latest main file contents when emitting diagnostics after preamble
builds. It also guarantees eventual consistency:
- if an update doesn't invalidate preamble, we'll emit diagnostics with
fresh preamble already.
- if an update invalidates preamble, we'll first emit diagnostics with
stale contents, and then once the preamble build finishes it'll emit
diagnostics (as preamble has changed) with newest version.
This has implications on parsing callbacks, as previously onMainAST
callback was called at most once, now it can be called up to 2 times.
All of the existing clients can already deal with callback firing
multiple times.
Differential Revision: https://reviews.llvm.org/D144456
Kadir Cetinkaya [Wed, 1 Feb 2023 18:26:10 +0000 (19:26 +0100)]
[clangd] Provide patched diagnostics with preamble patch
Translates diagnostics from baseline preamble to relevant modified
contents.
Translation is done by looking for a set of lines that have the same
contents in diagnostic/note/fix ranges inside baseline and modified
contents.
A diagnostic is preserved if its main range is outside of main file or
there's a translation from baseline to modified contents. Later on fixes
and notes attached to that diagnostic with relevant ranges are also
translated and preserved.
Depends on D143095
Differential Revision: https://reviews.llvm.org/D143096
Kadir Cetinkaya [Wed, 1 Feb 2023 18:10:03 +0000 (19:10 +0100)]
[clangd] Respect preamble-patch when handling diags
Depends on D143093
Differential Revision: https://reviews.llvm.org/D143095
Kadir Cetinkaya [Wed, 1 Feb 2023 17:37:46 +0000 (18:37 +0100)]
[clangd] #undef macros inside preamble patch
That way we can stop generating false macro redefinition diagnostics.
Depends on D142890
Differential Revision: https://reviews.llvm.org/D143093
Kadir Cetinkaya [Mon, 30 Jan 2023 07:06:41 +0000 (08:06 +0100)]
[clangd] Add config option for fast diagnostics mode
Also wire it up for use with patched preambles and introduce test cases
for behaviour we'd like to improve.
Differential Revision: https://reviews.llvm.org/D142890
Alexander Belyaev [Wed, 22 Feb 2023 14:37:28 +0000 (15:37 +0100)]
[mlir] Add missing patterns for lowering to Libm.
Differential Revision: https://reviews.llvm.org/D144561
Maya Amrami [Wed, 22 Feb 2023 07:48:32 +0000 (09:48 +0200)]
[mlir][bufferization] Consider defaultMemorySpace when bufferizing FuncOp
The function arguments and results type will have the default memory space.
Reviewed By: springerm
Differential Revision: https://reviews.llvm.org/D144539
LLVM GN Syncbot [Wed, 22 Feb 2023 14:32:18 +0000 (14:32 +0000)]
[gn build] Port
200034978b95
Jean Perier [Wed, 22 Feb 2023 14:25:43 +0000 (15:25 +0100)]
[flang][hlfir] Insert casts in hlfir.associate rewrites
When the associated expression came from a moved variable, the
type of the moved variable may not exactly match the hlfir.associate
result and cannot be re-used directly. Insert fir.convert/fir.box_addr
as needed.
Reviewed By: clementval
Differential Revision: https://reviews.llvm.org/D144557
Jay Foad [Wed, 22 Feb 2023 13:39:58 +0000 (13:39 +0000)]
[AMDGPU] Fix an assertion failure when folding into src2 of V_FMAC_F16
D139469 "[AMDGPU] Enable OMod on more VOP3 instructions" caused an
assertion failure when trying to fold into src2 of V_FMAC_F16. It would
temporarily convert the instruction to V_FMA_F16_gfx9 and add an opsel
operand, but if the fold still failed then it would forget to remove the
opsel operand.
Differential Revision: https://reviews.llvm.org/D144558
Teresa Johnson [Sat, 18 Feb 2023 02:10:02 +0000 (18:10 -0800)]
[MemProf] Add printing utilities for MemProf summary structures
Split out of D140908 as suggested, and added unit testing.
Differential Revision: https://reviews.llvm.org/D144314
Nikolas Klauser [Fri, 17 Feb 2023 12:07:52 +0000 (13:07 +0100)]
[libc++][NFC] Replace typedef with using declarations in <__atomic/*>
Reviewed By: Mordante, #libc
Spies: arichardson, libcxx-commits
Differential Revision: https://reviews.llvm.org/D144259
Daniel Woodworth [Wed, 22 Feb 2023 12:38:53 +0000 (13:38 +0100)]
[Local][SimplifyCFG][GVN] Handle !nontemporal in combineMetadata
SimplifyCFG currently drops !nontemporal metadata when sinking
common instructions. With this change, SimplifyCFG and similar
transforms will preserve !nontemporal metadata as long as it is
set on both original instructions.
Differential Revision: https://reviews.llvm.org/D144298
Vladislav Khmelevsky [Wed, 15 Feb 2023 13:18:37 +0000 (17:18 +0400)]
[BOLT] Fix data reoder for aarch64
Use proper relocation for aarch64
Differential Revision: https://reviews.llvm.org/D144095
LLVM GN Syncbot [Wed, 22 Feb 2023 12:33:42 +0000 (12:33 +0000)]
[gn build] Port
3b8c0b342e16
Piyou Chen [Wed, 22 Feb 2023 12:02:06 +0000 (04:02 -0800)]
[RISCV] Add new pass to transform undef to pseudo for vector values.
RISC-V vector instruction has register overlapping constraint for certain
instructions, and will cause illegal instruction trap if violated, we use
early clobber to model this constraint, but it can't prevent register allocator
allocated same or overlapped if the input register is undef value, so convert
IMPLICIT_DEF to temporary pseudo could prevent that happen, it's not best way
to resolve this. Ideally we should model the constraint right, but before we
model the constraint right, it's the approach to prevent that happen.
See also: https://github.com/llvm/llvm-project/issues/50157
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D129735
David Green [Wed, 22 Feb 2023 11:26:41 +0000 (11:26 +0000)]
[AArch64] Lower all fp zero buildvectors through BUILD_VECTOR.
Just like with integers, we can treat zero fp buildvector as legal so that they
can be recognized in tablegen patterns using immAllZerosV.
Sjoerd Meijer [Tue, 21 Feb 2023 16:00:52 +0000 (16:00 +0000)]
[AArch64] Fix N2 SchedModel element-to-element INS latencies
The instruction regexp "^INSv" for the insert gen-reg-to-element was also
matching the element-to-element instruction, which only has a latency of 2 and
not 5, so we were getting that wrong.
Differential Revision: https://reviews.llvm.org/D144508
LLVM GN Syncbot [Wed, 22 Feb 2023 10:24:28 +0000 (10:24 +0000)]
[gn build] Port
850dab0f2537
Manolis Tsamis [Wed, 22 Feb 2023 09:58:50 +0000 (10:58 +0100)]
[RISCV] Add vendor-defined XTheadSync (Multi-core synchronization) extension
The vendor-defined XTheadSync (no comparable standard extension exists
at the time of writing) extension adds multi-core synchronization
instructions.
It is supported by the C9xx cores (e.g., found in the wild in the
Allwinner D1) by Alibaba T-Head.
The current (as of this commit) public documentation for this
extension is available at:
https://github.com/T-head-Semi/thead-extension-spec/releases/download/2.2.2/xthead-2023-01-30-2.2.2.pdf
Support for these instructions has already landed in GNU Binutils:
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=
547c18d9bb95571261dbd17f4767194037eb82bd
Depends on D144496
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D144501
Luke Lau [Tue, 21 Feb 2023 14:56:22 +0000 (14:56 +0000)]
[LV][RISCV] Don't interleave scalable vector loops
It's less clear with scalable vectors than fixed length vectors that
interleaving exposes more ILP, as scalable vectors can be thought of a
sort of hardware form of interleaving, especially with larger LMULs.
This also addresses the unexpected additional unrolling that occurs when
using larger LMULs in the loop vectorizer.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D144485
Luke Lau [Tue, 21 Feb 2023 13:00:18 +0000 (13:00 +0000)]
[LV][NFC] Use ElementCount for getMaxInterleaveFactor
In order to allow targets to disable interleaving for scalable vectors, pass the entire VF's ElementCount to getMaxInterleaveFactor.
This is based off of the approach used here: https://repo.hca.bsc.es/gitlab/rferrer/llvm-epi/-/commit/
8d36708507b3c378078b9fe364bc548354aaec86
The plan would then be to disable interleaving on scalable VFs on RISC-V in a follow up patch.
See https://reviews.llvm.org/D143723#4132349
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D144474
Samuel Parker [Tue, 21 Feb 2023 10:52:27 +0000 (10:52 +0000)]
[WebAssembly] pmin/pmax fixes
Reverse the operand ordering to ? rhs : lhs.
Differential Revision: https://reviews.llvm.org/D144466
Manolis Tsamis [Wed, 22 Feb 2023 09:36:42 +0000 (10:36 +0100)]
[RISCV] Add vendor-defined XTheadCmo (Cache Management Operations) extension
The vendor-defined XTHeadCmo (there are some similarities with the
Zicbom standard extension) extension adds cache management instructions.
It is supported by the C9xx cores (e.g., found in the wild in the
Allwinner D1) by Alibaba T-Head.
The current (as of this commit) public documentation for this
extension is available at:
https://github.com/T-head-Semi/thead-extension-spec/releases/download/2.2.2/xthead-2023-01-30-2.2.2.pdf
Support for these instructions has already landed in GNU Binutils:
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=
a9ba8bc2d396fb8ae2b892f3bc6be8cdfe4b555c
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D144496
Denis Revunov [Wed, 18 Jan 2023 14:15:25 +0000 (09:15 -0500)]
[BOLT][AArch64] Replace NOP with adrp in AdrRelaxationPass to preserve relative offsets.
Avoid replacing one adr instruction with two adrp+add by utilizing linker-provided nops
when they are present. By doing so we preserve relative offsets of next instructions
in a function which reduces chances to break undetected jump tables. This commit makes
release-mode lld-linked clang, lld and etc work after BOLT.
Reviewed By: rafauler, yota9
Differential Revision: https://reviews.llvm.org/D143887
Nikita Popov [Wed, 22 Feb 2023 09:23:11 +0000 (10:23 +0100)]
[FunctionAttrs] Move nosync inference into inferAttrsFromFunctionBodies() (NFC)
There doesn't appear to be any reason why this attribute is
inferred separately from other ones that use AttributeInferer.
Matthias Springer [Wed, 22 Feb 2023 09:41:22 +0000 (10:41 +0100)]
[mlir] RewriterBase::Listener: Add notifyOperationModified callback
This callback is triggered by `finalizeRootUpdate`. This allows listeners to listen for in-place op modifications without creating a new RewriterBase subclass.
Differential Revision: https://reviews.llvm.org/D143380
Matthias Springer [Wed, 22 Feb 2023 09:33:09 +0000 (10:33 +0100)]
[mlir][SCF][Utils][NFC] Make some utils public for better reuse
These functions will be used in a subsequent change. Also some minor refactoring.
Differential Revision: https://reviews.llvm.org/D143909
Matthias Springer [Wed, 22 Feb 2023 09:25:37 +0000 (10:25 +0100)]
[mlir] GreedyPatternRewriteDriver: Support optional Listener
Allow an optional `RewriterBase::Listener` to be attached to greedy pattern rewrites, so that clients can listen for IR modifications.
Differential Revision: https://reviews.llvm.org/D143340
Michael Platings [Tue, 7 Feb 2023 11:23:46 +0000 (11:23 +0000)]
[NFC] Class for building MultilibSet
The functionality in MultilibSet for creating it is tied to its current
implementation. Putting that code in a separate class is an enabler for
changing the MultilibSet implementation.
Differential Revision: https://reviews.llvm.org/D142893
Michael Platings [Wed, 22 Feb 2023 08:43:35 +0000 (08:43 +0000)]
[Clang] Improve hermeticity of clang_rt tests
Specifying --sysroot prevents libclang_rt from being located in standard
library directories.
Differential Revision: https://reviews.llvm.org/D144542
Ricardo Jesus [Mon, 20 Feb 2023 16:44:40 +0000 (16:44 +0000)]
[AArch64] Fix abs(sub nsw) -> absd
This partially reverts a regression introduced in
8f25e382c5b1 for
AArch64 targets. In particular, we restore the logic of `(abs (sub nsw
x, y)) -> abds(x, y)` for all targets except X86, which keeps the logic
introduced in
8f25e382c5b1. See also https://reviews.llvm.org/D142288.
Differential Revision: https://reviews.llvm.org/D144379
Haojian Wu [Tue, 14 Feb 2023 23:39:10 +0000 (00:39 +0100)]
[Lex] Fix a crash in updateConsecutiveMacroArgTokens.
Fixes https://github.com/llvm/llvm-project/issues/60722.
Differential Revision: https://reviews.llvm.org/D144054
Michael Liao [Wed, 22 Feb 2023 08:36:36 +0000 (03:36 -0500)]
[TableGen] Emit static const globals in getOperandType
- That saves the overhead of operand type querying.
Liming Liu [Sun, 12 Feb 2023 01:08:13 +0000 (09:08 +0800)]
[clang] Add the check of membership for the issue #58674 and improve the lookup process
This patch includes the commit
01adf96ebc86 and a fix of unhandled declaration
references.
When looking up base classes, Clang first checks whether a base class is a
template and takes the specialized template based on it. However, the base class
might be instantiated, and the above behavior can lose information.
This patch fixes the problem by first checking whether a base class is a record
declaration, so the instantiated one will be taken.
Differential Revision: https://reviews.llvm.org/D143840
Nikita Popov [Wed, 22 Feb 2023 08:31:12 +0000 (09:31 +0100)]
[FunctionAttrs] Slightly clean up returned attr inference (NFC)
Use hasAttrSomewhere() and directly return Argument from the
helper.
Matthias Springer [Wed, 22 Feb 2023 08:12:24 +0000 (09:12 +0100)]
This change makes `RewriterBase` symmetric to `OpBuilder`.
```
OpBuilder OpBuilder::Listener
^ ^
| |
RewriterBase RewriterBase::Listener
```
* Clients can listen to IR modifications with `RewriterBase::Listener`.
* `RewriterBase` no longer inherits from `OpBuilder::Listener`.
* Only a single listener can be registered at the moment (same as `OpBuilder`).
RFC: https://discourse.llvm.org/t/rfc-listeners-for-rewriterbase/68198
Differential Revision: https://reviews.llvm.org/D143339
Jean Perier [Wed, 22 Feb 2023 08:16:01 +0000 (09:16 +0100)]
[flang][runtime] Add API to help with the difficult array constructor cases
This runtime API can be used to lower any flavor of array constructors,
but is mainly intended to be used with:
- array constructors for which the extent or length parameters cannot
be computed without lowering some ac-value or ac-implied-do-control
that cannot be pre-evaluated.
- array constructors of a derived type with allocatable component where
copy is not trivial or PDTS.
Example of use cases:
- `[((i+j,i=1, ifoo()), j=1,n)]` where ifoo() is not pure.
- `[return_allocatable_array(), return_allocatable_array()]`
Differential Revision: https://reviews.llvm.org/D144411
Shengchen Kan [Wed, 22 Feb 2023 07:56:08 +0000 (15:56 +0800)]
[X86][MC] Correct the description & assert for mmm field of EVEX, NFCI
Nikita Popov [Wed, 22 Feb 2023 07:56:19 +0000 (08:56 +0100)]
Revert "[NFC] Make FPClassTest a bitmask enumeration"
This reverts commit
2e416cdd52c1079b8c7cb1f7d7e557c889a4fb56.
Breaks the GCC build:
In file included from /home/npopov/repos/llvm-project/llvm/include/llvm/ADT/FloatingPointMode.h:18,
from /home/npopov/repos/llvm-project/llvm/include/llvm/ADT/APFloat.h:20,
from /home/npopov/repos/llvm-project/llvm/lib/Support/APFloat.cpp:14:
/home/npopov/repos/llvm-project/llvm/include/llvm/ADT/BitmaskEnum.h:66:22: error: extra qualification not allowed [-fpermissive]
66 | template <> struct llvm::is_bitmask_enum<Enum> : std::true_type {}; \
| ^~~~
/home/npopov/repos/llvm-project/llvm/include/llvm/ADT/FloatingPointMode.h:223:1: note: in expansion of macro ‘LLVM_DECLARE_ENUM_AS_BITMASK’
223 | LLVM_DECLARE_ENUM_AS_BITMASK(FPClassTest, /* LargestValue */ fcPosInf);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/npopov/repos/llvm-project/llvm/include/llvm/ADT/BitmaskEnum.h:67:22: error: extra qualification not allowed [-fpermissive]
67 | template <> struct llvm::largest_bitmask_enum_bit<Enum> { \
| ^~~~
/home/npopov/repos/llvm-project/llvm/include/llvm/ADT/FloatingPointMode.h:223:1: note: in expansion of macro ‘LLVM_DECLARE_ENUM_AS_BITMASK’
223 | LLVM_DECLARE_ENUM_AS_BITMASK(FPClassTest, /* LargestValue */ fcPosInf);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
[43/4396] Building CXX object lib/Supp...iles/LLVMSupport.dir/CommandLine.cpp.o
Michael Platings [Thu, 9 Feb 2023 18:07:52 +0000 (18:07 +0000)]
[Clang] Fix clang_rt tests when LLVM_ENABLE_PER_TARGET_RUNTIME_DIR is ON
If clang is part of a toolchain that can locate clang_rt libraries
outside its resource directory and these are built with
LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON then the tests would fail because
the library names don't have the arch suffix. This change makes the arch
suffix optional.
Differential Revision: https://reviews.llvm.org/D143666
Serge Pavlov [Wed, 22 Feb 2023 07:20:04 +0000 (14:20 +0700)]
[NFC] Make FPClassTest a bitmask enumeration
With this change bitwise operations are allowed for FPClassTest
enumeration, it must simplify using this type. Also some functions
changed to get argument of type FPClassTest instead of unsigned.
Differential Revision: https://reviews.llvm.org/D144241
Diego Caballero [Wed, 22 Feb 2023 06:53:37 +0000 (06:53 +0000)]
[mlir][Vector] Add support for high-order masked contractions
This patch adds support for masked vector.contract ops that needs to be
decomposed using the ContractionOpLowering pattern. It just slices the
mask according to the rest of the lowering.
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D144427
Diego Caballero [Wed, 22 Feb 2023 06:37:38 +0000 (06:37 +0000)]
[mlir][Vector] Add folding for masked reductions and vector.mask
This patch adds support for folding trivial masked reductions and
multi-reductions (e.g., multi-reductions with only parallel dims,
reductions of a single element, etc.). To support those foldings in
a composable way we also add support for folding different flavors of
empty vector.mask opertions.
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D144414
Quinn Dawkins [Tue, 21 Feb 2023 01:52:49 +0000 (20:52 -0500)]
[mlir][linalg] Allow constant exprs in pack/unpack propagation through elementwise
The pack/unpack propagation patterns currently assume all map results
for non-scalar arguments are AffineDimExprs, leading to crashes when the
input operand being packed has constant expressions.
Differential Revision: https://reviews.llvm.org/D144443
Kai Sasaki [Wed, 22 Feb 2023 06:09:09 +0000 (15:09 +0900)]
[mlir][Analysis] Guard data flow analysis from no block function
Foo analysis for testing the data flow analysis does not support the region without any block. Although that analysis is assumed to be used for testing purpose, it is generally better to be explicit about the scope the framework supports.
The original issue was reported here.
https://github.com/llvm/llvm-project/issues/60580
Reviewed By: springerm
Differential Revision: https://reviews.llvm.org/D144359
Shengchen Kan [Wed, 22 Feb 2023 05:59:28 +0000 (13:59 +0800)]
[X86][NFC] Remove useless code in X86MCCodeEmitter.cpp
Neither the switch in A nor the switch in B is fully covered, so we
don't need write an impossible format there.
Petr Hosek [Wed, 1 Feb 2023 08:25:35 +0000 (08:25 +0000)]
[CMake] Unify llvm_check_linker_flag and llvm_check_compiler_linker_flag
These have the same purposes but two different implementations.
llvm_check_compiler_linker_flag uses CMAKE_REQUIRED_FLAGS which affects
flags used both for compilation and linking which is problematic because
some flags may be link-only and trigger unused argument warning when set
during compilation. llvm_check_linker_flag does not have this issue so
we chose it as the prevailaing implementation.
Differential Revision: https://reviews.llvm.org/D143052
Lang Hames [Wed, 22 Feb 2023 03:09:34 +0000 (19:09 -0800)]
[ORC] Add an ExecutionSession::getTargetTriple convenience function.
Forwards to ExecutorProcessControl::getTargetTriple, and saves clients the
trouble of spelling 'getExecutorProcessControl()' everywhere.
Slava Zakharin [Tue, 21 Feb 2023 22:55:00 +0000 (14:55 -0800)]
[flang] Run MathToLLVM conversion as part of math conversion PM.
We used to specify benefit=0 for MathToLibm patterns so that
MathToLLVM patterns are more preferable. D144450 removed
the benefit parameter, so we have to run MathToLLVM separately now.
This resolves Intrinsics/math-codegen failure caused by D144450.
Differential Revision: https://reviews.llvm.org/D144523
Vitaly Buka [Wed, 22 Feb 2023 02:28:06 +0000 (18:28 -0800)]
[Support] Fix data race with “safe libc++”
Otherwise NFC.
Lang Hames [Wed, 22 Feb 2023 02:18:58 +0000 (18:18 -0800)]
[ORC-RT] Remove the '__' prefix from the ORC runtime's public API.
The '__' prefix should only be used for the parts of the ORC runtime that
implement compiler / loader runtime details (e.g. ORC-RT's __tlv_get_addr
implementations).
This patch only fixes the public API. Future changes will fix internal names.
Liren Peng [Wed, 22 Feb 2023 02:30:13 +0000 (02:30 +0000)]
[NFC] Use single quotes for single char output during `printPipline`
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D144365
Shilei Tian [Wed, 22 Feb 2023 02:09:20 +0000 (21:09 -0500)]
[Clang][OpenMP] Update tests using update_cc_test_checks.py
Make preparation for other patches
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D144320
Jun Ma [Mon, 20 Feb 2023 05:54:20 +0000 (13:54 +0800)]
[WebAssembly] Add more combine pattern for vector shift
After change with D144169, the codegen generates redundant instructions
like and and wrap. This fixes it.
Differential Revision: https://reviews.llvm.org/D144360
Diego Caballero [Wed, 22 Feb 2023 01:20:10 +0000 (01:20 +0000)]
[mlir][Vector] Support masking for more contraction flavors
This patch adds masking support for more contraction flavors including those
with any combiner operation (add, mul, min, max, and, or, etc.) and
regular matmul contractions.
Combiner operations that are performing vertical reductions (and,
therefore, they are not represented with a horizontal reduction
operation) can be executed unmasked. However, the previous value of
the accumulator must be propagated for lanes that shouldn't accumulate.
We achieve this goal by introducing a select operation after the
accumulator to choose between the combined and the previous accumulator
value. This design decision is made to avoid introducing masking support
to all the arithmetic and logical operations in the Arith dialect. VP
intrinsics do not support pass-thru values either so we would have to
generate the same sequence when lowering to LLVM. The op + select
pattern is peepholed by some backend with native masking support for those
operations.
Consequently, this patch removes masking support from the vector.fma
operation to follow the same approach for all the combiner operations.
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D144239
Shilei Tian [Wed, 22 Feb 2023 01:28:00 +0000 (20:28 -0500)]
Revert "[Clang][OpenMP] Update tests using update_cc_test_checks.py"
This reverts commit
61faf261506f93819e48f050f318f96452831f92 as it makes buildbot unhappy.
Ting Wang [Wed, 22 Feb 2023 01:24:12 +0000 (20:24 -0500)]
[PowerPC][NFC] add const-splat-array-init.ll
Add test case and will show combiner can improve these.
Reviewed By: lkail
Differential Revision: https://reviews.llvm.org/D144235
Wang, Xin10 [Wed, 22 Feb 2023 00:41:12 +0000 (08:41 +0800)]
[X86][NFC] Refactor X86InstrArithmetic.td by class
1. Extract the common code of some instructions into a class to reduce duplication
2. Refine some comments to the make the description of the class clearer
By this way, the records defined here will be consistent and easier to
maintain, I think.
Reviewed By: skan
Differential Revision: https://reviews.llvm.org/D144154
Shilei Tian [Wed, 22 Feb 2023 01:09:09 +0000 (20:09 -0500)]
[Clang][OpenMP] Update tests using update_cc_test_checks.py
Make preparation for other patches
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D144320
Slava Zakharin [Wed, 22 Feb 2023 01:03:53 +0000 (17:03 -0800)]
[flang] Avoid linking step for failing LIT tests added in D143301.
Lang Hames [Sat, 18 Feb 2023 04:28:07 +0000 (20:28 -0800)]
[ORC-RT][MachO] Use 'UseCallbackStyleUnwindInfo' flag, rather than re-test.
The UseCallbackStyleUnwindInfo flag already captures the original conditional,
and using the flag everywhere makes it easier to switch registration styles
when debugging.
Justin Bogner [Tue, 21 Feb 2023 22:37:18 +0000 (14:37 -0800)]
[Test] Set gitattributes for line endings in tapi inputs
LLVM's parsing of .tbd files errors out with "unsupported file type"
if the tbd files have CRLF line endings. Add gitattributes for the
inputs to avoid test failures on windows.
Differential Revision: https://reviews.llvm.org/D144527
Justin Bogner [Tue, 21 Feb 2023 22:28:04 +0000 (14:28 -0800)]
[Test] Invoke GetErrcMessages from config-ix instead of llvm/CMakeLists
Since GetErrcMessages uses cmake's `try_run` mechanism it's sensitive
to changes to CMAKE_CXX_FLAGS, so we move it into config-ix with the
similar flag-sensitive configuration. This makes it run before
HandleLLVMOptions and avoids issues with LLVM_ENABLE_WERROR and other
configuration that manipulate CMAKE_CXX_FLAGS.
Differential Revision: https://reviews.llvm.org/D144526
Nikolas Klauser [Mon, 20 Feb 2023 16:12:09 +0000 (17:12 +0100)]
[runtimes] Remove unused functions from Handle{Libcxx,Libunwind}Flags.cmake
Reviewed By: phosek, #libunwind, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D144400
Maryam Moghadas [Thu, 2 Feb 2023 18:31:44 +0000 (18:31 +0000)]
[PowerPC] Include vector bool and pixel when emitting lax warning
This patch is to fix some missing lax-vector-conversion warnings including
cases that involve vector bool and vector pixel, also to fix the vector
compatibility check for the warnings.
Differential Revision: https://reviews.llvm.org/D143210
Ethan Luis McDonough [Tue, 21 Feb 2023 22:09:34 +0000 (16:09 -0600)]
[flang] Handle unsupported warning flags
This PR makes flang emit a warning when the user passes an unsupported gfortran warning flag in as a CLI arg. This PR also checks each `-W` argument instead of just looking at the last one passed in.
Reviewed By: awarzynski
Differential Revision: https://reviews.llvm.org/D143301
Sanjay Patel [Tue, 21 Feb 2023 20:03:32 +0000 (15:03 -0500)]
[InstSimplify] enhance simplifyWithOpReplaced() to allow more 'select' removal
This is a generalization of a suggestion from issue #60799
that allows removing a redundant guard of an input value
via icmp+select. It should also solve issue #60801.
This only comes into play for a select with an equality
condition where we are trying to substitute a constant into
the false arm of a select. (A 'true' select arm substitution
allows "refinement", so it is not on this code path.)
The constant must be the same in the compare and the select,
and it must be a "binop absorber" (X op C = C). That query
currently includes 'or', 'and', and 'mul', so there are tests
for all of those opcodes.
We then use "impliesPoison" on the false arm binop and the
original "Op" to be replaced to ensure that the select is not
actually blocking poison from leaking. That could be
potentially expensive as we recursively test each operand, but
it is currently limited to a depth of 2. That's enough to catch
our motivating cases, but probably nothing more complicated
(although that seems unlikely).
I don't know how to generalize a proof for Alive2 for this, but
here's a positive and negative test example to help illustrate
the subtle logic differences of poison/undef propagation:
https://alive2.llvm.org/ce/z/Sz5K-c
Differential Revision: https://reviews.llvm.org/D144493
ManuelJBrito [Tue, 21 Feb 2023 21:58:27 +0000 (21:58 +0000)]
[InstCombine] Don't fold freeze poison when it's used in shufflevector
With this patch freeze undef/poison will no longer be folded into a constant if it's used as a
vector operand in a shufflevector.
Differential Revision: https://reviews.llvm.org/D143593
Maryam Moghadas [Tue, 21 Feb 2023 21:23:54 +0000 (15:23 -0600)]
[PowerPC] Fix the implicit casting for the emulated intrinsics
This patch is to fix some implicit castings for emulated intrinsics
so that there are no lax-vector-conversions errors and warnings.
Reviewed By: nemanjai, #powerpc
Differential Revision: https://reviews.llvm.org/D144293
Mark Danial [Tue, 21 Feb 2023 21:33:06 +0000 (16:33 -0500)]
[Flang] Add user option -funderscoring/-fnounderscoring to control trailing underscore added to external names
This patch adds user option -funderscoring/-fnounderscoring to control the trailing underscore being appended to external names (e.g. procedure names, common block names). The option in gfortran is documented in https://gcc.gnu.org/onlinedocs/gfortran/Code-Gen-Options.html.
Reviewed By: clementval
Differential Revision: https://reviews.llvm.org/D140795
Peiming Liu [Tue, 21 Feb 2023 21:26:46 +0000 (21:26 +0000)]
[mlir][sparse] revert optimization for dense->csc conversion.
Eliminates the sort seems make the whole conversion slower (probably because loop rotation leads to bad locality).
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D144517
Alexey Bataev [Tue, 21 Feb 2023 18:20:41 +0000 (10:20 -0800)]
[SLP]Do not swap not counted extractelements.
No need to swap extractelements, which were not excluded from the list
during cost analysis. It leads to incorrect cost calculation and make
vector code more profitable than it is actually is.
Siva Chandra Reddy [Thu, 16 Feb 2023 01:01:33 +0000 (01:01 +0000)]
[libc] Introduce a libc internal assertion macro named LIBC_ASSERT.
Few existing call-sites have been modified to use LIBC_ASSERT.
Reviewed By: lntue, michaelrj
Differential Revision: https://reviews.llvm.org/D144161
Krzysztof Parzyszek [Fri, 17 Feb 2023 17:39:04 +0000 (09:39 -0800)]
[Hexagon] Improve selection algorithm in HvxSelector::select
The previous algorithm could order nodes incorrectly, this one strictly
follows the topological order.
Michal Paszkowski [Thu, 16 Feb 2023 20:23:48 +0000 (21:23 +0100)]
[SPIR-V] Emit spv_undef intrinsic for aggregate undef operands
This change adds a new spv_undef intrinsic which is emitted in place of
aggregate undef operands and later selected to single OpUndef SPIR-V
instruction. The behavior matches that of Khronos SPIR-V Translator and
should support nested aggregates.
Differential Revision: https://reviews.llvm.org/D143107
Philip Reames [Tue, 21 Feb 2023 19:57:37 +0000 (11:57 -0800)]
[RISCV] Minor style cleanup in lowerVECTOR_SHUFFLEAsVNSRL [nfc]
Teresa Johnson [Sat, 18 Feb 2023 02:44:29 +0000 (18:44 -0800)]
[MemProf] Make hasSingleAllocType helper non-static
As suggested in D140908, make the hasSingleAllocType helper non-static
so that it can be used in other files. Add unit testing.
Differential Revision: https://reviews.llvm.org/D144318
Petr Hosek [Mon, 20 Feb 2023 23:07:09 +0000 (23:07 +0000)]
[libc][CMake] Missing TableGen include
HdrGen CMake build uses TableGen so it should include TableGen module.
Differential Revision: https://reviews.llvm.org/D144435
Brad Smith [Tue, 21 Feb 2023 19:51:18 +0000 (14:51 -0500)]
[Driver][FreeBSD] Fix DWARF test after
2a2c0fd96757871f4e8052624000c208cc574fdf
The default DWARF version without a FreeBSD version specified is 4.
Markus Böck [Tue, 21 Feb 2023 06:51:44 +0000 (07:51 +0100)]
[mlir][GPUToLLVM] Add support for emitting opaque pointers
Part of https://discourse.llvm.org/t/rfc-switching-the-llvm-dialect-and-dialect-lowerings-to-opaque-pointers/68179
This patch adds the new pass option `use-opaque-pointers` to the GPU to LLVM lowerings (including ROCD and NVVM) and adapts the code to support using opaque pointers in addition to typed pointers.
The required changes mostly boil down to avoiding `getElementType` and specifying base types in GEP and Alloca.
In the future opaque pointers will be the only supported model, hence tests have been ported to using opaque pointers by default. Additional regression tests for typed-pointers have been added to avoid breaking existing clients.
Note: This does not yet port the `GpuToVulkan` passes.
Differential Revision: https://reviews.llvm.org/D144448
Markus Böck [Tue, 21 Feb 2023 14:29:32 +0000 (15:29 +0100)]
[mlir][LLVM] Don't make `LLVM_IntPtrBase` a `BuildableType` to allow the use of opaque pointers
Making the constraint a buildable type makes them incompatible with opaque pointers, at least while we still support typed pointers, since Ops making use of the constraint will then automatically create a typed pointer on parse.
This patch therefore fixes that issue by removing the `BuildableType` mixin. This has a bit of a cascading effect however, as all users of the constraint now need operands of that type to be added to the assembly format, hence a lot of adjustments to the syntax of a lot of (mostly intrinsic) ops.
Few things of note: The syntax as is, is only required while we're supporting both typed and opaque pointers. Once we drop support for typed pointers, we can make it a `BuildableType` again. As a drive by I also fixed the address space not being verified in the constraint. Finally, I added some roundtripping tests, most importantly for ops with `type($specific_operand)` occurences. These are printed incorrectly with typed pointers if not wrapped within a `qualified`.
Differential Revision: https://reviews.llvm.org/D144479
Brad Smith [Tue, 21 Feb 2023 19:41:22 +0000 (14:41 -0500)]
[PowerPC] clang-format isPPC64ELFv2ABI() function. NFC
Jakub Kuderski [Tue, 21 Feb 2023 19:32:01 +0000 (14:32 -0500)]
Reland "[ADT] Relax type requirements for `is_contained`"