Razvan Lupusoru [Wed, 7 Jun 2023 21:40:20 +0000 (14:40 -0700)]
[llvm][openacc] Fix OpenACC frontend test
After D152389, single reduction clause constraint was removed.
This broke the OpenACC frontend test which seems to rely on specific
allowed clause ordering.
Reviewed By: vzakhari
Differential Revision: https://reviews.llvm.org/D152398
usama hameed [Wed, 7 Jun 2023 21:29:53 +0000 (14:29 -0700)]
[Sanitizers] UUID/Build ID is 16 bytes on Darwin.
https://reviews.llvm.org/D114294 changed the kModuleUUIDSize from 16 to 32 for
all platforms. This is not true for Darwin where the UUID is 16 bytes.
Differential Revision: https://reviews.llvm.org/D152309
rdar://
110346025
Owen Pan [Tue, 6 Jun 2023 19:58:21 +0000 (12:58 -0700)]
[clang-format] Add the KeepEmptyLinesAtEOF option
Adds an option KeepEmptyLinesAtEOF to keep empty lines (up to
MaxEmptyLinesToKeep) before EOF. This remedies the probably unintentional
change in behavior introduced in
3d3ea84a4f8f, which started to always
remove empty lines before EOF.
Fixes #56054.
Fixes #63150.
Differential Revision: https://reviews.llvm.org/D152305
David Green [Wed, 7 Jun 2023 20:53:30 +0000 (21:53 +0100)]
[AArch64][SVE] Predicated mul pattern
This is a simple predicated mul pattern, selecting from
select(p, mul(x, y), x).
Differential Revision: https://reviews.llvm.org/D149968
Razvan Lupusoru [Wed, 7 Jun 2023 18:13:44 +0000 (11:13 -0700)]
[flang][openacc] Lower reduction for compute constructs
Parallel and serial constructs support reduction clause. Extend
recent D151564 loop reduction clause support to also include these
compute constructs.
Reviewed By: clementval, vzakhari
Differential Revision: https://reviews.llvm.org/D151955
Razvan Lupusoru [Wed, 7 Jun 2023 18:05:40 +0000 (11:05 -0700)]
[flang][openacc] Remove single reduction clause limitation
The constraint that a single reduction clause is allowed is actually
not valid as per OpenACC specification. Multiple reduction clauses
are allowed, especially since reduction clauses can have different
reduction operators.
Reviewed By: vzakhari
Differential Revision: https://reviews.llvm.org/D152389
LLVM GN Syncbot [Wed, 7 Jun 2023 20:34:06 +0000 (20:34 +0000)]
[gn build] Port
7949ee0d4f10
Nikolas Klauser [Wed, 7 Jun 2023 20:33:02 +0000 (13:33 -0700)]
[libc++] Introduce __is_pointer_in_range
This checks whether a pointer is within a range, even during constant evaluation. This allows running optimized code paths during constant evaluation, instead of falling back to the general-purpose implementation all the time. This is also a central place for comparing unrelated pointers, which is technically UB.
Reviewed By: ldionne, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D143327
Jay Foad [Tue, 16 May 2023 16:07:44 +0000 (17:07 +0100)]
[AMDGPU] Switch to backwards scavenging in eliminateFrameIndex
Frame index elimination runs backwards so we must use backwards
scavenging. Otherwise, when a scavenged register is spilled, the
scavenger will remember that the register is in use until the restore
point, but it will never reach that restore point. The result is that in
some cases it will keep scavenging different registers instead of
reusing the same one.
Differential Revision: https://reviews.llvm.org/D152394
Craig Topper [Wed, 7 Jun 2023 19:48:43 +0000 (12:48 -0700)]
[RISCV] Change riscv_vid_vl isel pattern to use _MASK instruction.
The post isel peephole can convert it to the unmasked form.
We don't have any way to test the masked version right now because
we always use a true mask.
This makes the isel pattern consistent with many other instructions
that select the mask form.
Florian Hahn [Wed, 7 Jun 2023 19:45:07 +0000 (20:45 +0100)]
[Matrix] Convert binop operand of dot product to a row vector.
The dot product lowering will use the left operand as row vector.
If the operand is a binary op, convert it to operate on a row vector
instead of a column vector.
Depends on D148428.
Reviewed By: thegameg
Differential Revision: https://reviews.llvm.org/D148429
Corentin Jabot [Sun, 4 Jun 2023 15:12:30 +0000 (17:12 +0200)]
[Clang] Check for abstract parameters only when functions are defined.
The C++ standard allows abstract parameters in deleted functions
and in function declarations
> The type of a parameter or the return type for a function definition
> shall not be a (possibly cv-qualified) class type that is
> incomplete or abstract within the function body
> unless the function is deleted.
Fixes https://github.com/llvm/llvm-project/issues/63012
Reviewed By: #clang-language-wg, aaron.ballman
Differential Revision: https://reviews.llvm.org/D152096
Andrew Gozillon [Wed, 7 Jun 2023 19:27:42 +0000 (14:27 -0500)]
[Clang][OpenMP] Rework recently moved getTargetEntryUniqueInfo to fix incorrect error breaking sanitizer
This move was done by https://reviews.llvm.org/rGcda46cc4f921f6b288c57a68b901ec2f57134606 and may be the issue causing the sanitizer to fail. But in either case, it is an invalid assert that required some changes to function correctly.
Mark de Wever [Wed, 7 Jun 2023 19:24:05 +0000 (21:24 +0200)]
[compiler-rt] Fixes Chromium Apple CI.
s/add_asm_sources/set/ at one place it was forgotten in D152102 as
reported by @paulkirth.
Ellis Hoag [Wed, 7 Jun 2023 18:00:57 +0000 (11:00 -0700)]
[InstrProf] Fix BalancedPartitioning when threads are disabled
In https://reviews.llvm.org/D147812 we introduced the class
`BalancedPartitioning` which includes some threading code. The tests in
that diff run forever when built with `-DLLVM_ENABLE_THREADS=OFF` so
some bots were broken.
These tests were skipped in
https://reviews.llvm.org/rGa4845eaf2e9aa18dd900d7cbeff4e5ff52e4b50e
because of this.
This diff disables the threading code if `LLVM_ENABLE_THREADS` is
disabled so we can re-enable the tests.
Reviewed By: luporl
Differential Revision: https://reviews.llvm.org/D152390
Matt Arsenault [Wed, 7 Jun 2023 18:27:53 +0000 (14:27 -0400)]
AMDGPU: Remove r600 local id annotations in AMDGPULowerIntrinsics
With these dropped and memory intrinsic moved into a generic pass, we
can drop the whole pass.
No tests fail with this removed. The new amdgcn intrinsics are
annotated in clang up front. Theoretically may regress r600, but that
would need new testing and support work (r600 ideally would also
follow the clang handling). The regression would be any IR passes
making use of known bits between this point and codegen. The DAG
computeKnownBits understand the intrinsics directly now.
If we wanted to refine these values, a better place would be in
AMDGPUAttributor.
Leonard Chan [Wed, 7 Jun 2023 18:44:52 +0000 (18:44 +0000)]
[libc] Temporarily suppress -fsanitize=function for qsort comparator
Recent upstream changes to -fsanitize=function find more instances of
function type mismatches. One case is with the comparator passed to this
class. Libraries like boringssl will tend to pass comparators that take
pointers to varying types while this comparator expects to accept const
void pointers. Ideally those tools would pass a function that strictly
accepts const void*s to avoid UB, or we'd have something like qsort_r/s.
Differential Revision: https://reviews.llvm.org/D152322
Corentin Jabot [Mon, 8 May 2023 10:18:43 +0000 (12:18 +0200)]
[clang] Implement P2564 "consteval must propagate up"
Reviewed By: aaron.ballman, #clang-language-wg
Differential Revision: https://reviews.llvm.org/D151094
Louis Dionne [Mon, 5 Jun 2023 15:20:39 +0000 (08:20 -0700)]
[libc++] Rename availability macros for <filesystem>
This makes it clearer that the availability macro only pertains to
<filesystem>, and not to whether the platform has support for a file
system.
Differential Revision: https://reviews.llvm.org/D152172
usama hameed [Tue, 6 Jun 2023 22:53:18 +0000 (15:53 -0700)]
[Sanitizers] Remove BuildId from sanitizers stacktrace on Darwin
On Darwin, we do not want to show the BuildId appended at the end of stack
frames in Sanitizers. The BuildId/UUID can be seen by using the
print_module_map=1 sanitizer option.
Differential Revision: https://reviews.llvm.org/D150298
rdar://
108324403
Jacques Pienaar [Wed, 7 Jun 2023 18:15:06 +0000 (11:15 -0700)]
[mlir][bytecodegen] Don't emit empty case (NFC)
Aart Bik [Wed, 7 Jun 2023 17:43:48 +0000 (10:43 -0700)]
[mlir][sparse][gpu] refined build setup for cusparse
Reviewed By: K-Wu
Differential Revision: https://reviews.llvm.org/D152387
Eli Friedman [Mon, 17 Apr 2023 20:15:46 +0000 (13:15 -0700)]
[COFF] Add MC support for emitting IMAGE_WEAK_EXTERN_ANTI_DEPENDENCY symbols
This is mostly useful for ARM64EC, which uses such symbols extensively.
One interesting quirk of ARM64EC is that we need to be able to emit weak
symbols that point at each other (so if either symbol is defined
elsewhere, both symbols point at the definition). This handling is
currently restricted to weak_anti_dep symbols, because we depend on the
current behavior of resolving weak symbols in some cases.
Differential Revision: https://reviews.llvm.org/D145208
David Blaikie [Wed, 7 Jun 2023 18:02:58 +0000 (18:02 +0000)]
Remove unnecessary copy
Derek Schuff [Wed, 7 Jun 2023 17:24:07 +0000 (10:24 -0700)]
[WebAssembly] Add ldexp{,f,l} libcall signatures
llvm.ldexp.* intrinsics were recently added to LLVM, which means
wasm now needs to know the signatures of the corresponding libcalls.
Differential Revision: https://reviews.llvm.org/D152385
Fixes: #63164
Leandro Lupori [Wed, 7 Jun 2023 17:27:59 +0000 (17:27 +0000)]
[InstrProf] Skip Balanced Partitioning tests on ARM
Balanced Partitioning tests, added by
1794532bb942, currently
hang on ARM, what causes check-all to never finish.
Issue #63168
Differential Revision: https://reviews.llvm.org/D147812
Caleb Zulawski [Wed, 7 Jun 2023 17:20:22 +0000 (10:20 -0700)]
Improve WebAssembly vector bitmask, mask reduction, and extending
This is inspired by a recently filed Rust issue noting poor codegen for vector masks (https://github.com/rust-lang/portable-simd/issues/351).
Reviewed By: tlively
Differential Revision: https://reviews.llvm.org/D151782
Alex Langford [Tue, 6 Jun 2023 01:05:11 +0000 (18:05 -0700)]
[lldb][NFCI] Change type of Broadcaster's name
Broadcasters don't need their names in the StringPool. It doesn't
benefit from fast comparisons and doesn't benefit from uniqueness.
Differential Revision: https://reviews.llvm.org/D152220
rikhuijzer [Wed, 7 Jun 2023 17:09:17 +0000 (10:09 -0700)]
[MLIR][Tosa] Fix fp canonicalization for `clamp`
The canonicalization for `clamp` removed the `clamp` operation when the
chosen min and max values were outside the range of what is possible to
represent with the input type. For example, if the input type is `i8`,
then the min and max values must be between -128 and 127. If the min and
max are, say, -200 and 200, then the `clamp` operation can be safely
removed.
However, as pointed out by @wyanzhao, this is wrong for floating point
types since they can represent infinity.
Fixes #62341.
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D152123
rikhuijzer [Wed, 7 Jun 2023 16:04:19 +0000 (09:04 -0700)]
[mlir][quant] Move comments to TableGen statements
The `quant` dialect documentation currently mostly empty (https://mlir.llvm.org/docs/Dialects/QuantDialect/).
This patch moves the comments to TableGen statements.
By looking at the generated `QuantDialect.md`, I've confirmed that each change in this patch will end up in the documentation.
The only thing that I wasn't able to document was the `UniformQuantizedType`.
I haven't found a way to document a `DialectType` since most appear to be private in other dialects; suggestions are welcome.
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D151649
max [Wed, 31 May 2023 20:52:46 +0000 (15:52 -0500)]
[MLIR][python bindings] TypeCasters for Attributes
Differential Revision: https://reviews.llvm.org/D151840
Jay Foad [Wed, 7 Jun 2023 16:50:06 +0000 (17:50 +0100)]
[AMDGPU] Regenerate some spill checks
Jens Massberg [Wed, 7 Jun 2023 13:15:07 +0000 (15:15 +0200)]
Fix parameter name in Sema::addInitCapture to ByRef.
Rename parameter in Sema::addInitCapture as proposed in review of Sema::addInitCapture. Sorry, that I have missed the comment there!
Reviewed By: ilya-biryukov
Differential Revision: https://reviews.llvm.org/D139541
Mark de Wever [Sun, 4 Jun 2023 15:46:02 +0000 (17:46 +0200)]
[LLVM] Removes CMake work-arounds.
CMake older than 3.20.0 is no longer supported.
This removes work-arounds for no longer supported versions.
Reviewed By: kwk
Differential Revision: https://reviews.llvm.org/D152103
Nico Weber [Wed, 7 Jun 2023 16:00:39 +0000 (12:00 -0400)]
[gn] port
66a562d22e7 more (libc++ _LIBCPP_HAS_NO_FILESYSTEM)
Aaron Ballman [Wed, 7 Jun 2023 15:53:08 +0000 (11:53 -0400)]
Add support for the NO_COLOR environment variable
Clang currently supports disabling color diagnostic output via
-fno-color-diagnostics. However, there is a somewhat long-standing push
to support use of an environment variable to override color output so
that users can set up their terminal such that most color output is
disabled (largely for accessibility reasons).
There are two competing de facto standards to accomplish this:
NO_COLOR (https://no-color.org/) and
CLICOLOR/CLICOLOR_FORCE (http://bixense.com/clicolors/).
This patch adds support for NO_COLOR as that appears to be the more
commonly supported feature, at least when comparing issues and pull
requests:
https://github.com/search?q=NO_COLOR&type=issues (2.2k issues, 35k pull requests)
https://github.com/search?q=CLICOLOR&type=issues (1k issues, 3k pull requests)
It's also the more straightforward and thoroughly-specified of the two
options. If NO_COLOR is present as an environment variable (regardless
of value), color output is suppressed unless the command line specifies
use of color output (command line takes precedence over the environment
variable).
Differential Revision: https://reviews.llvm.org/D152285
Craig Topper [Wed, 7 Jun 2023 15:49:45 +0000 (08:49 -0700)]
[RISCV] Use inheritance to reduce repeated code in RISCVInstrInfoV.td. NFC
Reviewed By: pcwang-thead
Differential Revision: https://reviews.llvm.org/D152343
Mark de Wever [Sun, 4 Jun 2023 15:42:38 +0000 (17:42 +0200)]
[MLIR] Removes CMake work-arounds.
CMake older than 3.20.0 is no longer supported.
This removes work-arounds for no longer supported versions.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D152101
Mark de Wever [Sun, 4 Jun 2023 15:44:30 +0000 (17:44 +0200)]
[compiler-rt] Removes CMake work-arounds.
CMake older than 3.20.0 is no longer supported.
This removes work-arounds for no longer supported versions.
Reviewed By: phosek
Differential Revision: https://reviews.llvm.org/D152102
Nico Weber [Wed, 7 Jun 2023 15:37:07 +0000 (11:37 -0400)]
[gn] port
66a562d22e7 (libc++ _LIBCPP_HAS_NO_FILESYSTEM)
Tom Eccles [Wed, 7 Jun 2023 15:23:52 +0000 (15:23 +0000)]
Revert "[flang][hlfir] allow recursive intrinsic lowering"
This reverts commit
6bcfab3161ea3a90b26dce3f85ba052933060b73.
Reverting because this breaks the build with MSVC
Pavel Kosov [Wed, 7 Jun 2023 13:05:46 +0000 (16:05 +0300)]
[TableGen] Emit separate computeRequiredFeatures() function
A function is already emitted in *GenInstrInfo.inc that takes Opcode
number and a set of supported Features and reports fatal error if some
of the required features are missing.
The information about features required by the particular opcode can be
reused by llvm-exegesis, so move its computation info a separate
computeRequiredFeatures() function. Then verifyInstructionPredicates()
can just compare the sets of available and required features computed by
the other functions.
This commit moves the definition of FeatureBitsets[] as well as CEFBS_*
enumerator values (that are indices into FeatureBitsets[] array) inside
the computeRequiredFeatures() function because these are implementation
details of that function. The inclusion of potentially huge
computeRequiredFeatures() function is now controlled by a dedicated
macro that is set for simplicity by TableGen-erated code itself if
`defined(ENABLE_INSTR_PREDICATE_VERIFIER) && !defined(NDEBUG)`.
~~
Huawei RRI, OS Lab
Reviewed By: courbet
Differential Revision: https://reviews.llvm.org/D148516
Fangrui Song [Wed, 7 Jun 2023 15:06:05 +0000 (08:06 -0700)]
[Option] Support special argument "--"
Many command line option implementations, including getopt_long and our
Support/CommandLine.cpp, support `--` as an end-of-option indicator. All
the subsequent arguments are then treated as positional arguments.
D1387 added KIND_REMAINING_ARGS and
76ff1d915c9c42823a3f2b08ff936cf7a48933c5 dropped special handling of `--`.
Users need to add `def DASH_DASH : Option<["--"], "", KIND_REMAINING_ARGS>;` and
append `OPT_DASH_DASH` to the `OPT_INPUT` list., which is not ergonomic.
Restore this feature under an option and modify llvm-strings to utilize the
feature as an example. In the future, we probably should enable this feature by
default and exclude some tools that handle `DASH_DASH` differently (clang,
clang-scan-deps, etc. I suspect that many are workarounds for LLVMOption not
supporting `--` as a built-in feature).
Reviewed By: serge-sans-paille
Differential Revision: https://reviews.llvm.org/D152286
Louis Dionne [Wed, 31 May 2023 18:20:24 +0000 (11:20 -0700)]
[libc++] Roll up fstream support into filesystem support
LIBCXX_ENABLE_FILESYSTEM should represent whether the platform has
support for a filesystem, not just whether we support <filesystem>.
This patch slightly generalizes the setting to also encompass whether
we provide <fstream>, since that only makes sense when a filesystem is
supported.
Differential Revision: https://reviews.llvm.org/D152168
Justin Cady [Wed, 7 Jun 2023 14:59:07 +0000 (10:59 -0400)]
[ASAN] Fix validation size for dirent on FreeBSD
Typically the size required to represent a dirent is stored in `d_reclen`. But
this not always the case for FreeBSD (for example, when walking a directory
over NFS).
This leads to ASAN false positives for `scandir` and similar functions. Because
ASAN uses `d_reclen` for the range to validate, it can overrun when `d_reclen` is
incorrect (too large).
This change adds `__sanitizer_dirsiz` which fixes the dirent size calculation
for FreeBSD. Other platforms continue to use `d_reclen`.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D151583
Timo Stripf [Wed, 7 Jun 2023 14:57:31 +0000 (10:57 -0400)]
[clang][DeclPrinter] Fix AST print of out-of-line record definitions
DeclPrinter::VisitCXXRecordDecl did not output qualifiers for records.
As result, the output of out-of-line record definitions was incorrect.
Differential Revision: https://reviews.llvm.org/D151528
Kristina Bessonova [Mon, 13 Mar 2023 12:27:45 +0000 (13:27 +0100)]
[DebugMetadata] Simplify handling subprogram's retainedNodes field. NFCI (1/7)
RFC https://discourse.llvm.org/t/rfc-dwarfdebug-fix-and-improve-handling-imported-entities-types-and-static-local-in-subprogram-and-lexical-block-scopes/68544
Currently, `retainedNodes` tracks function-local variables and labels.
To support function-local import, types and static variables (which are globals
in LLVM IR), subsequent patches use the same field. So this patch makes
preliminary refactoring of the code tracking local entities to apply future
functional changes lucidly and cleanly.
No functional changes intended.
Differential Revision: https://reviews.llvm.org/D143984
Tom Eccles [Tue, 6 Jun 2023 15:15:25 +0000 (15:15 +0000)]
[flang][hlfir] allow recursive intrinsic lowering
We need to allow recursive application of intrinsic lowering patterns,
otherwise we cannot lower nested calls of the same intrinsic e.g.
matmul(matmul(a, b), c).
matmul(matmul(a, b), matmul(c, d)) requires hlfir.associate of hlfir
expr with more than one use (TODO).
Differential Revision: https://reviews.llvm.org/D152284
Tom Eccles [Fri, 2 Jun 2023 16:53:20 +0000 (16:53 +0000)]
[flang][hlfir] relax the strictness of intrinsic verifiers
The verifiers for hlfir.matmul and hlfir.transpose try to ensure that
the shape of the result value makes sense given the shapes of the input
argument(s).
It there are some cases in the gfortran tests where lowering knows a bit
more about shape information than (HL)FIR. I think the cases here will be
solved when hlfir.shape_meet is implemented.
But in the meantime, and to improve robustness, I've relaxed the
verifier to allow the return type to have more precise shape information
than can be deduced from the argument type(s).
Differential Revision: https://reviews.llvm.org/D152254
Nico Weber [Wed, 7 Jun 2023 14:17:48 +0000 (10:17 -0400)]
Nico Weber [Wed, 7 Jun 2023 14:15:43 +0000 (10:15 -0400)]
zhongyunde [Wed, 7 Jun 2023 13:50:54 +0000 (21:50 +0800)]
[LV] Add option to tune the cost model, NFC
For Neon, the default nonconst stride cost is conservative,
and it is a local variable, which is not convenience to
to tune the loop vectorize.
So I try to use a option, which is similar to SVEGatherOverhead brought in D115143.
Fix https://github.com/llvm/llvm-project/issues/63082.
Reviewed By: dmgreen, fhahn
Differential Revision: https://reviews.llvm.org/D152253
Vy Nguyen [Tue, 6 Jun 2023 18:00:47 +0000 (14:00 -0400)]
Reland "D144999 [MC][MachO]Only emits compact-unwind format for "canonical" personality symbols. For the rest, use DWARFs."
Reasons for rolling forward:
- the crash reported from Chromium was fixed in D151824 (not related to this patch at all)
- since D152824 was committed, it should now be safe to roll this forward.
New change:
- add an additional _ in name check
This reverts commit
4980eead4d0b4666d53dad07afb091375b3a13a0.
Nikita Popov [Wed, 7 Jun 2023 13:16:35 +0000 (15:16 +0200)]
[Clang] Convert some tests to opaque pointers (NFC)
pvanhout [Tue, 6 Jun 2023 11:32:00 +0000 (13:32 +0200)]
[clang][CodeGen] Fix GPU-specific attributes being dropped by bitcode linking
Device libs make use of patterns like this:
```
__attribute__((target("gfx11-insts")))
static unsigned do_intrin_stuff(void)
{
return __builtin_amdgcn_s_sendmsg_rtnl(0x0);
}
```
For functions that are assumed to be eliminated if the currennt GPU target doesn't support them.
At O0 such functions aren't eliminated by common optimizations but often by AMDGPURemoveIncompatibleFunctions instead, which sees the "+gfx11-insts" attribute on, say, GFX9 and knows it's not valid, so it removes the function.
D142907 accidentally made it so such attributes were dropped during bitcode linking, making it impossible for RemoveIncompatibleFunctions to catch the functions and causing ISel to catch fire eventually.
This fixes the issue and adds a new test to ensure we don't accidentally fall into this trap again.
Fixes SWDEV-403642
Reviewed By: arsenm, yaxunl
Differential Revision: https://reviews.llvm.org/D152251
Michael Liao [Wed, 31 May 2023 03:34:47 +0000 (23:34 -0400)]
[TableGen] Add !setdagarg and !setdagname
- This patch proposes to add `!setdagarg` and `!setdagname` bang
operators to produce a new DAG node after replacing the specified
argument value/name from the given input DAG node. E.g.,
`!setdagarg((foo 1, 2), 0, "x")` produces `(foo "x", 2)` and
`!setdagname((foo 1:$a, 2:$b), 1, "c")` produces `(foo 1:$a, 2:$c)`.
Reviewed By: simon_tatham
Differential Revision: https://reviews.llvm.org/D151842
Phoebe Wang [Wed, 7 Jun 2023 08:15:06 +0000 (16:15 +0800)]
[X86][FP16] Do not generate VBROADCAST for fp16
We cannot lower VBROADCAST i16 under AVX1.
Fixes #63114
Differential Revision: https://reviews.llvm.org/D152350
Matt Arsenault [Wed, 7 Jun 2023 12:16:51 +0000 (08:16 -0400)]
PreISelIntrinsicLowering: Identify load.relative with intrinsic id
Matt Arsenault [Wed, 7 Jun 2023 11:56:16 +0000 (07:56 -0400)]
AMDGPU: Add MF independent version of getImplicitParameterOffset
Matt Arsenault [Wed, 7 Jun 2023 11:47:52 +0000 (07:47 -0400)]
AMDGPU: Use available subtarget member
Jie Fu [Wed, 7 Jun 2023 12:23:48 +0000 (20:23 +0800)]
[Clang][OpenMP] Fix -Wcovered-switch-default in CGOpenMPRuntime.cpp (NFC)
/data/llvm-project/clang/lib/CodeGen/CGOpenMPRuntime.cpp:1621:3: error: default label in switch which covers all enumeration values [-Werror,-Wcovered-switch-default]
default:
^
/data/llvm-project/clang/lib/CodeGen/CGOpenMPRuntime.cpp:1643:3: error: default label in switch which covers all enumeration values [-Werror,-Wcovered-switch-default]
default:
^
2 errors generated.
David Green [Wed, 7 Jun 2023 12:18:16 +0000 (13:18 +0100)]
[AArch64][SVE] Add a commutative VSelectCommPredOrPassthruPatFrags
This adds a commutative version of VSelectPredOrPassthruPatFrags (renamed from
EitherVSelectOrPassthruPatFrags) that checks both variants for commutative
operations like min/max. I have not attempted to handle fp operation that
require fast-math flags.
Differential Revision: https://reviews.llvm.org/D151084
Andrew Gozillon [Wed, 7 Jun 2023 11:36:44 +0000 (06:36 -0500)]
[Clang][OpenMP][IRBuilder] Move registerTargetGlobalVariable & getAddrOfDeclareTargetVar into the OMPIRBuilder
This change tries to move registerTargetglobalVariable and
getAddrOfDeclareTargetVar out of Clang's CGOpenMPRuntime
and into the OMPIRBuilder for shared use with MLIR's OpenMPDialect
and Flang (or other languages that may want to utilise it).
This primarily does this by trying to hoist the Clang specific
types into arguments or callback functions in the form of
lambdas, replacing it with LLVM equivelants and
utilising shared OMPIRBuilder enumerators for
the clauses, rather than Clang's own variation.
Reviewers: jsjodin, jdoerfert
Differential Revision: https://reviews.llvm.org/D149162
Martin Storsjö [Wed, 7 Jun 2023 11:43:56 +0000 (14:43 +0300)]
[compiler-rt] Do not redefine builtins in MinGW configs either
This fixes broken mingw builds since
0a71e25e2448ee471b1ebe74e910c5de9b9c82b4. Clang-cl style builds
were broken similarly, but were fixed in
caa2c1bacbd76c017ebbb4fd13861f0f66770299, with the comment
"Do not redefine builtins on Windows", even if the fix only affected
Clang-cl style builds.
Jacob Crawley [Mon, 5 Jun 2023 15:23:50 +0000 (15:23 +0000)]
[flang][hlfir] Add hlfir.dot_product intrinsic
Adds a new HLFIR operation for the DOT_PRODUCT intrinsic according to
the design set out in flang/docs/HighLevel.md. This patch includes all
the necessary changes to create a new HLFIR operation and lower it into
the fir runtime call.
Differential Revision: https://reviews.llvm.org/D152252
Joseph Huber [Wed, 7 Jun 2023 11:22:42 +0000 (06:22 -0500)]
[libc] Silence warning about returning from noreturn function
The `exit` entrypoint calls into `quick_exit` which is marked noreturn
in some cases. This will cause errors because we then have control flow
externally. This warning can be silenced by using a
`__builtin_unreachable` instruction accordingly.
Reviewed By: sivachandra, lntue
Differential Revision: https://reviews.llvm.org/D152323
Marco Elver [Wed, 7 Jun 2023 11:07:44 +0000 (13:07 +0200)]
[sanitizer_common] Use interception macros for s390 __tls_get_addr declarations
NFC.
Jens Massberg [Fri, 21 Apr 2023 14:41:43 +0000 (16:41 +0200)]
[clang] Show error if defaulted comparions operator function is volatile or has ref-qualifier &&.
This patch implemed the change proposed in [P2002R1] to 11.11.1 [class.compare.default] paragraph 1.
A defaulted compariosn operator function must be non-volatile and must either have no ref-qualifier or the ref-qualifier &.
Differential Revision: https://reviews.llvm.org/D148924
Ivan Kosarev [Wed, 7 Jun 2023 10:05:05 +0000 (11:05 +0100)]
[AMDGPU][NFC] Add a getRegBitWidth() helper for TargetRegisterClass operands.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D152257
Christian Kandeler [Fri, 3 Feb 2023 11:37:58 +0000 (12:37 +0100)]
[clangd] Add semantic token for labels
Reviewed By: kadircet
Differential Revision: https://reviews.llvm.org/D143260
Serguei Katkov [Wed, 7 Jun 2023 09:47:07 +0000 (16:47 +0700)]
[CGP] Add test to show the missed case in remove llvm.assume
Matthias Springer [Wed, 7 Jun 2023 09:52:56 +0000 (11:52 +0200)]
[mlir][transform] Add builder to ApplyPatternsOp
Add a builder that takes a callback to construct the body of the op.
Differential Revision: https://reviews.llvm.org/D152352
Valery Pykhtin [Tue, 6 Jun 2023 17:52:09 +0000 (19:52 +0200)]
[AMDGPU] Turn off pass to rewrite partially used virtual superregisters after RenameIndependentSubregs pass with registers of minimal size.
There is a failure with this pass in the case when target register class for a subregister isn't known from instruction description (for ex. COPY).
Currently in this situation the RC is obtained using TargetRegisterInfo::getSubRegisterClass but in general it's not working.
In order to fix this two things should be done:
1. Stop processing a subregister if the target register class is unknown (conservative approach)
2. Improve deduction of subregister' target register class (i.e by processing COPY chain)
I was going to implement point 1 but my tests use implicit operands for S_NOP and they don't have associated target register class and all tests fail.
Therefore I decided to turn off the pass now, implement point 1 and fix my tests.
Reviewed By: arsenm, #amdgpu
Differential Revision: https://reviews.llvm.org/D152291
Simon Pilgrim [Wed, 7 Jun 2023 09:19:07 +0000 (10:19 +0100)]
[X86] Add test case for Issue #63108
Haojian Wu [Tue, 6 Jun 2023 14:09:46 +0000 (16:09 +0200)]
[include-cleaner] Report all specializations if the primary template is introduced by a using-decl.
This will fix unused-include false positive.
```
// primary.h
namespace ns {
template<class T1, class T2> class Z {}; // primary template
}
// partial.h
namespace ns {
template<class T> class Z<T, T*> {}; // partial specialization
}
// main.cpp
using ns::Z; // refs to the primary
void k() {
Z<int, int*> z; // use the partial specialization
}
```
Differential Revision: https://reviews.llvm.org/D152345
Matthias Springer [Wed, 7 Jun 2023 07:50:24 +0000 (09:50 +0200)]
[mlir][vector][transform] Add ApplyCastAwayVectorLeadingOneDimPatternsOp
Expose the respective patterns as a transform op.
Differential Revision: https://reviews.llvm.org/D152346
Corentin Jabot [Fri, 2 Jun 2023 17:15:03 +0000 (19:15 +0200)]
[clang] Fix assertion while parsing an invalid for loop
with multiple declarations followed by a colon.
Fixes #63010
Reviewed By: shafik
Differential Revision: https://reviews.llvm.org/D152009
Marco Elver [Wed, 7 Jun 2023 08:15:49 +0000 (10:15 +0200)]
Revert "[compiler-rt] Allow 3 simultaneous interceptors on Linux"
This reverts commit
57882fe76e1826593cd0e53f73484b184c5007c4.
This reverts commit
74b0ac571b5facee3c8038d21ed71d7a29ee1098.
Breaks various build bots.
Juan Manuel MARTINEZ CAAMAÑO [Wed, 7 Jun 2023 07:54:16 +0000 (09:54 +0200)]
[AsmPrinter][AMDGPU] Generate uwtable entries in .eh_frame
Consider only targets where `MCAsmInfo::ExceptionsType == ExceptionHandling::None`
and that support CFI (when `MCAsmInfo::UsesCFIForDebug` is set to true):
currently, only AMDGPU.
This patch enables the emission of CFI information in the .eh_frame
section when the uwtable attribute is present on a function.
Before, we could generate CFI information for debugging puproses only.
This patch prepares AMDGPU to support collecting GPU stack traces in the future.
I did a first implementation (https://reviews.llvm.org/D139024)
but at the time I had not realized that no other platform used
`UsesCFIForDebug`.
Reviewed By: scott.linder
Differential Revision: https://reviews.llvm.org/D151806
pvanhout [Thu, 25 May 2023 12:19:08 +0000 (14:19 +0200)]
[NFC][RFC][TableGen] Split GlobalISelEmitter.cpp
This patch splits the GlobalISelEmitter.cpp file, which imports DAG ISel patterns for GISel, into separate "GISelMatchTable.h/cpp" files.
The main motive is readability & maintainability. GlobalISelEmitter.cpp was about 6400 lines of mixed code, some bits implementing the match table codegen, some others dedicated to importing DAG patterns.
Now it's down to 2700 + a 2150 header + 2000 impl.
It's a tiny bit more lines overall but that's to be expected - moving
inline definitions to out-of-line, adding comments in the .cpp, etc. all of that takes additional space, but I think the tradeoff is worth it.
I did as little unrelated code changes as possible, I would say the biggest change is the introduction of the `gi` namespace used to prevent name conflicts/ODR violations with type common names such as `Matcher`.
It was previously not an issue because all of the code was in an anonymous namespace.
This moves all of the "match table" code out of the file, so predicates,
rules, and actions are all separated now. I believe this helps separating concerns, now `GlobalISelEmitter.cpp` is more focused on importing DAG patterns into GI, instead of also containing the whole match table internals as well.
Note: the new files have a "GISel" prefix to make them distinct from the other "GI" files in the same folder, which are for the combiner.
Reviewed By: aemerson
Differential Revision: https://reviews.llvm.org/D151432
Aiden Grossman [Sun, 28 May 2023 02:34:30 +0000 (02:34 +0000)]
[CMake] Add option to link LLVM/subproject executables against LLVM libc
This patch adds in CMake option LLVM_ENABLE_LLVM_LIBC which when set to
true automatically builds LLVM libc in overlay mode and links all
generated executables against the libc overlay. This is intended to
somewhat mirror the LLVM_ENABLE_LIBCXX flag.
Differential Revision: https://reviews.llvm.org/D151013
Marco Elver [Wed, 7 Jun 2023 07:17:43 +0000 (09:17 +0200)]
Fix "[compiler-rt] Allow 3 simultaneous interceptors on Linux"
No need to "error" on unsupported architectures, since we technically
only care where the macro is used. If the macro is undefined, and used,
the compiler will producer an error anyway.
This fixes build on Windows, where none of these macros should be used.
Marco Elver [Tue, 30 May 2023 17:27:59 +0000 (19:27 +0200)]
[compiler-rt] Allow 3 simultaneous interceptors on Linux
Rework Linux (and *BSD) interceptors to allow for up to 3 (2 for *BSD)
simultaneous interceptors. See code comments for details.
The main motivation is to support new sampling sanitizers (in the spirit
of GWP-ASan), that have to intercept few functions. Unfortunately, the
reality is that there are user interceptors that exist in the wild.
To support foreign user interceptors, foreign dynamic analysis
interceptors, and compiler-rt interceptors all at the same time,
including any combination of them, this change enables up to 3
interceptors on Linux (2 on *BSD).
Reviewed By: dvyukov, MaskRay, vitalybuka
Differential Revision: https://reviews.llvm.org/D151085
Matthias Springer [Wed, 7 Jun 2023 06:43:58 +0000 (08:43 +0200)]
[mlir][linalg] Add option to pad Linalg ops to a specified multiple
A multiple (int64_t) can optionally be specified for every padding dimension.
Differential Revision: https://reviews.llvm.org/D152262
Matthias Springer [Wed, 7 Jun 2023 06:43:21 +0000 (08:43 +0200)]
[mlir][linalg][NFC] Simplify padOperandToSmallestStaticBoundingBox
The implementation is based on `ValueBoundsOpInterface` to compute upper bounds for tensor dim sizes. It is not necessary to skip over certain ops and reify shape dims; `ValueBoundsOpInterface` already takes care of that.
Differential Revision: https://reviews.llvm.org/D152256
luxufan [Wed, 7 Jun 2023 06:01:59 +0000 (14:01 +0800)]
[LoopIdiom] Freeze BitPos if !isGuaranteedNotToBeUndefOrPoison
Fixes: https://github.com/llvm/llvm-project/issues/62873
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D151690
Bing1 Yu [Wed, 7 Jun 2023 06:32:36 +0000 (14:32 +0800)]
[CodeGen] Disable default copy assignment operator for struct VectorInfo
struct VectorInfo manages resources such as dynamically allocated memory, it's generally a good practice to either implement a custom copy constructor or disable the default one
Reviewed By: kazu
Differential Revision: https://reviews.llvm.org/D152230
Bing1 Yu [Wed, 7 Jun 2023 06:31:42 +0000 (14:31 +0800)]
[CodeGen] Disable default copy ctor and copy assignment operator for class Array
class Array manages resources such as dynamically allocated memory, it's generally a good practice to either implement a custom copy constructor or disable the default one.
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D152231
Bing1 Yu [Wed, 7 Jun 2023 06:30:48 +0000 (14:30 +0800)]
[CodeGen] Disable default copy ctor and copy assignment operator for VLIWPacketizerList
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D152232
Bing1 Yu [Wed, 7 Jun 2023 06:29:48 +0000 (14:29 +0800)]
[CodeGen] Disable default copy ctor and copy assignment operator for class Scoreboard
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D152234
Bing1 Yu [Wed, 7 Jun 2023 06:28:39 +0000 (14:28 +0800)]
[CodeGen] Disable default copy ctor and copy assignment operator for InterferenceCache
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D152235
Bing1 Yu [Wed, 7 Jun 2023 06:27:49 +0000 (14:27 +0800)]
[CodeGen] Disable default copy ctor and copy assignment operator for class Circuits
Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D152238
Bing1 Yu [Wed, 7 Jun 2023 06:26:37 +0000 (14:26 +0800)]
[CodeGen] Disable default copy ctor and copy assignment operator for VLIWResourceModel
Reviewed By: JamesNagurne
Differential Revision: https://reviews.llvm.org/D152239
Craig Topper [Wed, 7 Jun 2023 06:21:23 +0000 (23:21 -0700)]
[RISCV] Fix sched class for MC layer version of vmsgt.vx.
Wenju He [Wed, 7 Jun 2023 06:12:22 +0000 (14:12 +0800)]
Set isRequired true for CFGViewer/CFGPrinter passes
This PR allows function's cfg to be viewed/printed even if the function
has optnone attribute.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D152122
Craig Topper [Wed, 7 Jun 2023 05:52:27 +0000 (22:52 -0700)]
[RISCV] Fix sched class for MC layer version of vrsub.vx.
Weining Lu [Wed, 7 Jun 2023 03:20:30 +0000 (11:20 +0800)]
[LoongArch] Define `ual` feature and override `allowsMisalignedMemoryAccesses`
Some CPUs do not allow memory accesses to be unaligned, e.g. 2k1000la
who uses the la264 core on which misaligned access will trigger an
exception.
In this patch, a backend feature called `ual` is defined to decribe
whether the CPU supports unaligned memroy accesses. And this feature
can be toggled by clang options `-m[no-]unaligned-access` or the
aliases `-m[no-]strict-align`. When this feature is on,
`allowsMisalignedMemoryAccesses` sets the speed number to 1 and returns
true that allows the codegen to generate unaligned memory access insns.
Clang options `-m[no-]unaligned-access` are moved from `m_arm_Features_Group`
to `m_Group` because now more than one targets use them. And a test
is added to show that they remain unused on a target that does not
support them. In addition, to keep compatible with gcc, a new alias
`-mno-strict-align` is added which is equal to `-munaligned-access`.
The feature name `ual` is consistent with linux kernel [1] and the
output of `lscpu` or `/proc/cpuinfo` [2].
There is an `LLT` variant of `allowsMisalignedMemoryAccesses`, but
seems that curently it is only used in GlobalISel which LoongArch
doesn't support yet. So this variant is not implemented in this patch.
[1]: https://github.com/torvalds/linux/blob/master/arch/loongarch/include/asm/cpu.h#L77
[2]: https://github.com/torvalds/linux/blob/master/arch/loongarch/kernel/proc.c#L75
Reviewed By: xen0n
Differential Revision: https://reviews.llvm.org/D149946
Craig Topper [Wed, 7 Jun 2023 05:25:22 +0000 (22:25 -0700)]
[RISCV] Split scheduler classes for vector min/max from compares.
Compares write a mask result. Min/max write a full result. This
makes them sufficiently different to have their own classes.
Reviewed By: pcwang-thead
Differential Revision: https://reviews.llvm.org/D152020
Tue Ly [Wed, 7 Jun 2023 04:32:27 +0000 (00:32 -0400)]
[libc] Fix undefined behavior of left shifting signed integer in exp2f.cpp.
Fix undefined behavior of left shifting signed integer in exp2f.cpp.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D152336
Michael Platings [Tue, 6 Jun 2023 13:03:54 +0000 (14:03 +0100)]
[NFC][Driver] Change Multilib flag representation
This new representation means that a valid command line option may
potentially be used directly as a multilib flag without any translation.
To indicate that a flag is required not to be present, its first
character is replaced with '!', which is intended for consistency with
the logical not operator in many programming languages.
Reviewed By: simon_tatham
Differential Revision: https://reviews.llvm.org/D151438