AdityaK [Tue, 21 Mar 2023 22:42:25 +0000 (15:42 -0700)]
Remove mips target triple for Android
Reviewers: enh, phosek, srhines, MaskRay
thanks to @enh for pointing these out.
Differential Revision: https://reviews.llvm.org/D146565
Colin Cross [Thu, 23 Mar 2023 20:22:32 +0000 (13:22 -0700)]
[PATCH] Enable targeting riscv64-linux-android
Reviewers: ccross, asb, phosek, enh, srhines, hiraditya
Putting: https://android.googlesource.com/toolchain/llvm_android/+/refs/heads/master/patches/Enable-targeting-riscv64-linux-android.patch for review.
Differential Revision: https://reviews.llvm.org/D146560
Kirill Stoimenov [Thu, 23 Mar 2023 20:25:47 +0000 (20:25 +0000)]
[HWASAN] Fix decorate_proc_maps to work with HWASAN
Alex Langford [Wed, 22 Mar 2023 23:17:49 +0000 (16:17 -0700)]
[lldb-server] Use Platform plugin corresponding to the host
In
ee232506b870ce5282cc4da5ca493d41d361feb3 I moved UnixSignal
initialization from lldbTarget to the various platform plugins. This
inadvertently broke lldb-server because lldb-server doesn't use
Platform plugins. lldb-server still needs to be able to create a
UnixSignals object for the host platform so we can add the relevant
platform plugin to lldb-server to make sure we always have a
HostPlatform.
Differential Revision: https://reviews.llvm.org/D146668
Nick Desaulniers [Thu, 23 Mar 2023 19:38:57 +0000 (12:38 -0700)]
[StackProtector] attribute __stack_chk_fail as NoReturn
When GCC added support for stack smashing protections, it was defined
that:
> This hook returns a CALL_EXPR that alerts the runtime that the stack
> protect guard variable has been modified. This expression should
> involve a call to a noreturn function.
> The default version of this hook invokes a function called
> ‘__stack_chk_fail’, taking no arguments.
Do so as well for __stack_smash_handler for OpenBSD.
Every libc implementation I could find has __stack_chk_fail marked
noreturn, or the implementation calls abort, exit, or panic (which
themselves are noreturn).
Glibc: https://sourceware.org/git/?p=glibc.git;a=blob;f=debug/stack_chk_fail.c
Musl: https://git.musl-libc.org/cgit/musl/tree/src/env/__stack_chk_fail.c
Bionic: https://android.googlesource.com/platform/bionic/+/refs/heads/master/libc/bionic/__stack_chk_fail.cpp
FreeBSD: https://cgit.freebsd.org/src/tree/lib/libc/secure/stack_protector.c
OpenBSD: https://github.com/openbsd/src/blob/master/lib/libc/sys/stack_protector.c
NetBSD: https://github.com/NetBSD/src/blob/trunk/lib/libc/misc/stack_protector.c
Linux Kernel: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/kernel/panic.c
Apple: https://opensource.apple.com/source/Libc/Libc-1439.40.11/sys/OpenBSD/stack_protector.c.auto.html
Link: https://gcc.gnu.org/onlinedocs/gccint/Stack-Smashing-Protection.html#Stack-Smashing-Protection
This will later help us diagnose functions that fall through to other
functions vs end in calls to functions that are noreturn.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D146339
Chia-hung Duan [Thu, 23 Mar 2023 19:38:48 +0000 (19:38 +0000)]
[scudo] Add a Timer class to assist performance measurement
Add Timer and TimingManager which provide convenient way to meause the
execution time of code snippets. The output looks like,
```
-- Average Operation Time -- -- Name (# of Calls) --
1747.2(ns) popBatch (59)
92.3(ns) popBatchImpl (73)
101.6(ns) EmptyBatchProcess (5)
2587.0(ns) pushBlocksImpl (13)
```
Note that `EmptyBatchProcess` is nested under the timer `popBatchImpl`.
Reviewed By: cferris
Differential Revision: https://reviews.llvm.org/D143626
Simon Pilgrim [Thu, 23 Mar 2023 19:36:29 +0000 (19:36 +0000)]
[X86] combineVectorSizedSetCCEquality - update arguments to use individual SETCC operands. NFC.
Alex Brachet [Thu, 23 Mar 2023 18:43:09 +0000 (18:43 +0000)]
[libc] Move fma and fmaf into generic dir
Differential Revision: https://reviews.llvm.org/D146740
Nicolas Vasilache [Thu, 23 Mar 2023 15:32:48 +0000 (08:32 -0700)]
[mlir][Vector] NFC - Reorganize vector patterns
Vector dialect patterns have grown enormously in the past year to a point where they are now impenetrable.
Start reorganizing them towards finer-grained control.
Differential Revision: https://reviews.llvm.org/D146736
Julian Lettner [Thu, 23 Mar 2023 18:01:33 +0000 (11:01 -0700)]
[TSan][Darwin] Test fix external-swift-debugging.cpp
My recent change [1] extended the external-swift-debugging.cpp test, but
didn't account for PAC under which function pointers aren't trivially
comparable. We could use `ptrauth_strip()`, but for the test it's easier
to just the symbol name.
[1] https://reviews.llvm.org/D146264
Nicolas Vasilache [Thu, 23 Mar 2023 17:47:04 +0000 (10:47 -0700)]
[mlir][Vector] Retire one old filter-based test
Differential Revision: https://reviews.llvm.org/D146742
Momchil Velikov [Thu, 23 Mar 2023 17:38:07 +0000 (17:38 +0000)]
[CodeGenPrepare][NFC] Pre-commit test for memory use count fix
Reviewed By: mkazantsev
Differential Revision: https://reviews.llvm.org/D145705
Simon Pilgrim [Thu, 23 Mar 2023 17:49:39 +0000 (17:49 +0000)]
[X86] Refactor movmsk(icmp_eq(and(x,c1),0)) -> movmsk(not(shl(x,c2))) fold to use KnownBits
We don't need an explicit AND mask, we can use KnownBits to determine if each element has (the same) single non-zero bit and shift that into the msb/signbit for MOVMSK to access directly.
Paul Kirth [Thu, 23 Mar 2023 17:13:35 +0000 (17:13 +0000)]
[support] Fix PrintNumber Test on AIX
When fixing the test earlier, we missed the JSON case for NaN and INF,
so handle those the same as for non-JSON, by creating the string
dynamically.
Reviewed By: abhina.sreeskantharajan
Differential Revision: https://reviews.llvm.org/D146739
Emilia Dreamer [Thu, 23 Mar 2023 17:31:39 +0000 (19:31 +0200)]
[clang-format] Allow trailing return types in macros
The trailing return type arrow checker verifies that a declaration is
being parsed, however, this isn't true when inside of macros.
It turns out the existence of the auto keyword is enough to make
sure that we're dealing with a trailing return type, and whether we're
in a declaration doesn't matter.
Fixes https://github.com/llvm/llvm-project/issues/47664
Reviewed By: HazardyKnusperkeks, owenpan
Differential Revision: https://reviews.llvm.org/D141811
Momchil Velikov [Thu, 23 Mar 2023 17:16:31 +0000 (17:16 +0000)]
[CodeGenPrepare] Don't give up if unable to sink first arg to a cold call
Reviewed By: mkazantsev
Differential Revision: https://reviews.llvm.org/D143892
Mike Hommey [Thu, 23 Mar 2023 17:09:00 +0000 (17:09 +0000)]
[libcxx] Fix build bustage with threads disabled
Building with -DLIBCXX_ENABLE_THREADS=OFF -DLIBCXXABI_ENABLE_THREADS=OFF
(like e.g. for wasm) fails after D146228 because of a misplaced std
namespace begin/end.
Reviewed By: philnik, #libc
Differential Revision: https://reviews.llvm.org/D146682
Hristo Hristov [Wed, 22 Mar 2023 21:24:22 +0000 (23:24 +0200)]
[libc++][ranges] P2711R1 Making multi-param constructors of views explicit
Implemented [[ https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2711r1.html | P2711R1 ]] for existing views.
(`join_with_view` is not yet implemented)
Reviewed By: #libc, philnik
Differential Revision: https://reviews.llvm.org/D144822
Viktoriia Bakalova [Thu, 23 Mar 2023 17:27:10 +0000 (17:27 +0000)]
[clangd] Fix indentation in HoverTests.cpp
Fangrui Song [Thu, 23 Mar 2023 17:19:10 +0000 (10:19 -0700)]
[docs] Document -fomit-frame-pointer
Close #61322
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D146603
Alex Brachet [Thu, 23 Mar 2023 17:07:19 +0000 (17:07 +0000)]
[libc] Fix some math conversion warnings
Differential Revision: https://reviews.llvm.org/D146738
Michael Jones [Mon, 13 Mar 2023 23:43:05 +0000 (16:43 -0700)]
[libc] enable printf using system FILE
The printf and fprintf implementations use our internal implementation
to improve performance when it's available, but this patch enables using
the public FILE API for overlay mode.
Reviewed By: sivachandra, lntue
Differential Revision: https://reviews.llvm.org/D146001
Jeff Byrnes [Wed, 15 Mar 2023 19:11:20 +0000 (12:11 -0700)]
[ArgPromotion] Remove dead code produced by removing dead arguments
ArgPromotion currently produces phantom / dead loads. A good example of this is store-into-inself.ll. First, ArgPromo finds the promotable argument %p in @l. Then it inserts a load of %p in the caller, and passes instead the loaded value / transforms the function body. PromoteMem2Reg is able to optimize out the entire function body, resulting in an unused argument. In a subsequent ArgPromotion pass, it removes the dead argument, resulting in a dead load in the caller. These dead loads may reduce effectiveness of other transformations (e.g. SimplifyCFG, MergedLoadStoreMotion).
This patch removes loads and geps that are made dead in the caller after removal of dead args.
Differential Revision: https://reviews.llvm.org/D146327
Renaud-K [Tue, 21 Mar 2023 23:32:26 +0000 (16:32 -0700)]
[flang] Lowering fir.dispatch in the polymorphic op pass
Differential revision: https://reviews.llvm.org/D146594
Nikita Popov [Thu, 23 Mar 2023 16:32:23 +0000 (17:32 +0100)]
[MergeFunc] Don't assume constant metadata operands
We should not call mdconst::extract, unless we know that the
metadata in question is ConstantAsMetadata.
For now we consider all other metadata as equal. The noalias test
shows that this is not correct, but at least it doesn't crash
anymore.
Joseph Huber [Thu, 23 Mar 2023 16:27:20 +0000 (11:27 -0500)]
[libc] Fix inline assembly for nvptx quick_exit
Summary:
The `exit` function in NVPTX has no intrinsic, but the assembly requires
a semicolon in the ptx, otherwise it will fail.
Archibald Elliott [Thu, 23 Mar 2023 15:56:07 +0000 (15:56 +0000)]
[NFC][AArch64] Sort Hints in armv8.3a-signed-pointer.s test
Joseph Huber [Thu, 23 Mar 2023 14:05:34 +0000 (09:05 -0500)]
[libc] Implement memory fences on NVPTX
Memory fences are not handled by the NVPTX backend. We need to replace
them with a memory barrier intrinsic function. This doesn't include the
ordering, but should perform the necessary functionality, albeit slower.
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D146725
Viktoriia Bakalova [Tue, 28 Feb 2023 16:27:05 +0000 (16:27 +0000)]
[clangd] Add provider info on symbol hover.
Differential Revision: https://reviews.llvm.org/D144976
Teresa Johnson [Thu, 23 Mar 2023 16:15:57 +0000 (09:15 -0700)]
[MemProf] Use stable_sort to avoid non-determinism
Switch from std::sort to std::stable_sort when sorting callsites to
avoid non-determinism when the comparisons are equal. This showed up in
internal testing of
fe27495be2040007c7b20844a9371b06156ab405.
Simon Pilgrim [Thu, 23 Mar 2023 16:10:32 +0000 (16:10 +0000)]
[X86] LowerVectorAllZero - lower to CMP(MOVMSK(NOT(X)),0) instead of CMP(MOVMSK(X),65535)
In most cases the NOT will still be scalarized, but it allows us to perform the CMP(X,0) combines inside combineCMP()
Ding Xiang Fei [Thu, 23 Mar 2023 16:04:21 +0000 (17:04 +0100)]
[MergeFuncs] Add tests for D144682 (NFC)
I forgot to git add this test when committing the change.
Philip Reames [Thu, 23 Mar 2023 15:47:44 +0000 (08:47 -0700)]
[BoundsChecking] Don't crash on scalable vector sizes
Felipe de Azevedo Piovezan [Thu, 23 Mar 2023 12:18:53 +0000 (08:18 -0400)]
[lldb] Explicitly set libcxx paths when USE_SYSTEM_STDLIB is provided
For tests marked as "USE_SYSTEM_STDLIB", the expectation is that the
system's standard library should be used. However, the implementation of
this flag is such that we simply don't pass _any_ libcxxx-related flags
to Clang; in turn, Clang will use its defaults.
For a Clang/Libcxx pair compiled together, Clang defaults to:
1. The headers of the sibling libcxx.
2. The libraries of the system.
This mismatch is actually a bug in the driver; once fixed, however, (2)
would point to the sibling libcxx as well, which is _not_ what test
authors intended with the USE_SYSTEM_STDLIB flag.
As such, this patch explicitly sets a path to the system's libraries.
This change is done only in Apple platforms so that we can test this
works in this case first.
Differential Revision: https://reviews.llvm.org/D146714
Jan Sjodin [Tue, 21 Mar 2023 17:38:54 +0000 (13:38 -0400)]
[OpenMP][OMPIRBuilder] Make OffloadEntriesInfoManager a member of OpenMPIRBuilder
This patch adds the OffloadEntriesInfoManager to the OpenMPIRBuilder, and
allows the OffloadEntriesInfoManager to access the Configuration in the
OpenMPIRBuilder. With the shared Config there is no risk for inconsistencies,
and there is no longer the need for clang to have a separate
OffloadEntriesInfoManager.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D146549
Job Noorman [Thu, 23 Mar 2023 15:25:53 +0000 (16:25 +0100)]
Test commit to see if write access works
Philip Reames [Thu, 23 Mar 2023 15:09:32 +0000 (08:09 -0700)]
[HWASAN] Instrument scalable load/store without crashing
We can simply push them down the existing call slowpath with some minor changes to how we compute the size argument.
Kirill Stoimenov [Wed, 22 Mar 2023 18:09:00 +0000 (18:09 +0000)]
[HWASAN] Disable unexpected_format_specifier_test because HWASAN doesn't provide a printf interceptor
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D146647
Archibald Elliott [Wed, 22 Mar 2023 13:25:08 +0000 (13:25 +0000)]
[AArch64] Add Missing Custom Target Operands
I noticed, when examining the generated Asm Matcher table, that some of
these custom immediate operands are missing, and so we are not parsing
some hint aliases into the correct MCInst.
Where this becomes apparent is when you parse e.g. `hint #7` into an
MCInst - without these cases, it becomes the MCInst `(HINT 17)`, which
will always be printed as `hint #17`. With these cases, it becomes the
MCInst `XPACLRI`, which will be printed as `xpaclri` with pauth, or
`hint #17` without, matching how `xpaclri` is parsed.
We only handle some specific hint aliases in this manner, usually where
these hints have specific effects that need to be modelled for accurate
code-generation. Otherwise, we just use the normal `InstAlias` system
to have the aliases parsed into a `(HINT N)` MCInst.
Differential Revision: https://reviews.llvm.org/D146630
Corentin Jabot [Tue, 21 Mar 2023 15:57:43 +0000 (16:57 +0100)]
[Clang] Fix evaluation of parameters of lambda call operator attributes
Fix a regresion introduced by D124351.
Attributes of lambda call operator were evaluated in the
context of the closure object type rather than its operator,
causing an assertion failure.
This was because we temporarily switch to the class lambda to
produce the mangling of the lambda, but we stayed in that
context too long.
Reviewed By: eandrews, aaron.ballman
Differential Revision: https://reviews.llvm.org/D146535
Philip Reames [Thu, 23 Mar 2023 14:23:36 +0000 (07:23 -0700)]
[MSAN] Support load and stores of scalable vector types
This adds support for scalable vector types - at least far enough to get basic load and store cases working. It turns out that load/store without origin tracking already worked; I apparently got that working with one of the pre patches to use TypeSize utilities and didn't notice. The code changes here are required to enable origin tracking.
For origin tracking, a 4 byte value - the origin - is broadcast into a shadow region whose size exactly matches the type being accessed. This origin is only written if the shadow value is non-zero. The details of how shadow is computed from the original value being stored aren't relevant for this patch.
The code changes involve two related primitives.
First, we need to be able to perform that broadcast into a scalable sized memory region. This requires the use of a loop, and appropriate bound. The fixed size case optimizes with larger stores and alignment; I did not bother with that for the scalable case for now. We can optimize this codepath later if desired.
Second, we need a way to test if the shadow is zero. The mechanism for this in the code is to convert the shadow value into a scalar, and then zero check that. There's an assumption that this scalar is zero exactly when all elements of the shadow value are zero. As a result, we use an OR reduction on the scalable vector. This is analogous to how e.g. an array is handled. I landed a bunch of cleanup changes to remove other direct uses of the scalar conversion to convince myself there were no other undocumented invariants.
Differential Revision: https://reviews.llvm.org/D146157
khei4 [Thu, 9 Mar 2023 09:46:14 +0000 (18:46 +0900)]
[AggressiveInstCombine] folding load for constant global patterened arrays and structs by alignment
Differential Revision: https://reviews.llvm.org/D144445
Reviewed By: nikic
fix: wrong arrow
khei4 [Thu, 9 Mar 2023 06:31:11 +0000 (15:31 +0900)]
[AggressiveInstCombine] Pre-Commit test for D144445 (NFC)
Differential Revision: https://reviews.llvm.org/D145355
tweak: test
Doru Bercea [Tue, 21 Mar 2023 18:07:57 +0000 (14:07 -0400)]
Enable constexpr class members that are device-mapped to not be optimized out.
This patch fixes an issue whereby a constexpr class member which is
mapped to the device is being optimized out thus leading to a runtime
error.
Patch: https://reviews.llvm.org/D146552
Ye Luo [Thu, 23 Mar 2023 13:56:47 +0000 (08:56 -0500)]
[OpenMP] Add notifyDataUnmapped back in disassociatePtr
Fix regression introduced by https://reviews.llvm.org/D123446
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D146689
David Spickett [Thu, 23 Mar 2023 13:46:49 +0000 (13:46 +0000)]
[lldb][AArch64] Fix run-qemu.sh when only MTE is enabled.
SVE and MTE both require a CPU with that feature before
you can use the other options, but we only added the "max"
cpu when SVE was enabled too.
Qiongsi Wu [Thu, 23 Mar 2023 13:16:18 +0000 (09:16 -0400)]
[AIX][CodeGen] Storage Locations for Constant Pointers
This patch adds an `llc` option `-mroptr` to specify storage locations for constant pointers on AIX.
When the `-mroptr` option is specified, constant pointers, virtual function tables, and virtual type tables are placed in read-only storage. Otherwise, by default, pointers, virtual function tables, and virtual type tables are placed are placed in read/write storage.
https://reviews.llvm.org/D144190 enables the `-mroptr` option for `clang`.
Reviewed By: hubert.reinterpretcast, stephenpeckham, myhsu, MaskRay, serge-sans-paille
Differential Revision: https://reviews.llvm.org/D144189
Alexey Lapshin [Thu, 23 Mar 2023 13:40:29 +0000 (14:40 +0100)]
Revert "[ADT] add ConcurrentHashtable class."
This reverts commit
8482b238062ed7263facea9490f67119e00a037a.
Benjamin Kramer [Thu, 23 Mar 2023 13:41:03 +0000 (14:41 +0100)]
Silence unused variable warning in NDEBUG builds
I usually would fold this into the assert, but the comment there
suggests side effects. NFC.
ModuleMap.cpp:938:9: error: unused variable 'MainFile' [-Werror,-Wunused-variable]
auto *MainFile = SourceMgr.getFileEntryForID(SourceMgr.getMainFileID());
Simon Pilgrim [Thu, 23 Mar 2023 13:37:04 +0000 (13:37 +0000)]
[X86] LowerVectorAllZero - add 512-bit support with AVX512 vptestnmd+kortestw patterns (REAPPLIED)
Another step toward #53419 - this is also another step towards expanding MatchVectorAllZeroTest to match any pair of vectors and merge EmitAVX512Test into it.
Alexey Lapshin [Wed, 22 Mar 2023 16:37:15 +0000 (17:37 +0100)]
[ADT] add ConcurrentHashtable class.
ConcurrentHashTable - is a resizeable concurrent hashtable.
The range of resizings is limited up to x2^32. The hashtable allows only concurrent insertions.
Concurrent hashtable is necessary for the D96035 patch.
Reviewed By: JDevlieghere
Differential Revision: https://reviews.llvm.org/D132455
Johannes de Fine Licht [Thu, 23 Mar 2023 13:22:15 +0000 (14:22 +0100)]
[MLIR][LLVM] Move the LLVM inliner interface into a separate file.
A fully fledged LLVM inliner will require a lot of logic. Since
`LLVMDialect.cpp` is large enough as it is, preemptively outline the
inlining logic into a separate `.cpp` file. This will also allow us to
add a `DEBUG_TYPE` for debugging the inliner.
The name `LLVMInlining` was chosen over `LLVMInlinerInterface` to keep
the option open for exposing inlining functionality even when not
invoked through the `DialectInlinerInterface`.
Depends on D146616
Reviewed By: gysit
Differential Revision: https://reviews.llvm.org/D146628
NAKAMURA Takumi [Wed, 22 Mar 2023 23:47:55 +0000 (08:47 +0900)]
[Bazel] Rework `//llvm:llvm-tblgen` and `//llvm/unittests:tablegen_tests`
`llvm/utils/TableGen/GlobalISel` should be exported.
FYI, after D144351,`tablegen_tests` behaved same
as `llvm-tblgen -print-records`.
It suceeded because stdin is `/dev/null`.
Simon Pilgrim [Thu, 23 Mar 2023 13:07:29 +0000 (13:07 +0000)]
[X86] LowerVectorAllZero - early out for masked v2i64 cases without PTEST. NFC.
Job Noorman [Thu, 23 Mar 2023 13:01:22 +0000 (13:01 +0000)]
[RISCV][test] Fix another missed test change from RV64E patch
c39dd7c1db97fa367cb6282067b74cd8e55ef09a missed a needed change to the
llvm-objdump test.
Job Noorman [Thu, 23 Mar 2023 12:48:03 +0000 (12:48 +0000)]
[RISCV][clang][test] Fix missed test
c39dd7c1db97fa367cb6282067b74cd8e55ef09a missed the appropriate change
to clang/test/Driver/ricv-arch.c.
Iain Sandoe [Fri, 3 Jun 2022 09:43:38 +0000 (10:43 +0100)]
[C++20][Modules] Introduce an implementation module.
We need to be able to distinguish individual TUs from the same module in cases
where TU-local entities either need to be hidden (or, for some cases of ADL in
template instantiation, need to be detected as exposures).
This creates a module type for the implementation which implicitly imports its
primary module interface per C++20:
[module.unit/8] 'A module-declaration that contains neither an export-keyword
nor a module-partition implicitly imports the primary module interface unit of
the module as if by a module-import-declaration.
Implementation modules are never serialized (-emit-module-interface for an
implementation unit is diagnosed and rejected).
Differential Revision: https://reviews.llvm.org/D126959
Simon Pilgrim [Thu, 23 Mar 2023 12:37:11 +0000 (12:37 +0000)]
Revert rG6aa7cc037f2f95c237c1d82c523f8857fa3a10c3 - "[X86] LowerVectorAllZero - add 512-bit support with AVX512 vptestnmd+kortestw patterns"
Reverted - I need to adjust the implementation so we can properly refactor it into a "LowerVectorAllEqual" function
Yi Kong [Thu, 23 Mar 2023 12:29:17 +0000 (20:29 +0800)]
[llvm-objdump] Fix help message for --print-imm-hex
Commit
cc2457ca1bbd changed the default but forgot to update the help message.
Job Noorman [Thu, 23 Mar 2023 12:17:57 +0000 (12:17 +0000)]
[RISCV][MC] Add support for RV64E
Implement MC support for the recently ratified RV64E base instruction
set.
Differential Revision: https://reviews.llvm.org/D143570
Simon Pilgrim [Thu, 23 Mar 2023 12:18:45 +0000 (12:18 +0000)]
[X86] LowerVectorAllZero - add 512-bit support with AVX512 vptestnmd+kortestw patterns
Another step toward #53419 - this is also another step towards expanding MatchVectorAllZeroTest to match any pair of vectors and merge EmitAVX512Test into it.
Kadir Cetinkaya [Mon, 20 Mar 2023 08:07:18 +0000 (09:07 +0100)]
[IncludeCleaner][clangd] Mark umbrella headers as users of private
Private headers inside umbrella files shouldn't be marked as unused.
Differential Revision: https://reviews.llvm.org/D146406
Aaron Ballman [Thu, 23 Mar 2023 12:05:15 +0000 (08:05 -0400)]
Revert "libclang: Pass Clang install directory to driver via argv[0]."
This reverts commit
201fdef40dd6ec193d18d39638454a3c972f1fec.
There was an issue found in post-commit by:
https://lab.llvm.org/buildbot/#/builders/91/builds/15272
Nico Weber [Thu, 23 Mar 2023 11:56:33 +0000 (12:56 +0100)]
Quentin Colombet [Thu, 23 Mar 2023 11:43:34 +0000 (12:43 +0100)]
[mlir] Fix call of overloaded ‘dropResults(<brace-enclosed initializer list>)’ is ambiguous
NFC
Jacek Caban [Thu, 23 Mar 2023 11:20:37 +0000 (13:20 +0200)]
[lld] Fill .text section gaps with INT3 only on x86 targets.
It doesn't make sense on ARM and using default 0 fill is compatible
with MSVC.
(It's more noticeable ARM64EC targets, where additional padding mixed
with alignment is used for entry thunk association, so there are more
gaps).
Reviewed By: mstorsjo
Differential Revision: https://reviews.llvm.org/D145962
Jacek Caban [Thu, 23 Mar 2023 11:20:15 +0000 (13:20 +0200)]
[llvm-lib] Use COFF archive format in llvm-lib (other archive tools don't use this format).
We currently just use GNU format for llvm-lib. This mostly works, but
ARM64EC needs an additional section that does not really fit GNU format.
This patch implements writing in COFF format (as in, it's what archive
reader considers as K_COFF). This mostly requires symbol emitting symbol
map. Note that, just like in case of MSVC, symbols are de-duplicated in
both usual symbol table and the new symbol map.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D143540
Jacek Caban [Thu, 23 Mar 2023 11:19:53 +0000 (13:19 +0200)]
[Object][NFC] Don't insert string table into object members vector.
Having string table in members vector does not fit later patches in
this series. Symbol map needs to refer to objects' offsets, but string
table should not be referenced. Also for ARM64EC, the new <ECSYMBOLS>
table is inserted after string table.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D143538
Jacek Caban [Thu, 23 Mar 2023 11:18:14 +0000 (13:18 +0200)]
[Object][NFC] Factor out computeHeadersSize.
In preparation for COFF archives support.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D143537
luxufan [Thu, 23 Mar 2023 11:31:29 +0000 (19:31 +0800)]
[Local] Use most generic range if K does not dominate J or K doesn't have a !noundef
Since D141386 has changed the return value of !range from IUB to poison,
metadata !range shouldn't be preserved even if K dominates J.
If this patch was accepted, I plan to adjust metadata !nonnull as well.
BTW, I found that metadata !noundef is not handled in combineMetadata,
is this intentional?
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D142687
LLVM GN Syncbot [Thu, 23 Mar 2023 11:20:20 +0000 (11:20 +0000)]
[gn build] Port
c2de8ff92753
LLVM GN Syncbot [Thu, 23 Mar 2023 11:20:19 +0000 (11:20 +0000)]
[gn build] Port
48f97e575137
Alex Bradbury [Thu, 23 Mar 2023 11:17:40 +0000 (11:17 +0000)]
[RISCV][test] Fix broken unit test after
d25751779ba
The patch had missed the RISCVISAInfoTest.cpp change.
Nicolas Vasilache [Tue, 21 Mar 2023 21:41:20 +0000 (14:41 -0700)]
[mlir][Tensor] Add a FoldTensorSubsetOps pass and patterns
These patterns follow FoldMemRefAliasOps which is further refactored for reuse.
In the process, fix FoldMemRefAliasOps handling of strides for vector.transfer ops which was previously incorrect.
These opt-in patterns generalize the existing canonicalizations on vector.transfer ops.
In the future the blanket canonicalizations will be retired.
They are kept for now to minimize porting disruptions.
Differential Revision: https://reviews.llvm.org/D146624
Haojian Wu [Fri, 17 Mar 2023 09:33:07 +0000 (10:33 +0100)]
[clangd] Extend CollectMainFileMacros.
Extend the existing MainFileMacros structure:
- record more information (InConditionalDirective) in MacroOccurrence
- collect macro references inside macro body (fix a long-time FIXME)
So that the MainFileMacros preseve enough information, which allows a
just-in-time convertion to interop with include-cleaner::Macro for
include-cleaer features.
See the context in https://reviews.llvm.org/D146017.
Differential Revision: https://reviews.llvm.org/D146279
Sam McCall [Fri, 24 Feb 2023 13:50:00 +0000 (14:50 +0100)]
[FlowSensitive] Log analysis progress for debugging purposes
The goal is to be able to understand how the analysis executes, and what its
incremental and final findings are, by enabling logging and reading the logs.
This should include both framework and analysis-specific information.
Ad-hoc printf-debugging doesn't seem sufficient for my understanding, at least.
Being able to check in logging, turn it on in a production binary, and quickly
find particular analysis steps within complex functions seem important.
This can be enabled programmatically through DataflowAnalysisOptions, or
via the flag -dataflow-log. (Works in unittests, clang-tidy, standalone
tools...)
Important missing pieces here:
- a logger implementation that produces an interactive report (HTML file)
which can be navigated via timeline/code/CFG.
(I think the Logger interface is sufficient for this, but need to prototype).
- display of the application-specific lattice
- more useful display for the built-in environment
(e.g. meaningful & consistent names for values, hiding redundant variables in
the flow condition, hiding unreachable expressions)
Differential Revision: https://reviews.llvm.org/D144730
Luke Lau [Fri, 10 Feb 2023 11:03:55 +0000 (11:03 +0000)]
[RISCV] Increase default vectorizer LMUL to 2
After some discussion and experimentation, we have seen that changing the default number of vector register bits to LMUL=2 strikes a sweet spot.
Whilst we could be clever here and make the vectorizer smarter about dynamically selecting an LMUL that
a) Doesn't affect register pressure
b) Suitable for the microarchitecture
we would need to teach its heuristics about RISC-V register grouping specifics.
Instead this just does the easy, pragmatic thing by changing the default to a safe value that doesn't affect register pressure signifcantly[1], but should increase throughput and unlock more interleaving.
[1] Register spilling when compiling sqlite at various levels of `-riscv-v-register-bit-width-lmul`:
LMUL=1 2573 spills
LMUL=2 2583 spills
LMUL=4 2819 spills
LMUL=8 3256 spills
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D143723
Adam Paszke [Thu, 23 Mar 2023 10:12:56 +0000 (10:12 +0000)]
[mlir][Vector] Make sure that vector.contract preserves extra attributes while parsing
The old implementation parsed the optional attribute dict, only to replace its
contents by using `assign`.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D146707
Carlos Galvez [Thu, 23 Mar 2023 10:30:01 +0000 (10:30 +0000)]
[clang-tidy][NFC] Fix broken link in Release Notes
Stefan Gränitz [Thu, 23 Mar 2023 10:10:39 +0000 (11:10 +0100)]
[JITLink] Initial AArch32 backend
This first version lays the foundations for AArch32 support in JITLink. ELFLinkGraphBuilder_aarch32 processes REL-type relocations and populates LinkGraphs from ELF object files for both big- and little-endian systems. The ArmCfg member controls subarchitecture-specific details throughout the linking process (i.e. it's passed to ELFJITLinker_aarch32).
Relocation types follow the ABI documentation's division into classes: Data (endian-sensitive), Arm (32-bit little-endian) and Thumb (2x 16-bit little-endian, "Thumb32" in the docs). The implementation of instruction encoding/decoding for relocation resolution is implemented symmetrically and is testable in isolation (see AArch32 category in JITLinkTests).
Callable Thumb functions are marked with a ThumbSymbol target-flag and stored in the LinkGraph with their real addresses. The thumb-bit is added back in when the owning JITDylib requests the address for such a symbol.
The StubsManager can generate (absolute) Thumb-state stubs for branch range extensions on v7+ targets. Proper GOT/PLT handling is not yet implemented.
This patch is based on the backend implementation in ez-clang and has just enough functionality to model the infrastructure and link a Thumb function `main()` that calls `printf()` to dump "Hello Arm!" on Armv7a. It was tested on Raspberry Pi with 32-bit Raspbian OS.
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D144083
Job Noorman [Thu, 23 Mar 2023 09:45:16 +0000 (17:45 +0800)]
Bump RV32E version to 2.0
RV32E was recently [ratified](https://github.com/riscv/riscv-isa-manual/commit/
afd613691cb89ccd7584206e8a6d1866fe77ec88) so we should update the version as our MC-layer support is complete.
Reviewed By: kito-cheng
Differential Revision: https://reviews.llvm.org/D144384
Yevgeny Rouban [Thu, 23 Mar 2023 09:19:19 +0000 (16:19 +0700)]
[AsmParser] Avoid instantiating LLVMContext if not needed. Try 2.
The deleted copy constructor LLVMContext(LLVMContext &) got its
parameter changed to const to allow the latest clang compiler to
instantiatiate template std::optional<LLVMContext>.
Differential Revision: https://reviews.llvm.org/D142699
mydeveloperday [Thu, 23 Mar 2023 09:52:59 +0000 (09:52 +0000)]
Revert "[clang-format] NFC Format.h and ClangFormatStyleOptions.rst are out of date"
This reverts commit
7a5b95732ade6c2de69b26f1038aa0a5afc39393.
mydeveloperday [Thu, 23 Mar 2023 09:45:00 +0000 (09:45 +0000)]
[clang-format] NFC Format.h and ClangFormatStyleOptions.rst are out of date
Regenerate the style documentation, requires some minor sphinx changes to avoid warnings
Differential Revision: https://reviews.llvm.org/D146704
Simon Pilgrim [Thu, 23 Mar 2023 09:42:45 +0000 (09:42 +0000)]
[X86] LowerVectorAllZero - early out if the type size is not pow2. NFC.
David Spickett [Wed, 22 Mar 2023 10:05:48 +0000 (10:05 +0000)]
[llvm][ARM] Refactor isMnemonicVPTPredicable
Fixes #61607
Several names were repeated in this giant list. I have refactored
it and removed the duplicates.
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D146619
Nico Weber [Thu, 23 Mar 2023 09:34:29 +0000 (10:34 +0100)]
[gn] Port
e655d8a54880 more
Timm Bäder [Thu, 23 Mar 2023 09:33:03 +0000 (10:33 +0100)]
Revert "[clang][Interp][NFC] Add tests for __fp16"
This reverts commit
0691bcb18024a28e82e8dd9a08ab0820b40c9a37.
Looks like this breaks builders, e.g.
https://lab.llvm.org/buildbot#builders/231/builds/9790
MarcoFalke [Tue, 14 Mar 2023 13:23:07 +0000 (14:23 +0100)]
clang-tidy: Detect use-after-move in CXXCtorInitializer
Fixes https://github.com/llvm/llvm-project/issues/51844
Differential Revision: https://reviews.llvm.org/D146288
esmeyi [Thu, 23 Mar 2023 09:09:47 +0000 (05:09 -0400)]
[XCOFF] support the ref directive for object generation.
Summary: A R_REF relocation as a non-relocating reference is required to prevent garbage collection (by the binder) of the ref symbol in object generation.
Reviewed By: shchenz
Differential Revision: https://reviews.llvm.org/D144356
Timm Bäder [Mon, 20 Mar 2023 16:43:26 +0000 (17:43 +0100)]
[clang][Interp][NFC] Add tests for __fp16
Differential Revision: https://reviews.llvm.org/D146436
Matthias Springer [Thu, 23 Mar 2023 08:40:51 +0000 (09:40 +0100)]
[mlir][Analysis][NFC] Make BoundType a top-level enum
`BoundType` is no longer a nested member of `IntegerRelation` but a top-level enum in the `presburger` namespace.
This allows `BoundType` to be predeclared in header files. Nested members cannot be predeclared.
Differential Revision: https://reviews.llvm.org/D146210
Uday Bondhugula [Thu, 23 Mar 2023 07:45:22 +0000 (13:15 +0530)]
[MLIR][Affine] Fix bug and MSAN issue in affine loop utils
Fix bug and MSAN issue in affine loop utils introduced by
d25e022cd19b83c22a6022edb78c4b97a5fc1b49 (D146495). While on it,
fix/clean up issues in immediately surrounding code.
Differential Revision: https://reviews.llvm.org/D146698
Matthias Springer [Thu, 23 Mar 2023 08:25:01 +0000 (09:25 +0100)]
[mlir][Analysis][NFC] Split FlatAffineValueConstraints into multiple classes
The new class hierarchy is as follows:
* `IntegerRelation` (no change)
* `IntegerPolyhedron` (no change)
* `FlatLinearConstraints`: provides an AffineExpr-based API
* `FlatLinearValueConstraints`: stores an additional mapping of non-local vars to SSA values
* `FlatAffineValueConstraints`: provides additional helper functions for Affine dialect ops
* `FlatAffineRelation` (no change)
`FlatConstraints` and `FlatValueConstraints` are moved from `MLIRAffineAnalysis` to `MLIRAnalysis` and can be used without depending on the Affine dialect.
This change is in preparation of D145681, which adds an MLIR interface that depends on `FlatConstraints` (and cannot depend on the Affine dialect or any other dialect).
Differential Revision: https://reviews.llvm.org/D146201
Carlos Galvez [Wed, 22 Mar 2023 18:47:48 +0000 (18:47 +0000)]
[clang-tidy] Ignore DISABLED_ in test suite name in google-avoid-underscore-in-googletest-name
Test suite name can also be disabled with DISABLED_, not just
the test case name.
Fix also broken link in the test that refers to the explanation
as to why underscores may not be used.
Differential Revision: https://reviews.llvm.org/D146655
Martin Braenne [Thu, 23 Mar 2023 07:45:40 +0000 (07:45 +0000)]
[clang][dataflow] Fix crash when RHS of `&&` or `||` calls `noreturn` func.
The crash happened because the transfer fucntion for `&&` and `||`
unconditionally tried to retrieve the value of the RHS. However, if the RHS
is unreachable, there is no environment for it, and trying to retrieve the
operand's value causes an assertion failure.
See also the comments in the code for further details.
Reviewed By: xazax.hun, ymandel, sgatev, gribozavr2
Differential Revision: https://reviews.llvm.org/D146514
Congcong Cai [Thu, 23 Mar 2023 07:40:55 +0000 (15:40 +0800)]
[NFC] Fix typo lld::wasm in comment
Tobias Gysi [Thu, 23 Mar 2023 07:13:54 +0000 (08:13 +0100)]
[mlir][llvm] Switch rountrip tests to opaque pointers.
The revision switches all remaining LLVM dialect roundtrip
tests to opaque pointers. Selected tests are copied to a
postfixed test file for the time being.
Part of https://discourse.llvm.org/t/rfc-switching-the-llvm-dialect-and-dialect-lowerings-to-opaque-pointers/68179
Reviewed By: zero9178
Differential Revision: https://reviews.llvm.org/D146639
Timm Bäder [Thu, 23 Mar 2023 07:22:23 +0000 (08:22 +0100)]
[clang][Sema][NFC] Make local variable const
Théo Degioanni [Thu, 23 Mar 2023 06:58:37 +0000 (07:58 +0100)]
[mlir][llvm] Add poison constant.
This patch introduces the poison constant from LLVM in the LLVM IR dialect. It also adds import and export support for it, along with roundtrip tests.
Reviewed By: gysit
Differential Revision: https://reviews.llvm.org/D146631