peter klausler [Tue, 26 Jan 2021 21:57:44 +0000 (13:57 -0800)]
[flang] Search for #include "file" in right directory (take 2)
Make the #include "file" preprocessing directive begin its
search in the same directory as the file containing the directive,
as other preprocessors and our Fortran INCLUDE statement do.
Avoid current working directory for all source files except the original.
Resolve tests.
Differential Revision: https://reviews.llvm.org/D95481
Nico Weber [Wed, 27 Jan 2021 21:51:27 +0000 (16:51 -0500)]
clang: Fix static_assert in a few contexts in microsoft mode
Follow-up to D17444. Fixes PR48904. See bug for details.
Differential Revision: https://reviews.llvm.org/D95559
Roman Lebedev [Wed, 27 Jan 2021 22:24:19 +0000 (01:24 +0300)]
[CodeGen] IndirectBrExpandPass: preserve Dominator Tree, if available
This fully de-pessimizes the common case of no indirectbr's,
(where we don't actually need to do anything to preserve domtree)
and avoids domtree recomputation in the case there were indirectbr's.
Note that two indirectbr's could have a common successor, and not all
successors of an indirectbr's are meant to survive the expansion.
Though, the code assumes that an indirectbr's doesn't have
duplicate successors, those *should* have been deduplicated
by simplifycfg or something already.
Jessica Paquette [Thu, 21 Jan 2021 01:30:17 +0000 (17:30 -0800)]
[AArch64][GlobalISel] Allow vector store legalization into 128-bit-wide types
We are allowed to store 128-bit-wide values using the q registers on AArch64.
GlobalISel was clamping the number of elements in vector stores into 64 bits
instead.
This results in some poor codegen like below:
https://godbolt.org/z/E56dq8
```
; SDAG uses a stp + q registers in both cases here.
define void @float(<16 x float> %val, <16 x float>* %ptr) {
store <16 x float> %val, <16 x float>* %ptr
ret void
}
define void @double(<8 x double> %val, <8 x double>* %ptr) {
store <8 x double> %val, <8 x double>* %ptr
ret void
}
```
This adds similar legalization for vector stores with s8 and s16 elements.
Differential Revision: https://reviews.llvm.org/D95107
Shilei Tian [Wed, 27 Jan 2021 22:06:05 +0000 (17:06 -0500)]
[OpenMP][NVPTX] Disable building NVPTX deviceRTL by default on a non-CUDA system
D95466 dropped CUDA to build NVPTX deviceRTL and enabled it by default.
However, the building requires some libraries that are not available on non-CUDA
system by default, which could break the compilation. This patch disabled the
build by default. It can be enabled with `LIBOMPTARGET_BUILD_NVPTX_BCLIB=ON`.
Reviewed By: kparzysz
Differential Revision: https://reviews.llvm.org/D95556
David Blaikie [Fri, 25 Oct 2019 02:48:42 +0000 (19:48 -0700)]
DebugInfo: Deduplicate addresses in debug_addr
Experimental, using non-existent DWARF support to use an expr for the
location involving an addr_index (to compute address + offset so
addresses can be reused in more places).
The global variable debug info had to be deferred until the end of the
module (so bss variables would all be emitted first - so their labels
would have the relevant section). Non-bss variables seemed to not have
their label assigned to a section even at the end of the module, so I
didn't know what to do there.
Also, the hashing code is broken - doesn't know how to hash these
expressions (& isn't hashing anything inside subprograms, which seems
problematic), so for test purposes this change just skips the hash
computation. (GCC's actually overly sensitive in its hash function, it
seems - I'm forgetting the specific case right now - anyway, we might
want to just use the frontend-known file hash and give up on optimistic
.dwo/.dwp reuse)
James Y Knight [Sun, 24 Jan 2021 21:23:58 +0000 (16:23 -0500)]
Itanium Mangling: In 'enable_if', omit X/E around <expr-primary>.
The Clang enable_if extension is mangled as an <extended-qualifier>,
which is supposed to contain <template-args>. However, we were
unconditionally emitting X/E around its arguments, neglecting the fact
that <expr-primary> should be emitted directly without the surrounding
X/E.
Differential Revision: https://reviews.llvm.org/D95488
James Y Knight [Sun, 24 Jan 2021 20:50:15 +0000 (15:50 -0500)]
Itanium Mangling: Fix handling of <expr-primary> in <template-arg>.
Previously, we were emitting an extraneous X .. E in <template-arg>
around an <expr-primary> if the template argument was constructed from
an expression (rather than an already-evaluated literal value). In
such a case, we would then e.g. emit 'XLi0EE' instead of 'Li0E'.
We had one special-case for DeclRefExpr expressions, in particular, to
omit them the mangled-name without the surrounding X/E. However,
unfortunately, that special case also triggered for ParmVarDecl (a
subtype of VarDecl), and _incorrectly_ emitted 'L_Z .. E' instead of
the proper 'Xfp_E'.
This change causes mangleExpression itself to be responsible for
emitting X/E around non-primary expressions, which removes the
special-case, and corrects both these problems.
Differential Revision: https://reviews.llvm.org/D95487
James Y Knight [Mon, 7 Dec 2020 15:26:49 +0000 (10:26 -0500)]
Itanium Mangling: Mangle `__alignof__` differently than `alignof`.
The two operations have acted differently since Clang 8, but were
unfortunately mangled the same. The new mangling uses new "vendor
extended expression" syntax proposed in
https://github.com/itanium-cxx-abi/cxx-abi/issues/112
GCC had the same mangling problem, https://gcc.gnu.org/PR88115, and
will hopefully be switching to the same mangling as implemented here.
Additionally, fix the mangling of `__uuidof` to use the new extension
syntax, instead of its previous nonstandard special-case.
Adjusts the demangler accordingly.
Differential Revision: https://reviews.llvm.org/D93922
Craig Topper [Wed, 27 Jan 2021 21:14:43 +0000 (13:14 -0800)]
[RISCV] Move RISCVVPseudosTable from RISCVBaseInfo.h to RISCVInstrInfo.h. NFC
RISCVBaseInfo.h belongs to the MC layer, but the Pseudo instructions
are only used by the CodeGen layer. So it makes sense to keep this
table in the CodeGen layer.
Richard Smith [Wed, 27 Jan 2021 21:14:02 +0000 (13:14 -0800)]
Don't allow __VA_OPT__ to be detected by #ifdef.
More study has discovered this to not actually be useful: because
current C++20 implementations reject `#ifdef __VA_OPT__`, this can't
really be used as a feature-test mechanism. And it's not too hard to
detect __VA_OPT__ without this, for example:
#define THIRD_ARG(a, b, c, ...) c
#define HAS_VA_OPT(...) THIRD_ARG(__VA_OPT__(,), 1, 0, )
#if HAS_VA_OPT(?)
Partially reverts
0436ec2128c9775ba13b0308937238fc79673fdd.
Varun Gandhi [Wed, 20 Jan 2021 16:24:28 +0000 (08:24 -0800)]
[Demangle] Support demangling Swift calling convention in MS demangler.
Previously, Clang was able to mangle the Swift calling
convention but 'MicrosoftDemangle.cpp' was not able to demangle it.
Reviewed By: compnerd, rnk
Differential Revision: https://reviews.llvm.org/D95053
Vyacheslav Chigrin [Wed, 27 Jan 2021 21:07:37 +0000 (13:07 -0800)]
[sanitizer] Fix crash on empty strings.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D95431
Evgenii Stepanov [Wed, 27 Jan 2021 21:20:45 +0000 (13:20 -0800)]
Revert "[sanitizer] Fix crash on empty strings."
Wrong author name, will recommit shortly.
This reverts commit
262c50856a377371cbea673419143ae45c590b7e.
David Green [Wed, 27 Jan 2021 21:19:46 +0000 (21:19 +0000)]
[ARM] Add BE check variants for soft-fp test. NFC
Walter Erquinigo [Wed, 27 Jan 2021 21:02:45 +0000 (13:02 -0800)]
Fix runInTerminal failures on Windows
stella.stemenova mentioned in https://reviews.llvm.org/D93951 failures on Windows for this test.
I'm fixing the macro definitions and disabling the tests for python
versions lower than 3.7. I'll figure out that actual issue with
python3.6 after the buildbots are fine again.
Evgenii Stepanov [Wed, 27 Jan 2021 21:07:37 +0000 (13:07 -0800)]
[sanitizer] Fix crash on empty strings.
Patch by Vyacheslav Chigrin.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D95431
Aaron Ballman [Wed, 27 Jan 2021 20:44:28 +0000 (15:44 -0500)]
Ignore unknown attribute warnings in this test
We're testing the parsing behavior, not the actual attributes used, and
the attribute name cannot be elided for __declspec attributes.
Siva Chandra [Wed, 27 Jan 2021 20:42:42 +0000 (12:42 -0800)]
[libc] Fix list of public headers usable on aarch64.
Aaron Ballman [Wed, 27 Jan 2021 20:37:11 +0000 (15:37 -0500)]
Silence a -Wlogical-op-parentheses diagnostic; NFC
Kostya Kortchinsky [Wed, 27 Jan 2021 17:54:50 +0000 (09:54 -0800)]
[scudo][standalone] Restore GWP-ASan flag parsing
With D92696, the Scudo Standalone GWP-ASan flag parsing was changed to
the new GWP-ASan optional one. We do not necessarily want this, as this
duplicates flag parsing code in Scudo Standalone when using the
GWP-ASan integration.
This CL reverts the changes within Scudo Standalone, and increases
`MaxFlags` to 20 as an addionnal option got us to the current max.
Differential Revision: https://reviews.llvm.org/D95542
Richard Smith [Wed, 27 Jan 2021 20:24:30 +0000 (12:24 -0800)]
Permit __VA_OPT__ in all language modes and allow it to be detected with #ifdef.
These changes are intended to give code a path to move away from the GNU
,##__VA_ARGS__ extension, which is non-conforming in some situations and
which we'd like to disable in our conforming mode in those cases.
Aaron Ballman [Wed, 27 Jan 2021 20:27:53 +0000 (15:27 -0500)]
Parse different attribute syntaxes in arbitrary order
In Clang today, we parse the different attribute syntaxes
(__attribute__, __declspec, and [[]]) in a fairly rigid order. This
leads to confusion for users when they guess the order incorrectly,
and leads to bug reports like PR24559 or necessitates changes like
D94788.
This patch adds a helper function to allow us to more easily parse
attributes in arbitrary order, and then updates all of the places
where we would parse two or more different syntaxes in a rigid order to
use the helper method. The patch does not attempt to handle Microsoft
attributes ([]) because those are ambiguous with other code constructs
and we don't have any attributes that use the syntax.
Peyton, Jonathan L [Thu, 21 Jan 2021 19:38:35 +0000 (13:38 -0600)]
[OpenMP] Fix misleading warning for OMP_PLACES
When OMP_PLACES contains an invalid value, the warning informs the user
that the fallback is OMP_PLACES=threads, but the actual internal setting
is OMP_PLACES=cores and is detected as such with KMP_SETTINGS=1.
This patch informs the user that OMP_PLACES=cores is being used instead
of OMP_PLACES=threads.
Differential Revision: https://reviews.llvm.org/D95170
Peyton, Jonathan L [Fri, 15 Jan 2021 19:38:50 +0000 (13:38 -0600)]
[OpenMP] Add cpuid leaf 1f topology discovery
This patch adds the new algorithm for topology discovery using cpuid
leaf 1f. Only the new die level is detected and integrated into the
current affinity mechanisms including KMP_AFFINITY (granularity level
and compact/scatter algorithm), OMP_PLACES=dies, and KMP_HW_SUBSET.
Differential Revision: https://reviews.llvm.org/D95157
Peyton, Jonathan L [Mon, 11 Jan 2021 21:17:02 +0000 (15:17 -0600)]
[OpenMP] Fix HWLOC topology detection for 2.0.x
HWLOC 2.0 has numa nodes as separate children and are not in the main
parent/child topology tree anymore. This change takes this into
account. The main topology detection loop in the create_hwloc_map()
routine starts at a hardware thread within the initial affinity mask and
goes up the topology tree setting the socket/core/thread labels
correctly.
This change also introduces some of the more generic changes that the
future kmp_topology_t structure will take advantage of including a
generic ratio & count array (finding all ratios of topology layers like
threads/core cores/socket and finding all counts of each topology
layer), generic radix1 reduction step, generic uniformity check, and
generic printing of topology (en_US.txt)
Differential Revision: https://reviews.llvm.org/D95156
Craig Topper [Wed, 27 Jan 2021 20:22:36 +0000 (12:22 -0800)]
[RISCV] Reduce field sizes in searchable tables to reduce binary size.
Siva Chandra [Wed, 27 Jan 2021 19:52:26 +0000 (11:52 -0800)]
[libc] Fix the CMake var name of the list of public headers.
Craig Topper [Wed, 27 Jan 2021 19:01:07 +0000 (11:01 -0800)]
[RISCV] Rework fault first only load isel.
-Remove the ISD opcode for READ_VL. Just emit the MachineSDNode directly.
-Move segmented fault first only load intrinsic handling completely to
RISCVISelDAGToDAG.cpp and emit the ReadVL MachineSDNode there
instead of lowering to ISD opcodes first.
Jessica Clarke [Wed, 27 Jan 2021 19:44:01 +0000 (19:44 +0000)]
[builtins] Fix build after D95537 due to missing size_t
Strangely int_lib.h only includes stdint.h and not stddef.h, so we need
to include the latter to be able to use size_t here.
Jessica Clarke [Wed, 27 Jan 2021 19:28:20 +0000 (19:28 +0000)]
[builtins] Fix integer/pointer confusion in gcc_personality_v0.c
This fixes the implementation for architectures like CHERI with strong
pointer provenance (pointers, and thus uintptr_t, are represented as
hardware capabilities). Specifically, adding two uintptr_t's together
(as is done for `start + length` and `funcStart + landingPad`) has
ambiguous provenance, whereas using a plain integer (such as size_t) for
the offset operand does not. Also, readULEB128 is creating a plain
integer, not a pointer.
On all currently-supported architectures this should be an NFC, as
size_t and uintptr_t end up being the same underlying plain integer
type.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D95537
Sanjay Patel [Wed, 27 Jan 2021 19:11:22 +0000 (14:11 -0500)]
[LoopVectorize] use IR fast-math-flags exclusively (not FP function attributes)
I am trying to untangle the fast-math-flags propagation logic
in the vectorizers (see
a6f022127 for SLP).
The loop vectorizer has a mix of checking FP function attributes,
IR-level FMF, and just wrong assumptions.
I am trying to avoid regressions while fixing this, and I think
the IR-level logic is good enough for that, but it's hard to say
for sure. This would be the 1st step in the clean-up.
The existing test that I changed to include 'fast' actually shows
a miscompile: the function only had the equivalent of nnan, but we
created new instructions that had fast (all FMF set). This is
similar to the example in https://llvm.org/PR35538
Differential Revision: https://reviews.llvm.org/D95452
Siva Chandra [Wed, 27 Jan 2021 19:08:31 +0000 (11:08 -0800)]
[libc] Include only the relevant header files in the integration test.
Marco Vanotti [Mon, 25 Jan 2021 19:08:49 +0000 (11:08 -0800)]
[sanitizer][fuchsia] Implement ReleaseMemoryPagesToOS
The `zx_vmar_op_range` allows us to decommit memory pages without
needing a handle to the underlying vmo, as long as we have a handle to
a vmar that contains this mapping. This allows us to implement the
`ReleaseMemoryPagesToOS` function by decommitting the memory using a
handle to the root vmar.
Reviewed By: mcgrathr
Differential Revision: https://reviews.llvm.org/D95384
Julian Lettner [Wed, 27 Jan 2021 19:06:58 +0000 (11:06 -0800)]
[lit][NFC] Use enum to represent test order
Use an enum to more explicitly represent the test execution order.
Reid Kleckner [Wed, 27 Jan 2021 18:59:28 +0000 (10:59 -0800)]
Revert "Suppress non-conforming GNU paste extension in all standard-conforming modes"
This reverts commit
f4537935dcdbf390c863591cf556e76c3abab9c1.
This reverts commit
b43c26d036dcbf7a6881f39e4434cf059364022a.
This GNU and MSVC extension turns out to be very popular. Most projects
are not using C++20, so cannot use the new __VA_OPT__ feature to be
standards conformant. The other workaround, using -std=gnu*, enables too
many language extensions and isn't viable.
Until there is a way for users to get the behavior provided by the
`, ## __VA_ARGS__` extension in the -std=c++17 and earlier language
modes, we need to revert this.
LLVM GN Syncbot [Wed, 27 Jan 2021 18:55:59 +0000 (18:55 +0000)]
[gn build] Port
0b50fa99452f
Fangrui Song [Wed, 27 Jan 2021 18:55:26 +0000 (10:55 -0800)]
[test] Fix clang/test/CodeGen tests
Fangrui Song [Wed, 27 Jan 2021 18:43:51 +0000 (10:43 -0800)]
[ThinLTO] Add Visibility bits to GlobalValueSummary::GVFlags
Imported functions and variable get the visibility from the module supplying the
definition. However, non-imported definitions do not get the visibility from
(ELF) the most constraining visibility among all modules (Mach-O) the visibility
of the prevailing definition.
This patch
* adds visibility bits to GlobalValueSummary::GVFlags
* computes the result visibility and propagates it to all definitions
Protected/hidden can imply dso_local which can enable some optimizations (this
is stronger than GVFlags::DSOLocal because the implied dso_local can be
leveraged for ELF -shared while default visibility dso_local has to be cleared
for ELF -shared).
Note: we don't have summaries for declarations, so for ELF if a declaration has
the most constraining visibility, the result visibility may not be that one.
Differential Revision: https://reviews.llvm.org/D92900
Craig Topper [Wed, 27 Jan 2021 18:21:47 +0000 (10:21 -0800)]
[FaultsMaps][llvm-objdump] Move FaultMapParser to Object/. Remove CodeGen dependency from llvm-objdump
FaultsMapParser lived in CodeGen and was forcing llvm-objdump to
link CodeGen and everything CodeGen depends on.
This was previously attempted in r240364 to fix a link failure.
The CodeGen dependency was independently added to fix the same
link failure, and that ended up being kept.
Removing the dependency seems like the correct layering for
llvm-objdump.
Reviewed By: MaskRay, jhenderson
Differential Revision: https://reviews.llvm.org/D95414
Siva Chandra [Wed, 27 Jan 2021 18:29:30 +0000 (10:29 -0800)]
[libc] Disable sqrtl_test on non-x86 platforms.
The added comment explains why it has been disabled for now. We will
enable back when we fix the problem.
Craig Topper [Wed, 27 Jan 2021 17:48:27 +0000 (09:48 -0800)]
[RISCV] Group the legal vector types into lists we can iterator over in the RISCVISelLowering constructor
Remove the RISCVVMVTs namespace because I don't think it provides
a lot of value. If we change the mappings we'd likely have to add
or remove things from the list anyway.
Add a wrapper around addRegisterClass that can determine the
register class from the fixed size of the type.
Reviewed By: frasercrmck, rogfer01
Differential Revision: https://reviews.llvm.org/D95491
Valentin Clement [Wed, 27 Jan 2021 18:18:27 +0000 (13:18 -0500)]
[flang][openacc] Allow multiple wait clauses
kernels loop and enter data had a too restrictive constraint for the wait clause.
The wait clause is allowed multiple times and not only once. This patch fix this problem.
Reviewed By: SouraVX
Differential Revision: https://reviews.llvm.org/D95469
Louis Dionne [Wed, 27 Jan 2021 18:08:24 +0000 (13:08 -0500)]
[libc++] Fix extern template test failing on Windows
See https://reviews.llvm.org/D94718#2521489 for details.
Florian Hahn [Wed, 27 Jan 2021 17:13:38 +0000 (17:13 +0000)]
[LoopUtils] Pass SCEVExpander instead SE to addRuntimeChecks.
This gives the user control over which expander to use, which in turn
allows the user to decide what to do with the expanded instructions.
Used in D75980.
Reviewed By: lebedev.ri
Differential Revision: https://reviews.llvm.org/D94295
Paul C. Anagnostopoulos [Sun, 24 Jan 2021 18:30:31 +0000 (13:30 -0500)]
[TableGen] [DetailedRecords] Print record name that is null string as ""
Differential Revision: https://reviews.llvm.org/D95312
Add a test for the backend.
Simon Pilgrim [Wed, 27 Jan 2021 15:21:26 +0000 (15:21 +0000)]
ExecutionDomainFix.cpp - use const refs in for-range loops. NFCI.
Avoid unnecessary copies. Reported by clang-tidy.
Simon Pilgrim [Wed, 27 Jan 2021 13:57:43 +0000 (13:57 +0000)]
[Support] CommandLine.cpp - Fix clang-tidy namespace comment warnings. NFCI.
Ensure namespace braces have the correct comment with them
Simon Pilgrim [Wed, 27 Jan 2021 12:02:49 +0000 (12:02 +0000)]
[Support] Fix clang-tidy auto warnings. NFCI.
Use auto pointer/reference to fix llvm-qualified-auto remarks.
Roman Lebedev [Wed, 27 Jan 2021 14:13:10 +0000 (17:13 +0300)]
[CodeGen] SafeStack: preserve DominatorTree if it is avaliable
While this is mostly NFC right now, because only ARM happens
to run this pass with DomTree available before it,
and required after it, more backends will be affected once
the SimplifyCFG's switch for domtree preservation is flipped,
and DwarfEHPrepare also preserves the domtree.
Roman Lebedev [Wed, 27 Jan 2021 14:07:43 +0000 (17:07 +0300)]
[NFC] StackProtector: be consistent and to initialize DominatorTreeWrapperPass
We already ask for it, so it might be good to ensure that it is
actually initialized before us. Doesn't seem to matter in practice though.
Jessica Clarke [Wed, 27 Jan 2021 15:28:59 +0000 (15:28 +0000)]
[compiler-rt] Support FreeBSD standalone (boot) environment
FreeBSD uses -Ddouble=jagged-little-pill -Dfloat=floaty-mcfloatface to
poison uses of floating point in its standalone environment. It also
deprecates machine/limits.h in favour of sys/limits.h and does not even
provide the former on newer architectures.
This is a cleaner reimplementation of equivalent patches in FreeBSD's
vendored copy of compiler-rt.
Reviewed By: dim
Differential Revision: https://reviews.llvm.org/D95264
Arthur O'Dwyer [Thu, 17 Dec 2020 05:26:18 +0000 (00:26 -0500)]
[libc++] [P0879] constexpr heap and partial_sort algorithms
Now the only ones we're still missing from P0879
are `sort` and `nth_element`.
Differential Revision: https://reviews.llvm.org/D93512
Tres Popp [Tue, 26 Jan 2021 10:18:24 +0000 (11:18 +0100)]
[mlir] Fold shape.eq %a, %a to true
Differential Revision: https://reviews.llvm.org/D95430
Simon Tatham [Wed, 27 Jan 2021 15:01:48 +0000 (15:01 +0000)]
[libcxx] Update include/__libcpp_version to match include/__config
https://reviews.llvm.org/rG5369517d20dd362a178a1b2d6c398d8898ee4620
bumped the version number in __config to 13000, causing a test failure
in libcxx/test/libcxx/libcpp_version.pass.cpp because now the two
don't match.
This is the only part of the post-release TODO in
libcxx/docs/Contributing.rst that wasn't done by that commit.
Valentin Clement [Wed, 27 Jan 2021 15:07:06 +0000 (10:07 -0500)]
[flang][openacc] Fix clause restriction for exit data directive
Restriction on clauses for the EXIT DATA directive were not fully correct.
This patch fixes the situation. The async, if and finalize clauses are allowed
only once.
Reviewed By: SouraVX
Differential Revision: https://reviews.llvm.org/D95470
Valentin Clement [Wed, 27 Jan 2021 15:06:18 +0000 (10:06 -0500)]
[flang][openacc] Fix clause restriction for host_data directive
Restriction on clauses for the HOST_DATA directive were not fully correct.
This patch fixes the situation. The if and if_present clauses are allowed
only once.
Reviewed By: SouraVX
Differential Revision: https://reviews.llvm.org/D95473
Freddy Ye [Wed, 27 Jan 2021 13:10:33 +0000 (21:10 +0800)]
[X86] merge "={eax}" and "~{eax}" into "=&eax" for MSInlineASM
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D94466
Kadir Cetinkaya [Fri, 22 Jan 2021 14:20:52 +0000 (15:20 +0100)]
[clangd] Treat "null" optional fields as missing
Clangd currently throws away any protocol messages whenever an optional
field has an unexpected type. This patch changes the behaviour to treat
`null` fields as missing.
This enables clangd to be more tolerant against small violations to the
LSP spec.
Fixes https://github.com/clangd/vscode-clangd/issues/134
Differential Revision: https://reviews.llvm.org/D95229
Giorgis Georgakoudis [Mon, 25 Jan 2021 17:48:12 +0000 (09:48 -0800)]
[OpenMP][Libomptarget] Fix check-libomptarget
The check-libomptarget fails when building with LLVM_ENABLE_PROJECTS. This is because test configuration misses the path to libomp.so and libLLVMSupport.so when time profiling is enabled (both libraries have the same path when building). This patch add the path to the configuration.
Reviewed By: vzakhari
Differential Revision: https://reviews.llvm.org/D95376
Giorgis Georgakoudis [Mon, 25 Jan 2021 22:10:50 +0000 (14:10 -0800)]
[OpenMP] Fix building using LLVM_ENABLE_RUNTIMES
Fix when time profiling is enabled.
Related to: D94855
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D95398
Sam McCall [Wed, 27 Jan 2021 14:32:05 +0000 (15:32 +0100)]
[clangd] Work around GCC bug 66735
Nico Weber [Wed, 27 Jan 2021 14:19:25 +0000 (09:19 -0500)]
Try to fix cl-options.c on bots were the default triple is non-x86 non-arm
llvmArchToWindowsSDKArch() returns "" for non-intel non-arm archs.
We're checking for "/fake/lib/" which is followed by the result
of that function -- but if that returns an empty string, then that
trailing slash isn't there. As fix, just explicitly pass a triple
that's intel or arm (I randomly chose aarch64). Since the test runs
with -###, that arch doesn't have to be in LLVM_TARGETS_TO_BUILD.
Nico Weber [Wed, 27 Jan 2021 13:52:23 +0000 (08:52 -0500)]
clang-cl: Prefer /vctoolsdir, /winsdkdir over LIB for link invocations
/vctoolsdir and /winsdkdir take precedence over the INCLUDE env var,
so they should also take precedence over LIB. It's not quite as neat
since LIB is still read by the linker and the linker just prefers
the -libpath: paths the driver now passes, but as long as all libraries
are present at /vctoolsdir and /winsdkdir, there's no harm in the linker
also looking at LIB later.
This fixes cl-options.c after
a5d85cbe on Windows when LIB is set.
Another way to fix the test would be to prefix the clang-cl
line with `env --unset=LIB`, but I think it's better to fix the
flag to work as expected instead of making the test work around
the surprising behavior that LIB being set causes clang-cl to
not pass -libpath: flags to the linker when /vctoolsdir and
/winsdkdir are used.
Jan Svoboda [Wed, 27 Jan 2021 13:50:09 +0000 (14:50 +0100)]
[clang][cli] Generate HeaderSearch options separately
This patch moves parsing of header search options from `generateCC1Options` to separate `GenerateHeaderSearchArgs`.
The round-trip algorithm in D94472 requires this separation to be able to run parsing and generating **only** for the options that need to be tested via round-tripping.
This also moves the `GENERATE_OPTION_WITH_MARSHALLING` to the top of the file, because other kinds of options will be generated in separate functions that will be spread throughout `CompilerInvocation.cpp` to be close to their parsing counterparts.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D94803
Jan Svoboda [Wed, 27 Jan 2021 13:34:09 +0000 (14:34 +0100)]
[clang][cli] Parse HeaderSearch options separately
This patch moves parsing of header search options from `parseSimpleArgs` back to `ParseHeaderSearchArgs` where they originally were.
The round-trip algorithm in D94472 requires this separation to be able to run parsing and generating **only** for the options that need to be tested via round-tripping.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D94802
Jan Svoboda [Wed, 27 Jan 2021 09:11:55 +0000 (10:11 +0100)]
[clang][cli] Port OpenMP-related LangOpts to marshalling system
Port some OpenMP-related language options to the marshalling system for automatic command line parsing and generation.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D95348
Florian Hahn [Wed, 27 Jan 2021 12:24:13 +0000 (12:24 +0000)]
[LoopUnswitch] Add test cases not partially unswitched due to cost.
This pre-commits tests for D95468.
Eugene Zhulenev [Wed, 27 Jan 2021 12:27:21 +0000 (04:27 -0800)]
[mlir:async] Fix deadlock in async runtime await-and-execute functions
`emplace???` functions running concurrently can set the ready flag and then pending awaiter will never be executed
Differential Revision: https://reviews.llvm.org/D95517
Raphael Isemann [Wed, 27 Jan 2021 12:33:47 +0000 (13:33 +0100)]
[lldb] Add move_iterator to supported template list
Identical to previous commits that just add a standard library template to the
supported template list and test it. Adding this rather obscure class to the
template list is mostly caused by the std::deque test unexpectedly referencing
this type when testing against newer libc++ versions on macOS.
Fixes TestQueueFromStdModule and TestQueueFromStdModule on macOS.
Fixes rdar://
73213589
Jeremy Morse [Wed, 27 Jan 2021 12:29:12 +0000 (12:29 +0000)]
[DWARF] Create subprogram's DIE in DISubprogram's unit
This is a fix for PR48790. Over in D70350, subprogram DIEs were permitted
to be shared between CUs. However, the creation of a subprogram DIE can be
triggered early, from other CUs. The subprogram definition is then created
in one CU, and when the function is actually emitted children are attached
to the subprogram that expect to be in another CU. This breaks internal CU
references in the children.
Fix this by redirecting the creation of subprogram DIEs in
getOrCreateContextDIE to the CU specified by it's DISubprogram definition.
This ensures that the subprogram DIE is always created in the correct CU.
Differential Revision: https://reviews.llvm.org/D94976
Anastasia Stulova [Wed, 27 Jan 2021 12:21:22 +0000 (12:21 +0000)]
[OpenCL][Docs] Moved info from UsersManual into OpenCLSupport.
Moved information detailing the implementation from UsersManual
into OpenCLSupport page as it is not relevant to the user's of
clang but primarily needed for the compiler developers.
Tags: #clang
Differential Revision: https://reviews.llvm.org/D95061
Artem Dergachev [Tue, 19 Jan 2021 21:31:14 +0000 (13:31 -0800)]
[analyzer] NFC: Introduce reusable bug category for "C++ move semantics".
Currently only used by MoveChecker but ideally all checkers
should have reusable categories.
Nico Weber [Tue, 26 Jan 2021 20:21:12 +0000 (15:21 -0500)]
clang-cl: Add /winsdkdir and /winsdkversion flags
These do for the Windows SDK path what D85998 did for
%VCToolsInstallDir% with /vctoolsdir: Offer a way to set them with an
explicit commandline switch.
With this (and /vctoolsdir), it's possible to compile and link
against hermetic vctools and winsdk directories with:
out/gn/bin/clang-cl win.c -fuse-ld=lld \
/vctoolsdir path/to/VC/Tools/MSVC/14.26.28801 \
/winsdkdir path/to/win_sdk
compared to a long list of -imsvc and /link /libpath: flags.
While here:
- Change the case of the "Include" folder inside the windows sdk
from "include" to "Include" to match on-disk case. Since the
Windows file system is case-insensitive this isn't a behavior
change, it's just a bit cleaner.
- Add libpath tests to the /vctoolsdir
- Add a FIXME about reading env vars for win sdk and ucrt sdk
if these flags aren't present, to match the VCToolsInstallDir
logic
We should also cache all these computed paths in the driver instead
of computing them every time they're queried, but that's for a future
patch.
It'd also be nice to invent a /winsysroot: flag that sets both
/vctoolsdir: and /winsdkdir: to some well-known subdirectory.
That's for a future patch as well.
Differential Revision: https://reviews.llvm.org/D95472
Mindong Chen [Tue, 26 Jan 2021 16:10:37 +0000 (00:10 +0800)]
[SCEV] Fix incorrect loop exit count analysis.
In computeLoadConstantCompareExitLimit, the addrec used to compute the
exit count should be from the loop which the exiting block belongs to.
Reviewed by: mkazantsev
Differential Revision: https://reviews.llvm.org/D92367
Mikhail Maltsev [Wed, 27 Jan 2021 11:21:01 +0000 (11:21 +0000)]
[clang][AST] Encapsulate DeclarationNameLoc, NFCI
This change makes `DeclarationNameLoc` a proper class and refactors its
users to use getter methods instead of accessing the members directly.
The change also makes `DeclarationNameLoc` immutable (i.e., it cannot
be modified once constructed).
Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D94596
Sjoerd Meijer [Fri, 8 Jan 2021 09:32:52 +0000 (09:32 +0000)]
[MachineLICM][MachineSink] Move SinkIntoLoop to MachineSink.
This moves SinkIntoLoop from MachineLICM to MachineSink. The motivation for
this work is that hoisting is a canonicalisation transformation, but we do not
really have a good story to sink instructions back if that is better, e.g. to
reduce live-ranges, register pressure and spilling. This has been discussed a
few times on the list, the latest thread is:
https://lists.llvm.org/pipermail/llvm-dev/2020-December/147184.html
There it was pointed out that we have the LoopSink IR pass, but that works on
IR, lacks register pressure informatiom, and is focused on profile guided
optimisations, and then we have MachineLICM and MachineSink that both perform
sinking. MachineLICM is more about hoisting and CSE'ing of hoisted
instructions. It also contained a very incomplete and disabled-by-default
SinkIntoLoop feature, which we now move to MachineSink.
Getting loop-sinking to do something useful is going to be at least a 3-step
approach:
1) This is just moving the code and is almost a NFC, but contains a bug fix.
This uses helper function `isLoopInvariant` that was factored out in D94082 and
added to MachineLoop.
2) A first functional change to make loop-sink a little bit less restrictive,
which it really is at the moment, is the change in D94308. This lets it do
more (alias) analysis using functions in MachineSink, making it a bit more
powerful. Nothing changes much: still off by default. But it shows that
MachineSink is a better home for this, and it starts using its functionality
like `hasStoreBetween`, and in the next step we can use `isProfitableToSinkTo`.
3) This is the going to be he interesting step: decision making when and how
many instructions to sink. This will be driven by the register pressure, and
deciding if reducing live-ranges and loop sinking will help in better
performance.
4) Once we are happy with 3), this should be enabled by default, that should be
the end goal of this exercise.
Differential Revision: https://reviews.llvm.org/D93694
David Green [Wed, 27 Jan 2021 10:38:32 +0000 (10:38 +0000)]
[AArch64] Add vector saturating add intrinsic costs
This adds sadd.sat, uadd.sat, ssub.sat and usub.sat costs for AArch64,
similar to how they were recently added for ARM.
Differential Revision: https://reviews.llvm.org/D95292
Fraser Cormack [Tue, 26 Jan 2021 11:36:56 +0000 (11:36 +0000)]
[RISCV] Fix a codegen crash in getSetCCResultType
This patch fixes some crashes coming from
`RISCVISelLowering::getSetCCResultType`, which would occasionally return
an EVT constructed from an invalid MVT, which has a null Type pointer.
The attached test shows this happening currently for some fixed-length
vectors, which hit this issue when the V extension was enabled, even
though they're not legal types under the V extension. The fix was also
pre-emptively extended to scalable vectors which can't be represented as
an MVT, even though a test case couldn't be found for them.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D95434
Faris Rehman [Wed, 27 Jan 2021 09:45:56 +0000 (09:45 +0000)]
[flang][driver] Report prescanning diags during syntax-only parsing
Ensure diagnostics from the prescanner are reported when running `flang-new -fsyntax-only` (i.e. only syntax parsing).
This keeps the diagnostics output of flang-new consistent with `f18 -fparse-only` when running the syntax parsing action, ParseSyntaxOnlyAction.
Summary of changes:
- Modify ParseSyntaxOnlyAction::ExecuteAction to report diagnostics
Differential Revision: https://reviews.llvm.org/D95220
Simon Pilgrim [Wed, 27 Jan 2021 10:14:54 +0000 (10:14 +0000)]
Fix "not all control paths return a value" warning. NFCI.
Jay Foad [Tue, 26 Jan 2021 17:45:41 +0000 (17:45 +0000)]
[AMDGPU] Write "GFX6-GFX9" instead of "GFX6-9" in docs
... and similarly for some other cases. This is for consistency and to
make it easier to search for mentions of a particular architecture.
Differential Revision: https://reviews.llvm.org/D95453
David Green [Wed, 27 Jan 2021 09:59:15 +0000 (09:59 +0000)]
[ARM] Add neon FP16 scalar_to_vector patterns.
This adds some simple fp16 scalar_to_vector patterns, preventing a
selection failure if this came up.
Differential Revision: https://reviews.llvm.org/D95427
Cassie Jones [Wed, 27 Jan 2021 08:04:18 +0000 (03:04 -0500)]
[Test][AArch64] Use named vregs in overflow legalization tests. NFC
Cassie Jones [Wed, 27 Jan 2021 09:36:12 +0000 (04:36 -0500)]
[AArch64][GlobalISel] Make G_SADDE and G_SSUBE legal
This makes G_SADDE and G_SSUBE legal in preparation for further work
legalizing overflowing operations. It's fine that they don't have an
instruction selector implementation yet, because G_UADDE and G_USUBE are
already legal on AArch64 without an instruction selector implementation. This
completes the set of G_[SU]{ADD,SUB}[EO] operations on AArch64.
Reviewed By: paquette
Differential Revision: https://reviews.llvm.org/D95325
Sven van Haastregt [Wed, 27 Jan 2021 09:30:26 +0000 (09:30 +0000)]
[clang] Fix signedness in vector bitcast evaluation
The included test case triggered a sign assertion on the result in
`Success()`. This was caused by the APSInt created for a bitcast
having its signedness bit inverted. The second APSInt constructor
argument is `isUnsigned`, so invert the result of
`isSignedIntegerType`.
Relanding this patch after reverting. The test case had to be updated
to be insensitive to 32/64-bit extractelement indices.
Differential Revision: https://reviews.llvm.org/D95135
Siva Chandra Reddy [Wed, 27 Jan 2021 09:18:58 +0000 (01:18 -0800)]
[libc][NFC] Use a end of list marker for cpu feature detection.
Without this, the array can end up being an empty array leading to
compiler failures.
AndreyChurbanov [Wed, 27 Jan 2021 09:18:15 +0000 (12:18 +0300)]
[OpenMP] libomp: fix build by clang-cl with vs2019
Problem reported by Joseph Shen <joseph.smeng@gmail.com>.
The patch changes *(&<atomic-var>) to (&<atomic-var>)->load().
Differential Revision: https://reviews.llvm.org/D95485
Jan Svoboda [Wed, 27 Jan 2021 08:00:16 +0000 (09:00 +0100)]
[clang][cli] Port LangOpts to marshalling system, pt.2
Port some miscellaneous language options to the marshalling system for oautomatic command line parsing and generation.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D95347
Nicolas Vasilache [Wed, 27 Jan 2021 08:06:40 +0000 (08:06 +0000)]
[mlir] Extend semantic of OffsetSizeAndStrideOpInterface.
OffsetSizeAndStrideOpInterface now have the ability to specify only a leading subset of
offset, sizes, strides operands/attributes.
The size of that leading subset must be limited by the corresponding entry in `getArrayAttrMaxRanks` to avoid overflows.
Missing trailing dimensions are assumed to span the whole range (i.e. [0 .. dim)).
This brings more natural semantics to slice-like op on top of subview and is a simplifies to removing all uses of SliceOp in dependent projects.
Differential revision: https://reviews.llvm.org/D95441
Alexey Bader [Wed, 27 Jan 2021 05:53:38 +0000 (08:53 +0300)]
Fix an error about implicit fallthrough during self build - new tag for ittapi.
A fix has been implemented in the ittap repo to fix an error about implicit fallthrough in a switch that was occurring during self build.
A new tag has been created for that fix. This is to update the tag.
Reviewed By: bader
Differential Revision: https://reviews.llvm.org/D95462
Patch by Zahira Ammarguellat.
Marek Kurdej [Wed, 27 Jan 2021 08:14:22 +0000 (09:14 +0100)]
[clang-format] Avoid considering include directive as a template closer.
This fixes a bug [[ http://llvm.org/PR48891 | PR48891 ]] introduced in D93839 where:
```
#include <stdint.h>
namespace rep {}
```
got formatted as
```
#include <stdint.h>
namespace rep {
}
```
Reviewed By: MyDeveloperDay, leonardchan
Differential Revision: https://reviews.llvm.org/D95479
Jan Svoboda [Wed, 27 Jan 2021 07:47:54 +0000 (08:47 +0100)]
[clang][cli] Port LangOpts to marshalling system, pt.1
Port some miscellaneous language options to the marshalling system for oautomatic command line parsing and generation.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D95346
MaheshRavishankar [Wed, 27 Jan 2021 07:21:33 +0000 (23:21 -0800)]
[mlir][Linalg] Add canonicalization for init_tensor -> subtensor op.
Differential Revision: https://reviews.llvm.org/D95305
Kazu Hirata [Wed, 27 Jan 2021 04:00:19 +0000 (20:00 -0800)]
[llvm-objdump] Use append_range (NFC)
Kazu Hirata [Wed, 27 Jan 2021 04:00:17 +0000 (20:00 -0800)]
[MemorySSA] Use ListSeparator (NFC)
Kazu Hirata [Wed, 27 Jan 2021 04:00:16 +0000 (20:00 -0800)]
[AMDGPU] Forward-declare TargetRegisterClass (NFC)
AMDGPUInstructionSelector.h needs TargetRegisterClass but relies on a
forward declaration of TargetRegisterClass in InstructionSelector.h.
This patch adds a forward declaration right in
AMDGPUInstructionSelector.h.
While we are at it, this patch removes the one in
InstructionSelector.h, where it is unnecessary.
Craig Topper [Wed, 27 Jan 2021 03:41:52 +0000 (19:41 -0800)]
[TableGen] Add isContradictoryImpl implementation to CheckCondCodeMatcher and CheckChild2CondCodeMatcher.
This enables better pattern factoring in the RISCV ISel table.
Tom Stellard [Wed, 27 Jan 2021 03:37:08 +0000 (19:37 -0800)]
Bump the trunk major version to 13
and clear the release notes.
Duncan P. N. Exon Smith [Wed, 27 Jan 2021 03:27:32 +0000 (19:27 -0800)]
Frontend: Use early returns in CompilerInstance::clearOutputFiles, NFC
Use early returns in `CompilerInstance::clearOutputFiles` to clarify the
logic, and rename `ec` to `EC` as a drive-by.
No functionality change.