Noah Goldstein [Thu, 20 Apr 2023 19:51:10 +0000 (14:51 -0500)]
[LIBC] Implement remainder of posix 'sched.h' minus `SCHED_SPORADIC`
Includes macros:
linux/SCHED_OTHER // posix req
linux/SCHED_FIFO // posix req
linux/SCHED_RR // posix req
linux/SCHED_BATCH
linux/SCHED_ISO
linux/SCHED_IDLE
linux/SCHED_DEADLINE
Includes types:
struct sched_param { int sched_priority; }
Includes functions:
sched_setparam
sched_getparam
sched_setscheduler
sched_getscheduler
sched_get_priority_max
sched_get_priority_min
sched_rr_get_interval
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D148069
Noah Goldstein [Thu, 20 Apr 2023 19:50:00 +0000 (14:50 -0500)]
[LIBC] Fix incorrect handling of `pthread_join(tid, nullptr)`
Previously unconditionally stored to the return value. This is
incorrect, we should only return if user value is non-null.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D148293
Ramiro Leal-Cavazos [Thu, 20 Apr 2023 19:35:57 +0000 (12:35 -0700)]
Add pattern that expands `math.roundeven` into `math.round` + arith
This commit adds a pattern that expands `math.roundeven` into
`math.round` + some ops from `arith`. This is needed to be able to run
`math.roundeven` in a vectorized manner.
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D148285
Sam McCall [Thu, 20 Apr 2023 19:37:36 +0000 (21:37 +0200)]
[dataflow] Try to fix missing order dependency in HTMLLogger
LLVM GN Syncbot [Thu, 20 Apr 2023 19:24:12 +0000 (19:24 +0000)]
[gn build] Port
68c3d66a97a0
Roy Sundahl [Wed, 19 Apr 2023 16:32:05 +0000 (09:32 -0700)]
[fuzzer][test] Disable big-file-copy.test for everything but macOS
This test is heavy on test resources and involves moving a large 2GB+ file
across an ssh connection when testing on remote devices. Exclude all tests
except for macOS testing (on host). Remote device testing for macOS may
eventually cause a problem on macOS as well w/o better handling of tests
that require more resource/time than we currently handle.
Introduced by:
https://reviews.llvm.org/D146189
Subsequent exclusion of all but darwin by:
https://reviews.llvm.org/D147094
Subsequent exclusion of tvOS and watchOS by:
https://reviews.llvm.org/D147502
Subsequent exclusion of all but macOS...
rdar://
107570309
Reviewed By: yln, thetruestblue
Differential Revision: https://reviews.llvm.org/D148727
Mark de Wever [Tue, 21 Feb 2023 16:33:56 +0000 (17:33 +0100)]
[libc++][format] Improves width estimate.
As obvious from the paper's title this is an LWG issue and thus retroactively
applied to C++20. This change may the output for certain code points:
1 Considers 8477 extra codepoints as having a width 2 (as of Unicode 15)
(mostly Tangut Ideographs)
2 Change the width of 85 unassigned code points from 2 to 1
3 Change the width of 8 codepoints (in the range U+3248 CIRCLED NUMBER
TEN ON BLACK SQUARE ... U+324F CIRCLED NUMBER EIGHTY ON BLACK
SQUARE) from 2 to 1, because it seems questionable to make an exception
for those without input from Unicode
Note that libc++ already uses Unicode 15, while the Standard requires Unicode 12.
(The last time I checked MSVC STL used Unicode 14.)
So in practice the only notable change is item 3.
Implements
P2675 LWG3780: The Paper
format's width estimation is too approximate and not forward compatible
Benchmark before these changes
--------------------------------------------------------------------
Benchmark Time CPU Iterations
--------------------------------------------------------------------
BM_ascii_text<char> 3928 ns 3928 ns 178131
BM_unicode_text<char> 75231 ns 75230 ns 9158
BM_cyrillic_text<char> 59837 ns 59834 ns 11529
BM_japanese_text<char> 39842 ns 39832 ns 17501
BM_emoji_text<char> 3931 ns 3930 ns 177750
BM_ascii_text<wchar_t> 4024 ns 4024 ns 174190
BM_unicode_text<wchar_t> 63756 ns 63751 ns 11136
BM_cyrillic_text<wchar_t> 44639 ns 44638 ns 15597
BM_japanese_text<wchar_t> 34425 ns 34424 ns 20283
BM_emoji_text<wchar_t> 3937 ns 3937 ns 177684
Benchmark after these changes
--------------------------------------------------------------------
Benchmark Time CPU Iterations
--------------------------------------------------------------------
BM_ascii_text<char> 3914 ns 3913 ns 178814
BM_unicode_text<char> 70380 ns 70378 ns 9694
BM_cyrillic_text<char> 51889 ns 51877 ns 13488
BM_japanese_text<char> 41707 ns 41705 ns 16723
BM_emoji_text<char> 3908 ns 3907 ns 177912
BM_ascii_text<wchar_t> 3949 ns 3948 ns 177525
BM_unicode_text<wchar_t> 64591 ns 64587 ns 10649
BM_cyrillic_text<wchar_t> 44089 ns 44078 ns 15721
BM_japanese_text<wchar_t> 39369 ns 39367 ns 17779
BM_emoji_text<wchar_t> 3936 ns 3934 ns 177821
Benchmarks without "if(__code_point < (__entries[0] >> 14))"
--------------------------------------------------------------------
Benchmark Time CPU Iterations
--------------------------------------------------------------------
BM_ascii_text<char> 3922 ns 3922 ns 178587
BM_unicode_text<char> 94474 ns 94474 ns 7351
BM_cyrillic_text<char> 69202 ns 69200 ns 10157
BM_japanese_text<char> 42735 ns 42692 ns 16382
BM_emoji_text<char> 3920 ns 3919 ns 178704
BM_ascii_text<wchar_t> 3951 ns 3950 ns 177224
BM_unicode_text<wchar_t> 81003 ns 80988 ns 8668
BM_cyrillic_text<wchar_t> 57020 ns 57018 ns 12048
BM_japanese_text<wchar_t> 39695 ns 39687 ns 17582
BM_emoji_text<wchar_t> 3977 ns 3976 ns 176479
This optimization does carry its weight for the Unicode and Cyrillic
test. For the Japanese tests the gains are minor and for emoji it seems
to have no effect.
Reviewed By: ldionne, tahonermann, #libc
Differential Revision: https://reviews.llvm.org/D144499
Fangrui Song [Thu, 20 Apr 2023 19:17:26 +0000 (12:17 -0700)]
[ELF] Cap parallel::strategy to 16 threads when --threads= is unspecified
When --threads= is unspecified, we set it to
`parallel::strategy.compute_thread_count()`, which uses
sched_getaffinity (Linux)/cpuset_getaffinity (FreeBSD)/std::thread::hardware_concurrency (others).
With extensive testing on many machines (many configurations from
{aarch64,x86-64} x {Linux,FreeBSD,Windows} x allocators(native,mimalloc,rpmalloc) combinations)
with varying workloads, we discovered that when the concurrency is larger than
16, the linking process is slower than using --threads=16 due to parallelism
overhead outweighs optimizations. This is particularly harmful for machines with
many cores or when the link job competes with other jobs.
Cap parallel::strategy when --threads= is unspecified.
For some workloads changing the concurrency from 8 to 16 has nearly no improvement.
--thinlto-jobs= is unchanged since ThinLTO backend compiles are embarrassingly
parallel.
Link: https://discourse.llvm.org/t/avoidable-overhead-from-threading-by-default/69160
Reviewed By: peter.smith, andrewng
Differential Revision: https://reviews.llvm.org/D147493
Mark de Wever [Sun, 16 Apr 2023 10:16:36 +0000 (12:16 +0200)]
[libc++][doc] Update format status.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D148459
Teresa Johnson [Wed, 19 Apr 2023 21:51:10 +0000 (14:51 -0700)]
[ThinLTO] Remove BlockCount for non partial sample profile builds
As pointed out in
https://discourse.llvm.org/t/undeterministic-thin-index-file/69985, the
block count added to distributed ThinLTO index files breaks incremental
builds on ThinLTO - if any linked file has a different number of BBs,
then the accumulated sum placed in the index files will change, causing
all ThinLTO backend compiles to be redone.
The block count is only used for scaling of partial sample profiles, and
was added in D80403 for D79831.
This patch simply removes this field from the index files of non partial
sample profile compiles, which is NFC on the output of the compiler.
We subsequently need to see if this can be removed for partial sample
profiles without signficant performance loss, or redesigned in a way
that does not destroy caching.
Differential Revision: https://reviews.llvm.org/D148746
Alexander Yermolovich [Wed, 19 Apr 2023 23:38:08 +0000 (16:38 -0700)]
[dwarfdump][dwarf] Fix parsing of tu-index
Fixed issue where {tu,cu}-index fixup code for DWARF5 that would report an error when
fixup map is empty. Which is the case when seciton(s) are not over 4GB or
--manaully-generate-unit-index is not specified
Differential Revision: https://reviews.llvm.org/D148578
Nathan Sidwell [Wed, 19 Apr 2023 20:08:25 +0000 (16:08 -0400)]
[BOLT] Make BOLT_ENABLE_RUNTIME user-configurable
Defaults to ON for x86_64 && (Linux | Darwin).
If enabled, checks that /proc/self/map_files is readable. Some systems are configured so that getdents fails with EPERM.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D148742
Doru Bercea [Tue, 4 Apr 2023 19:12:08 +0000 (15:12 -0400)]
Fix failure with team-wide allocated variable
Review: https://reviews.llvm.org/D147572
Simon Pilgrim [Thu, 20 Apr 2023 18:38:40 +0000 (19:38 +0100)]
[CostModel][X86] Improve i8 and vXi8 MUL costs
We were treating vXi8 multiply as the sum of a trunc(mul(extend(),extend())) which diverged from the costs from llvm-mcaonce we extended beyond legal types
Use a modified version of the D103695 script to determine more accurate throughput/latency/codesize/size-latency cost estimates
Helps address some of the regressions identified in D148806
Dimitry Andric [Thu, 20 Apr 2023 17:43:37 +0000 (19:43 +0200)]
[compiler-rt] Include system headers before optionally defining HWCAP macros
In https://reviews.llvm.org/D141285 the optional definitions of `HWCAP`
macros were moved to before their usage. However, they were also moved
to before the inclusion of system headers which can optionally define
them. If any of those system headers then actually defined any of the
`HWCAP` macros, it would result in a redefinition error.
Move the system header includes to just before the optional definitions,
to avoid this problem.
Reviewed By: ilinpv
Differential Revision: https://reviews.llvm.org/D148819
Ben Langmuir [Wed, 12 Apr 2023 21:54:55 +0000 (14:54 -0700)]
[clang][modules] Avoid re-exporting PCH imports on every later module import
We only want to make PCH imports visible once for the the TU, not
repeatedly after every subsequent import. This causes some incorrect
behaviour with submodule visibility, and causes us to get extra module
dependencies in the scanner. So far I have only seen obviously incorrect
behaviour when building with -fmodule-name to cause a submodule to be
textually included when using the PCH, though the old behaviour seems
wrong regardless.
rdar://
107449644
Differential Revision: https://reviews.llvm.org/D148176
Nick Desaulniers [Thu, 20 Apr 2023 18:08:04 +0000 (11:08 -0700)]
Reland: [Demangle] replace use of llvm::StringView w/ std::string_view
This reverts commit
d81cdb49d74064e88843733e7da92db865943509.
This refactoring was waiting on converting LLVM to C++17.
Leave StringView.h and cleanup around for subsequent cleanup.
Additional fixes for missing std::string_view conversions for MSVC.
Reviewed By: MaskRay, DavidSpickett, ayzhao
Differential Revision: https://reviews.llvm.org/D148546
Robert Suderman [Thu, 20 Apr 2023 18:10:23 +0000 (18:10 +0000)]
[mlir] Expose Arith::ExpandOps options in constructor
ExpandOpsPass could only be configured via command line flags. Updated
to allowed constructing using the specified Options structure.
Reviewed By: NatashaKnk
Differential Revision: https://reviews.llvm.org/D148820
Jan Svoboda [Thu, 20 Apr 2023 18:03:02 +0000 (11:03 -0700)]
[clang][deps] Print timing information
This patch adds new `-print-timing` option to `clang-scan-deps`. It measures the wall and process time taken to scan dependencies for the compilation database. This provides more representative data compared to measuring the timing for the whole tool invocation, since that includes parsing and generating JSON files, which can be significant for larger inputs.
Reviewed By: akyrtzi
Differential Revision: https://reviews.llvm.org/D147815
Ramiro Leal-Cavazos [Thu, 20 Apr 2023 18:00:08 +0000 (18:00 +0000)]
Fix handling of special and large vals in expand pattern for `round`
The current expand pattern for `math.round` does not handle the
special values -0.0, +-inf, and +-nan correctly. It also does not
properly handle values with magnitude |x| >= 2^23. Lastly, the pattern
generates invalid IR when the input to `math.round` is a vector. This
patch fixes these issues.
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D148398
David Green [Thu, 20 Apr 2023 18:05:45 +0000 (19:05 +0100)]
[DAG] Retain nuw flags when reassociating adds
Given two adds that are both nuw, they will still be nuw after being
reassociated. (They only increase in value and at no point wrap).
https://alive2.llvm.org/ce/z/JrYM6H
Differential Revision: https://reviews.llvm.org/D148804
Valentin Clement [Thu, 20 Apr 2023 17:52:45 +0000 (10:52 -0700)]
[flang][openacc] Support array section with constant lb or ub for data operand
Add support for array section with constant lower or upper bound.
The current lowering will trigger a TODO when the array is assumed size
or if the lower or upper bound is a variable.
Depends on D148721
Reviewed By: razvanlupusoru, jeanPerier
Differential Revision: https://reviews.llvm.org/D148748
Dimitry Andric [Thu, 20 Apr 2023 14:12:10 +0000 (16:12 +0200)]
arm_bf16.td: fix copy/paste typo in comment header
Alex Bradbury [Thu, 20 Apr 2023 17:30:53 +0000 (18:30 +0100)]
[doc][RISCV] Add missed release note about vector crypto extension update
I meant to fold this into
cb7dffdc9a83f400410657431bda14e79f6e0176 but
failed to do so.
Eric Gouriou [Thu, 20 Apr 2023 17:24:34 +0000 (18:24 +0100)]
[RISCV] Zvk (vector crypto) specification update to 0.5.1 (Zvbb/Zvbc/Zvkt/Zvkng/Zvksg)
Update the Zvk support from 0.3.x to 0.5.1, tracking the extension as
documented in
<https://github.com/riscv/riscv-crypto/releases/download/v20230407/riscv-crypto-spec-vector.pdf>.
- Zvkb is split into Zvbb and Zvbc
- Zvbc (vector carryless multiply) requires 64 bit elements (Zve64x)
- Use the extension descriptions from the specification for Zvbb/Zvbc
- Zvkt is introduced (no instructions, but adds an attribute and macro)
- Zvkn and Zvks both imply Zvkt
- Zvkng and Zvksg are introduced, adding Zvkg (GMAC) to Zvkn and Zvks
- In Zvbb, add vrev.v, vclz.v, vctz.v, vcpop.v, vwsll.{vv,vx,vi}
Differential Revision: https://reviews.llvm.org/D148483
Zain Jaffal [Thu, 20 Apr 2023 17:20:01 +0000 (18:20 +0100)]
[AArch64] Improve fsh(l|r) cost modeling if 3rd arg is constant.
In that case, the cost for i32 and i64 should be 1 (a single EXTR
instruction). For v4i32 and v2i64 it should be 3 (USHR + SHL + ORR).
Other sizes smaller than 64 bits require an extra instruction for
conversion to i32/i64.
This recovers a SLP regression revealed by D140392.
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D147322
Nick Desaulniers [Thu, 20 Apr 2023 17:02:28 +0000 (10:02 -0700)]
[libcxxabi][demangle] create helper for std::string_view::starts_with
Add C++ 20 style starts_with to replace StringView::startsWith in
LLVMDemangle. Due to library layering (LLVMSupport depends on
LLVMDemangle), we add the utility header under llvm/Demangle, instead of
llvm/ADT or llvm/Support.
Modify this in libcxxabi, then copy this over to llvm.
Reviewed By: MaskRay, #libc_abi, phosek
Differential Revision: https://reviews.llvm.org/D148556
Craig Topper [Thu, 20 Apr 2023 16:57:18 +0000 (09:57 -0700)]
[RISCV] Add an option to emit the Tag_RISCV_arch attribute based on the assembler's subtarget
This adds an option to emit the command line -mattr/-march into the
attributes of an object file. This can be useful to get objdump to
disassemble instructions that aren't in the base without forcing
users to add a .attribute to the assembly file.
The binutils assembler does this by default.
Similar option exists for ARM. I will wire it to a clang option in
another patch. Similar to https://reviews.llvm.org/D31813
Reviewed By: asb, kito-cheng
Differential Revision: https://reviews.llvm.org/D148782
Craig Topper [Thu, 20 Apr 2023 16:56:08 +0000 (09:56 -0700)]
[TableGen] Remove BitsRecTy::typeIsA override. NFC
BitsRecTy objects are uniqued based on size. If the sizes are equal, then
the BitsRecTy objects are the same objects. We can use the base class
implementation that checks for pointer equality.
AdityaK [Tue, 11 Apr 2023 22:11:25 +0000 (15:11 -0700)]
Instructions to run libc++ test suite
Reviewers: ldionne, philnik, EricWF
Reviewed By: EricWF
Differential Revision: https://reviews.llvm.org/D147751
David Green [Thu, 20 Apr 2023 16:51:54 +0000 (17:51 +0100)]
[AArch64] Additional hadd/rhadd tests. NFC
See D148809
Fangrui Song [Thu, 20 Apr 2023 16:49:22 +0000 (09:49 -0700)]
Revert D147493 "[ELF] Cap parallel::strategy to 16 threads when --threads= is unspecified"
This reverts commit
da68d2164efcc1f5e57f090e2ae2219056b120a0.
This change is correct, but left a `config->threadCount` use that is error-prone
and may harm performance when parallel::strategy.compute_thread_count() > 16.
Mikhail R. Gadelha [Thu, 20 Apr 2023 16:43:46 +0000 (13:43 -0300)]
[libc] Zero initialize Uint<T>::val
This fix a regression introduced by commit
5db12eca1f70bb9c2dab33ff88dcccdfba75af6e
Fixes the compilation failure reported by libc-x86_64-debian-gcc-fullbuild-dbg:
.../libc/src/__support/UInt.h:26:31: note: ‘struct __llvm_libc::cpp::UInt<192>’ has no user-provided default constructor
26 | template <size_t Bits> struct UInt {
| ^~~~
.../libc/src/__support/UInt.h:38:13: note: constructor is not user-provided because it is explicitly defaulted in the class body
38 | constexpr UInt() = default;
Mahesh Ravishankar [Thu, 20 Apr 2023 16:30:14 +0000 (16:30 +0000)]
[mlir] Add a utility function to make a region isolated from above.
The utility functions takes a region and makes it isolated from above
by appending to the entry block arguments that represent the captured
values and replacing all uses of the captured values within the region
with the newly added arguments. The captures values are returned.
The utility function also takes an optional callback that allows
cloning operations that define the captured values into the region
during the process of making it isolated from above. The cloned value
is no longer a captured values. The operands of the operation are then
captured values. This is done transitively allow cloning of a DAG of
operations into the region based on the callback.
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D148684
Alexey Bataev [Wed, 19 Apr 2023 20:04:12 +0000 (13:04 -0700)]
[SLP][X86]Fix the cost of reused gathers/buildvectors and floats insert.
There are 2 problems in the cost estimation for buildvector/gather.
1. If the buildvector/gather node is the same as another one node, need
to estimate the cost of this node as 0.
2. The cost of inserting float point register to non-poison vector is
not 0, it should not be considered free.
Differential Revision: https://reviews.llvm.org/D148801
Fangrui Song [Thu, 20 Apr 2023 16:34:34 +0000 (09:34 -0700)]
[Sema] -Wformat: recognize %lb for the printf/scanf family of functions
Fix https://github.com/llvm/llvm-project/issues/62247
D131057 added `bArg` and `BArg` in the `AsLongLong` label in
`FormatSpecifier::hasValidLengthModifier`, but missed the `AsLong` label,
therefore `%llb` is allowed while `%lb` (e.g. `printf("%lb", (long)10)`) has a
spurious warning. Add the missing case labels.
Reviewed By: aaron.ballman, enh
Differential Revision: https://reviews.llvm.org/D148779
Saleem Abdulrasool [Thu, 20 Apr 2023 15:56:15 +0000 (08:56 -0700)]
Headers: use C++ inline semantics in C++ mode
When building with the 17.5.0 preview toolset for MSVC and building with
modules, the definition of _addcarry_u64 and _subborrow_u64 seem to
cause issues due to the use of GNU inline semantics. Change the headers
to prefer C++ inline semantics for C++ compilation, falling back to GNU
inlining semantics for C compilation.
This is motivated by https://github.com/microsoft/STL/issues/2520.
Differential Revision: https://reviews.llvm.org/D139749
Reviewed By: fsb4000
Mikhail R. Gadelha [Thu, 20 Apr 2023 16:00:04 +0000 (13:00 -0300)]
[libc] Make UInt<T> trivially copyable
This patch defaults the copy constructor and copy operator so it can be
used with __builtin_bit_cast
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D148794
Florian Hahn [Thu, 20 Apr 2023 15:39:04 +0000 (16:39 +0100)]
[AArch64] Add extra fshr tests with large types.
Extra tests discussed in D147322.
Florian Hahn [Thu, 20 Apr 2023 15:34:59 +0000 (16:34 +0100)]
[AArch64] Add extra fshl tests with large types.
Extra tests discussed in D147322.
Nikita Popov [Thu, 13 Apr 2023 14:39:42 +0000 (16:39 +0200)]
[Coroutines] Convert tests to opaque pointers (NFC)
Tom Stellard [Thu, 20 Apr 2023 15:21:51 +0000 (08:21 -0700)]
workflows/release-binaries: Install missing dependencies
Reviewed By: thieta
Differential Revision: https://reviews.llvm.org/D148772
Tom Stellard [Thu, 20 Apr 2023 15:15:49 +0000 (08:15 -0700)]
workflows/release-tasks: Always run apt-get update before installing deps
There is a bug in the package tree of on the default images that
causes some dependencies not to be found. Running apt-get gets us
the latest package lists rather than relying on the default lists
in the GitHub Runner imgae, which can be up to a week old.
Running apt-get update before intstalling packages is also recommended in
the official github documentation:
https://docs.github.com/en/actions/using-github-hosted-runners/customizing-github-hosted-runners#installing-software-on-ubuntu-runners
Reviewed By: thieta
Differential Revision: https://reviews.llvm.org/D148741
Florian Hahn [Thu, 20 Apr 2023 15:14:06 +0000 (16:14 +0100)]
[ConstraintElim] Fix integer overflow in getConstraint.
Use SubOverflow to avoid signed integer overflow when combining
coefficients.
Fixes #62226.
Momchil Velikov [Thu, 20 Apr 2023 15:07:51 +0000 (16:07 +0100)]
Revert "[AArch64] Fix incorrect `isLegalAddressingMode`"
This reverts commit
0827e2fa3fd15b49fd2d0fc676753f11abb60cab.
Failing buildbot, perhaps due to `-std=c++20`.
Zarko Todorovski [Thu, 20 Apr 2023 14:00:52 +0000 (10:00 -0400)]
[Clang][AIX] Remove error for -fprofile-instr-generate/use on AIX
Instrumented profiling now works on AIX and there is no dependency
on LTO for PGO. Remove the error.
Reviewed By: qiongsiwu1
Differential Revision: https://reviews.llvm.org/D148177
Arjun P [Thu, 20 Apr 2023 14:55:21 +0000 (15:55 +0100)]
Revert "[mlir][irdl] Add IRDL registration"
This reverts commit
e0d884de360b5c3fe79c6a53f8f88b57f0e42275.
Reverting due to buildbot failure.
Kristof Beyls [Mon, 17 Apr 2023 09:19:26 +0000 (11:19 +0200)]
[AArch64] Make stack tagging compatible with SLH
See https://github.com/llvm/llvm-project/issues/61830
Speculative Load Hardening (SLH) requires that conditional branches are
implemented using B.cc branches, not using {TC}B{N}Z branches.
Stack tagging was expanding one of the pseudo instructions it uses to
cbnz. This commit changes that to use b.ne instead.
Note that the added regression test was added to settag.ll rather than
speculation-hardening.ll. The speculation-hardening.ll tests also check
that all tests in the file work with global-isel. It seems that stack
tagging does not work yet with global-isel. Therefore, testing the
combination of stack tagging and SLH hard to be added to a test file
that doesn't test global-isel, i.e. settag.ll
Differential Revision: https://reviews.llvm.org/D148508
Momchil Velikov [Thu, 20 Apr 2023 13:51:47 +0000 (14:51 +0100)]
[AArch64] Fix incorrect `isLegalAddressingMode`
`AArch64TargetLowering::isLegalAddressingMode` has a number of
defects, including accepting an addressing mode which consists of only
an immediate operand, or not checking the offset range for an
addressing mode in the form `1*ScaledReg + Offs`.
This patch fixes the above issues.
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D143895
Change-Id: I756fa21941844ded44f082ac7eea4391219f9851
Mathieu Fehr [Thu, 20 Apr 2023 14:33:00 +0000 (15:33 +0100)]
[mlir][irdl] Add IRDL registration
This patch add support for loading IRDL dialects at runtime
with `mlir-opt`.
Given the following `dialect.irdl` file:
```mlir
module {
irdl.dialect @cmath {
irdl.type @complex {
%0 = irdl.is f32
%1 = irdl.is f64
%2 = irdl.any_of(%0, %1)
irdl.parameters(%2)
}
irdl.operation @norm {
%0 = irdl.any
%1 = irdl.parametric @complex<%0>
irdl.operands(%1)
irdl.results(%0)
}
}
```
the IRDL file can be loaded with the `mlir-opt --irdl-file=dialect.irdl`
command, and the following file can then be parsed:
```mlir
func.func @conorm(%p: !cmath.complex<f32>, %q: !cmath.complex<f32>) -> f32 {
%norm_p = "cmath.norm"(%p) : (!cmath.complex<f32>) -> f32
%norm_q = "cmath.norm"(%q) : (!cmath.complex<f32>) -> f32
%pq = arith.mulf %norm_p, %norm_q : f32
return %pq : f32
}
```
To minimize the size of this patch, the operation, attribute, and type verifier are all always returning `success()`.
Depends on D144692
Reviewed By: rriddle, Mogball, mehdi_amini
Differential Revision: https://reviews.llvm.org/D144693
Jay Foad [Thu, 20 Apr 2023 14:03:47 +0000 (15:03 +0100)]
[ConstantFolding] Fix crash when folding vector llvm.is.fpclass
Differential Revision: https://reviews.llvm.org/D148803
LLVM GN Syncbot [Thu, 20 Apr 2023 14:25:08 +0000 (14:25 +0000)]
[gn build] Port
4bc6499f8843
Aaron Ballman [Thu, 20 Apr 2023 14:20:54 +0000 (10:20 -0400)]
[C11] Allow casting to an _Atomic-qualified type
We were failing to strip off atomic qualification when forming the cast
destination type, but properly stripping off cvr qualification. Now we
accept atomic, qualified, or unqualified destination types.
Note: the semantics of the cast still drop the qualifier, so such a
cast does not result in an atomic rvalue.
Fixes https://github.com/llvm/llvm-project/issues/39596
Matt Arsenault [Thu, 20 Apr 2023 12:00:02 +0000 (08:00 -0400)]
AMDGPU: Fix assertion with multiple uses of f64 fneg of select
A bitcast needs to be inserted back to the original type. Just
skip the multiple use case for a safer quick fix. Handling
the multiple use case seems to be beneficial in some but not
all cases.
OCHyams [Thu, 20 Apr 2023 13:51:58 +0000 (14:51 +0100)]
Reapply D146987 "[Assignment Tracking] Enable by default"
See https://discourse.llvm.org/t/rfc-enable-assignment-tracking/69399
This sets the -Xclang -fexperimental-assignment-tracking flag to the value
enabled which means it will be enabled so long as none of the following are
true: it's an LTO build, LLDB debugger tuning has been specified, or it's an O0
build (no work is done in any case if -g is not specified or -gmlt is used).
This reverts commit
a65ca4546b9ee042d6c40149d3f820893edbd766 which reverts
https://reviews.llvm.org/D146987
Nikolas Klauser [Sun, 16 Apr 2023 15:22:02 +0000 (17:22 +0200)]
[libc++][NFC] Remove one apply_cv implementation
Reviewed By: #libc, ldionne
Spies: arichardson, libcxx-commits
Differential Revision: https://reviews.llvm.org/D148468
zhangyi1357 [Thu, 20 Apr 2023 10:13:44 +0000 (12:13 +0200)]
[Clangd] Make the type hint length limit configurable
This commit is about clangd's type name hint length limit. The past behavior was 32 characters fixed limit. It is now configurable.
Projects can now add the following config fragment to their .clangd:
```
InlayHints:
TypeNameLimit: 34
```
Ref: [[ https://github.com/clangd/clangd/issues/1357 | Make the type hint length limit configurable ]]
Reviewed By: hokein
Differential Revision: https://reviews.llvm.org/D147395
OCHyams [Thu, 20 Apr 2023 12:51:06 +0000 (13:51 +0100)]
[NFC] Return unique dbg intrinsics from findDbgValues and findDbgUsers
The out-param vector from findDbgValues and findDbgUsers should not include
duplicates, which is possible if the debug intrinsic uses the value multiple
times. This filter is already in place for multiple uses in a `DIArgLists`;
extend it to cover dbg.assigns too because a Value may be used in both the
address and value components.
Additionally, refactor the duplicated functionality between findDbgValues and
FindDbgUsers into a new function findDbgIntrinsics.
Reviewed By: jmorse, StephenTozer
Differential Revision: https://reviews.llvm.org/D148788
Nikita Popov [Thu, 20 Apr 2023 12:33:06 +0000 (14:33 +0200)]
[LangRef] Update list of supported constant expressions (NFC)
For binary ops explicitly list all supported ops, as it's no
longer all of them.
Nikita Popov [Thu, 20 Apr 2023 12:20:43 +0000 (14:20 +0200)]
Revert "[ORC][LLJIT] Use JITLink by default on ELF/x86-64."
This reverts commit
85c649bc02a6605f541b09b33a200a78275ed90f.
Has been causing test failures in OrcV2Examples for the past few
days.
Nikita Popov [Wed, 22 Mar 2023 10:53:01 +0000 (11:53 +0100)]
Reapply [SimplifyCFG][LICM] Preserve nonnull, range and align metadata when speculating
This exposed another miscompile in GVN, which was fixed by
20e9b31f88149a1d5ef78c0be50051e345098e41.
-----
After D141386, violation of nonnull, range and align metadata
results in poison rather than immediate undefined behavior,
which means that these are now safe to retain when speculating.
We only need to remove UB-implying metadata like noundef.
This is done by adding a dropUBImplyingAttrsAndMetadata() helper,
which lists the metadata which is known safe to retain on speculation.
Differential Revision: https://reviews.llvm.org/D146629
Andrew Gozillon [Thu, 20 Apr 2023 12:05:17 +0000 (07:05 -0500)]
[Flang][MLIR] Alter Fir.GlobalOp to print and lower external attributes
Fir.GlobalOp's currently do not respect attributes that
are applied to them, this change will do two things:
- Allow lowering of arbitrary attributes applied to
Fir.GlobalOp's to LLVMGlobalOp's during CodeGen
- Allow printing and parsing of arbitrarily applied attributes
This allows applying other dialects attributes (or other
fir attributes) to fir.GlobalOps on the fly and have them
exist in the resulting LLVM dialect IR or FIR IR.
Reviewer: jeanPerier
Differential Revision: https://reviews.llvm.org/D148352
Aaron Ballman [Thu, 20 Apr 2023 12:01:23 +0000 (08:01 -0400)]
[C11] Allow initialization of an atomic-qualified pointer from a null pointer constant
The relevant language rule from C11 is 6.5.16.1p1: "the left operand is
an atomic, qualified, or unqualified pointer, and the right is a null
pointer constant; or". We correctly handled qualified or unqualified
pointer types, but failed to handle atomic-qualified pointer types. Now
we look through the atomic qualification before testing the constraint
requirements.
Fixes https://github.com/llvm/llvm-project/issues/49563
Differential Revision: https://reviews.llvm.org/D148730
Louis Dionne [Wed, 19 Apr 2023 19:56:06 +0000 (15:56 -0400)]
[libc++] Adjust D_LIBCPP_ENABLE_ASSERTIONS defines in exception_guard tests
For the assert.FOO.pass.cpp test, we should be passing _LIBCPP_ENABLE_ASSERTIONS=1
for consistency, even though -D_LIBCPP_ENABLE_ASSERTIONS is equivalent.
For the other test, we shouldn't be forcing assertions to be enabled,
since we already have a CI job that enables assertions by default and
will do the right thing.
Differential Revision: https://reviews.llvm.org/D148736
Guillaume Chatelet [Thu, 20 Apr 2023 11:35:43 +0000 (11:35 +0000)]
[libc] use -O3 to compile memory functions
Tobias Gysi [Thu, 20 Apr 2023 11:27:33 +0000 (11:27 +0000)]
[mlir][llvm] Improve access group import handling.
In particular, do not drop all access groups of a loop annotation
if one of them is unused. This change makes the access group import
robust against stale access group references in loop metadata.
Reviewed By: Dinistro
Differential Revision: https://reviews.llvm.org/D148791
Owen Pan [Thu, 20 Apr 2023 03:10:00 +0000 (20:10 -0700)]
[clang-format] Hanlde leading whitespaces for JSON files
Fixes #62228.
Fixes #62229.
Differential Revision: https://reviews.llvm.org/D148777
Momchil Velikov [Thu, 20 Apr 2023 10:51:23 +0000 (11:51 +0100)]
[FuncSpec] Relax restrictions on candidates for specialisation
Allow a function to be specialised even if it has its address taken or
it's global. For such functions, consider all of the arguments as
overdefined. Don't delete the functions even if all the apparent calls
were redirected to specialised instances.
Reviewed By: labrinea, ChuanqiXu
Differential Revision: https://reviews.llvm.org/D148345
Matt Arsenault [Sun, 8 Jan 2023 17:05:27 +0000 (12:05 -0500)]
AMDGPU: Really invert handling of enqueued block detection
Remove the broken call graph analysis in the block enqueue lowering
pass. The previous iteration was reverted due to a runtime bug when
the completion action was unconditionally enabled.
Nikita Popov [Thu, 20 Apr 2023 10:23:36 +0000 (12:23 +0200)]
[GVN] Fix metadata combining for non-local loads
Make MaterializeAdjustedValue() responsible for adjusting load
metadata in all cases, so it also covers the non-local case.
In conjunction with that, we no longer need to call
patchReplacementInstruction() for the local case, which would
unnecessarily drop metadata if the replacement value just happened
to be a load (without actual load CSE).
Timm Bäder [Wed, 19 Apr 2023 07:59:03 +0000 (09:59 +0200)]
[clang][Sema][NFC] Make a bunch of things const if possible
And some general code style cleanup.
Differential Revision: https://reviews.llvm.org/D148696
Jay Foad [Thu, 20 Apr 2023 10:17:24 +0000 (11:17 +0100)]
[IR] Remove dead code for unsupported ConstantExpr binops
Nikita Popov [Thu, 20 Apr 2023 10:17:31 +0000 (12:17 +0200)]
[GVN] Add additional metadata combining tests (NFC)
Timm Bäder [Wed, 19 Apr 2023 11:24:48 +0000 (13:24 +0200)]
[clang][Lex][NFC] Use a range for loop in StringLiteralParser
Simon Pilgrim [Thu, 20 Apr 2023 09:35:51 +0000 (10:35 +0100)]
[DAG] SimplifyVCastOp - ensure we select the correct value type from an SDValue operand
As reported on Issue #62234 - we weren't correctly using the SDValue operand to get its value type, resulting in a failure when it came from a SDNode with multiple results
We haven't been able to create a suitable upstream regression test, but its been confirmed by inspection by both myself and @topperc
Fixes #62234
Timm Bäder [Wed, 19 Apr 2023 12:38:36 +0000 (14:38 +0200)]
[clang][Sema][NFC] Use existing TargetInfo local variable
David Sherwood [Wed, 5 Apr 2023 12:58:03 +0000 (12:58 +0000)]
[AArch64][CostModel] Make sext/zext free if folded into a masked load
The BasicTTIImpl implementation of getCastInstrCost ensures
that the cost of zext/sext is 0 when following a load if we
know the combined extending load is legal. For SVE we can do
the same for masked loads too, since they use exactly the
same underlying instruction.
Differential Revision: https://reviews.llvm.org/D148123
Matthias Springer [Thu, 20 Apr 2023 08:30:04 +0000 (17:30 +0900)]
[mlir][linalg][transform] PackGreedilyOp/TileToForallOp: Store payload ops in SmallVector
The TrackingListener removes ops from the internal transform dialect state when they are erased. At the same time, the `apply` interface method is iterating over all payload ops. Elements may not be removed from the state while iterating over the state.
Differential Revision: https://reviews.llvm.org/D148771
David Spickett [Wed, 19 Apr 2023 13:20:06 +0000 (13:20 +0000)]
[LLDB] Discard register flags where the size doesn't match the register
In the particular case I was looking at I autogenerated a 128 bit set
of flags that is only 64 bit. This doesn't crash lldb but it was certainly
not expected.
I suspect that we would have crashed if the top 64 bits weren't
marked as unused (or at least invoked some very undefined behaviour).
When this happens, log the details and ignore the flags. Like this:
```
Size of register flags TTBR0_EL1_flags (16 bytes) for register TTBR0_EL1 does not match the register size (8 bytes). Ignoring this set of flags.
```
Turns out a few of the tests relied on this bug so I have updated
them and added a specific test for this case.
Reviewed By: jasonmolenda
Differential Revision: https://reviews.llvm.org/D148715
Florian Hahn [Thu, 20 Apr 2023 08:31:16 +0000 (09:31 +0100)]
Recommit "[VPlan] Switch to checking sinking legality for recurrences in VPlan."
This reverts the revert commit
3d8ed8b5192a59104bfbd5bf7ac84d035ee0a4a5.
The new version of the patch adds a set to avoid duplicating work in
isFixedOrderRecurrence, which was previously done through the removed
SinkAfter map.
Original commit message:
Building on D142885 and D142589, retire the SinkAfter map from the
recurrence handling code. It is replaced by checking whether it is
possible to sink all users of a recurrence directly in VPlan. This
results in simpler code overall and allows to handle additional cases
(see the improvements in @test_crash).
Depends on D142885.
Depends on D142589.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D142886
Martin Dinkov [Tue, 8 Nov 2022 14:15:38 +0000 (09:15 -0500)]
[MsgPack] Add support for writing binary ELF doc nodes
Will be used for a front-end compiler
https://github.com/GPUOpen-Drivers/llpc
to insert a binary blob value into AMDGPU PAL metadata.
Differential Revision: https://reviews.llvm.org/D148607
Change-Id: I90685883d1478335937218e6b1a569b1b26dc05a
Craig Topper [Thu, 20 Apr 2023 07:20:19 +0000 (00:20 -0700)]
[RISCV] Remove VConstraintType enum and getConstraint. NFC
Fold the 3 flag defines into the enum that defines TSFlags. Then
we don't have to extract them we can just test the bits directly
in TSFlags.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D148765
Craig Topper [Thu, 20 Apr 2023 07:19:24 +0000 (00:19 -0700)]
[RISCV] Let assembler accept vector memory operands that have an explicit 0 offset.
Binutils allows vector instructions with memory operands that
have an explicit 0 offset like 'vle8.v v0, 0(a0)'.
We already have support for this in the parser because the same
thing is allowed for atomics.
This patch changes the AsmOperand and AsmString for the vector
memory instructions to allow this.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D148733
Viktoriia Bakalova [Fri, 31 Mar 2023 14:28:57 +0000 (14:28 +0000)]
[clangd] Implement cross reference request for #include lines.
Differential Revision: https://reviews.llvm.org/D147044
Haojian Wu [Thu, 20 Apr 2023 07:02:29 +0000 (09:02 +0200)]
[bazel] Fix the bazel build for the "analysis" target for
a443b3d18ef4.
A followup of the fix
46f5aaa82ca6fe2a307504444754ac535fb4760d
Kavitha Natarajan [Thu, 20 Apr 2023 05:48:26 +0000 (11:18 +0530)]
[Flang][OpenMP] Add support for OpenMP MIN reduction
This patch adds support for reduction of min-intrinsic for scalar
types. Min is lowered as a compare-select in the default lowering
flow for Flang. This pattern is matched and replaced with the
OpenMP dialect reduction operation.
Note: This is a temporary flow. The plan is to move to a flow
where the OpenMP reduction operation is inserted during lowering.
Jun Sha (Joshua) [Thu, 20 Apr 2023 05:46:34 +0000 (13:46 +0800)]
[RISCV] Add scheduling for Zfa instructions
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D148686
Tue Ly [Thu, 20 Apr 2023 05:03:41 +0000 (01:03 -0400)]
[libc][math] Remove placeholder implementations of asin and pow.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D148781
Pravin Jagtap [Thu, 20 Apr 2023 04:27:47 +0000 (00:27 -0400)]
[NewPM][AMDGPU] Port amdgpu-atomic-optimizer
Reviewed By: arsenm, sameerds, gandhi21299
Differential Revision: https://reviews.llvm.org/D148628
Mehdi Amini [Thu, 20 Apr 2023 04:12:46 +0000 (22:12 -0600)]
[mlir][doc] Fix build after D148389
The doc aren't part of the usual build, so this got unnoticed.
In
c184dcb458 a dependency was added from the OpenACC on the LLVM
and Memref dialects, to generate the dialect doc we need to explicitly
ask for the `acc` dialect now.
Akshay Khadse [Thu, 20 Apr 2023 02:03:36 +0000 (10:03 +0800)]
Fix uninitialized class members
Reviewed By: LuoYuanke
Differential Revision: https://reviews.llvm.org/D148692
Shengchen Kan [Thu, 20 Apr 2023 03:07:18 +0000 (11:07 +0800)]
[X86][Tablgen] Rename IgnoresVEX_W to IgnoresW, VEX_WIG to WIG, NFCI
We no longer distinguish REX.W from VEX.W in .td.
Peter Rong [Mon, 17 Apr 2023 20:57:29 +0000 (13:57 -0700)]
[FuzzMutate] InsertFunctionStrategy
InsertFunctionStrategy does two things:
1. Add a random function declaration or definition to the module. This would replace previously used `createEmptyFunction`.
2. Add a random function call between instructions.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D148568
Petr Hosek [Wed, 19 Apr 2023 23:55:20 +0000 (23:55 +0000)]
[Driver] Support response file on baremetal driver
All officially supported linkers should support response files and
this avoids issues when compiling on platforms such as Windows.
Differential Revision: https://reviews.llvm.org/D148760
Petr Hosek [Thu, 20 Apr 2023 00:03:30 +0000 (00:03 +0000)]
[Driver] Support response file in Fuchsia driver
All officially supported linkers should support response files and
this avoids issues when compiling on platforms such as Windows.
Differential Revision: https://reviews.llvm.org/D148763
Xiang1 Zhang [Tue, 11 Apr 2023 06:57:01 +0000 (14:57 +0800)]
[X86] combineConcatVectorOps - remove FADD/FSUB/FMUL handling
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D147996
Jun Sha (Joshua) [Thu, 20 Apr 2023 02:32:24 +0000 (10:32 +0800)]
[RISCV] Remove 'sx' when parsing arch string to match the latest ISA manual
In order to match the latest ISA manual, we need to remove sx prefix.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D148617
Jun Sha (Joshua) [Thu, 20 Apr 2023 02:27:02 +0000 (10:27 +0800)]
Revert '[RISCV] Remove 'sx' when parsing arch string to match the latest ISA manual'
This reverts commit
fbc63e5658f67036d4ea57940459074d9ecdd2d8
Matthias Springer [Thu, 20 Apr 2023 02:02:05 +0000 (11:02 +0900)]
[mlir][Affine][NFC] Wrap dialect in "affine" namespace
This cleanup aligns the affine dialect with all the other dialects.
Differential Revision: https://reviews.llvm.org/D148687
Jun Sha (Joshua) [Thu, 20 Apr 2023 02:19:14 +0000 (10:19 +0800)]
[RISCV] Remove 'sx' when parsing arch string to match the latest ISA manual