Martin Storsjö [Sun, 2 Feb 2020 21:22:49 +0000 (23:22 +0200)]
[libcxx] [test] Fix detection of clang-cl when cross compiling
When cross compiling, the compiler tool doesn't have a .exe suffix.
Differential Revision: https://reviews.llvm.org/D98026
Petr Hosek [Fri, 5 Mar 2021 09:23:39 +0000 (01:23 -0800)]
[Fuchsia] Enable Polly for first stage as well
We want Polly enabled for both stages of the toolchain build.
Differential Revision: https://reviews.llvm.org/D98018
Vy Nguyen [Thu, 4 Mar 2021 21:58:21 +0000 (16:58 -0500)]
[lld-macho] Check platform and version when constructor ObjFile
Differential Revision: https://reviews.llvm.org/D97979
Alex Zinenko [Fri, 5 Mar 2021 18:19:06 +0000 (19:19 +0100)]
[mlir] Squash LLVM_ArmNeon dialect into ArmNeon
The two dialects are largely redundant. The former was introduced as a mirror
of the latter operating on LLVM dialect types. This is no longer necessary
since the LLVM dialect operates on built-in types. Combine the two dialects.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D98060
Jez Ng [Fri, 5 Mar 2021 22:22:57 +0000 (17:22 -0500)]
[lld-macho] Skip over symbols in un-parsed debug info sections
clang appears to emit symbols in `__debug_aranges`, at least
for arm64... in the examples I've seen, it doesn't seem like those
symbols are referenced outside of `__DWARF`, so I think they're safe to
ignore. But hopefully @clayborg can confirm.
Reviewed By: clayborg
Differential Revision: https://reviews.llvm.org/D98073
Jez Ng [Fri, 5 Mar 2021 22:22:56 +0000 (17:22 -0500)]
[lld-macho] Replace debug-info-related assert with FIXME
We'll need to properly handle object files with multiple source inputs
eventually, but remove the assert for now so we can successfully emit binaries
for testing.
Reviewed By: #lld-macho, smeenai
Differential Revision: https://reviews.llvm.org/D98067
Philip Reames [Fri, 5 Mar 2021 22:24:08 +0000 (14:24 -0800)]
[tests] precommit tests for phi handling in GVN
Aart Bik [Fri, 5 Mar 2021 17:32:15 +0000 (09:32 -0800)]
[mlir][vector] canonicalize unmasked gather/scatter/compress/expand directly into l/s
With the new vector.load/store operations, there is no need to go through
unmasked transfer operations (which will canonicalized to l/s anyway).
Reviewed By: dcaballe
Differential Revision: https://reviews.llvm.org/D98056
Diego Caballero [Fri, 5 Mar 2021 21:47:36 +0000 (23:47 +0200)]
[mlir] Add 'Skip' result to Operation visitor
This patch is a follow-up on D97217. It adds a new 'Skip' result to the Operation visitor
so that a callback can stop the ongoing visit of an operation/block/region and
continue visiting the next one without fully interrupting the walk. Skipping is
needed to be able to erase an operation/block in pre-order and do not continue
visiting the internals of that operation/block.
Related to the skipping mechanism, the patch also introduces the following changes:
* Added new TestIRVisitors pass with basic testing for the IR visitors.
* Fixed missing early increment ranges in visitor implementation.
* Updated documentation of walk methods to include erasure information and walk
order information.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D97820
Diego Caballero [Fri, 5 Mar 2021 21:46:56 +0000 (23:46 +0200)]
[mlir] Extend Operation visitor with pre-order traversal
This patch extends the Region, Block and Operation visitors to also support pre-order walks.
We introduce a new template argument that dictates the walk order (only pre-order and
post-order are supported for now). The default order for Regions, Blocks and Operations is
post-order. Mixed orders (e.g., Region/Block pre-order + Operation post-order) could easily
be implemented, as shown in NumberOfExecutions.cpp.
Reviewed By: rriddle, frgossen, bondhugula
Differential Revision: https://reviews.llvm.org/D97217
Diego Caballero [Fri, 5 Mar 2021 21:43:56 +0000 (23:43 +0200)]
[mlir][Affine][NFC] Return BlockArgument in AffineForOp::getInductionVar
This avoids unnecessary casts when a BlockArgument is required.
Reviewed By: bondhugula
Differential Revision: https://reviews.llvm.org/D97879
Emily Shi [Tue, 2 Mar 2021 00:33:20 +0000 (16:33 -0800)]
[ubsan] support print_module_map flag in standalone mode
Currently, `print_module_map` is only respected for ubsan if it is ran in tandem with asan. This patch adds support for this flag in standalone mode. I copied the pattern used to implement this for asan.
Also added a common `print_module_map` lit test for Darwin only. Since the print messages are different per platform, we need to write a regex test to cover them. This test is coming in a separate patch
rdar://
56135732
Reviewed By: vitalybuka, vsk, delcypher
Differential Revision: https://reviews.llvm.org/D97746
Martin Storsjö [Fri, 5 Mar 2021 12:46:30 +0000 (14:46 +0200)]
[libcxx] Don't add -Wall when building in MSVC mode
The MSVC -Wall (or /Wall) option maps (in clang-cl) to the GCC style
option -Weverything, which we don't really want. Instead use -W4 which
is the corresponding MSVC option.
This silences the build with clang-cl, which previously used to
output 100 warnings per translation unit.
Differential Revision: https://reviews.llvm.org/D98035
Sriraman Tallam [Fri, 5 Mar 2021 18:49:47 +0000 (10:49 -0800)]
Refactor -funique-internal-linakge-names implementation.
The option -funique-internal-linkage-names was added in D73307 and D78243 as a
LLVM early pass to insert a unique suffix to internal linkage functions and
vars. The unique suffix was the hash of the module path. However, we found
that this can be done more cleanly in clang early and the fixes that need to
be done later can be completely avoided. The fixes in particular are trying
to modify the DW_AT_linkage_name and finding the right place to insert the
pass.
This patch ressurects the original implementation proposed in D73307 which
was reviewed and then ditched in favor of the pass based approach.
Differential Revision: https://reviews.llvm.org/D96109
Nico Weber [Fri, 5 Mar 2021 21:28:38 +0000 (16:28 -0500)]
[lld/mac] tweak comment based on feedback on D98053
KareemErgawy-TomTom [Fri, 5 Mar 2021 20:45:09 +0000 (15:45 -0500)]
[MLIR][SPIRV] Rename `spv.undef` to `spv.Undef`.
To unify the naming scheme across all ops in the SPIR-V dialect, we are
moving from spv.camelCase to spv.CamelCase everywhere. For ops that
don't have a SPIR-V spec counterpart, we use spv.mlir.snake_case.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D98016
River Riddle [Fri, 5 Mar 2021 20:42:24 +0000 (12:42 -0800)]
[mlir][AsmPrinter] Don't use string comparison when filtering list attributes
In .mlir modules with larges amounts of attributes, e.g. a function with a larger number of argument attributes, the string comparison filtering greatly affects compile time. This revision switches to using a SmallDenseSet in these situations, resulting in over a 10x speed up in some situations.
Differential Revision: https://reviews.llvm.org/D97980
KareemErgawy-TomTom [Fri, 5 Mar 2021 20:35:35 +0000 (15:35 -0500)]
[MLIR][SPIRV] Rename `spv.loop` to `spv.mlir.loop`.
To unify the naming scheme across all ops in the SPIR-V dialect,
we are moving from spv.camelCase to spv.CamelCase everywhere.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D97918
Tim Wojtulewicz [Fri, 5 Mar 2021 20:30:47 +0000 (21:30 +0100)]
[clang-format] Rework Whitesmiths mode to use line-level values in UnwrappedLineParser
This commit removes the old way of handling Whitesmiths mode in favor of just setting the
levels during parsing and letting the formatter handle it from there. It requires a bit of
special-casing during the parsing, but ends up a bit cleaner than before. It also removes
some of switch/case unit tests that don't really make much sense when dealing with
Whitesmiths.
Differential Revision: https://reviews.llvm.org/D94500
Björn Schäpers [Thu, 4 Mar 2021 10:13:46 +0000 (11:13 +0100)]
[clang-format] Rename case sorting
As discussed in D95017 the names case sensitive and insensitive should
be switched.
This amends
a8105b3766e4.
Differential Revision: https://reviews.llvm.org/D97927
Björn Schäpers [Tue, 16 Feb 2021 09:12:22 +0000 (10:12 +0100)]
[clang-format] Suppress diagnostics on second parse
This amends
25f753c51e7b17bfca08155c1d777c5667110970.
When applying the child configurations we don't need any diagnostic,
because it was issued when first parsing them. So just drop everything
on the second parse.
Differential Revision: https://reviews.llvm.org/D96760
PremAnand Rao [Fri, 5 Mar 2021 20:05:41 +0000 (12:05 -0800)]
[OpenMP] Handle non-function context before checking for diagnostic
emission
Ensure that we are in a function declaration context before checking
the diagnostic emission status, to avoid dereferencing a NULL function
declaration.
Differential Revision: https://reviews.llvm.org/D97573
Jay Foad [Thu, 4 Mar 2021 10:56:36 +0000 (10:56 +0000)]
[AMDGPU] Restore the s_memtime instruction in gfx1030
gfx1030 added a new way to implement readcyclecounter using the
SHADER_CYCLES hardware register, but the s_memtime instruction still
exists, so the MC layer should still accept it and the
llvm.amdgcn.s.memtime intrinsic should still work.
Differential Revision: https://reviews.llvm.org/D97928
Valentin Clement [Fri, 5 Mar 2021 19:56:14 +0000 (14:56 -0500)]
[flang][fir] Add FIR Types parser diagnostic tests + cleanup
Add diagnostic tests for Types parsers and remove duplicated diagnostics handled by the MLIR
parser.
Reviewed By: schweitz
Differential Revision: https://reviews.llvm.org/D97643
Stella Laurenzo [Thu, 4 Mar 2021 23:08:56 +0000 (15:08 -0800)]
[mlir][linalg] Add linalg_opdsl tool first draft.
* Mostly imported from experimental repo as-is with cosmetic changes.
* Temporarily left out emission code (for building ops at runtime) to keep review size down.
* Documentation and lit tests added fresh.
* Sample op library that represents current Linalg named ops included.
Differential Revision: https://reviews.llvm.org/D97995
Martin Storsjö [Fri, 5 Mar 2021 12:47:31 +0000 (14:47 +0200)]
[libcxx] Apply pragma for silencing warning when building with clang-cl too
This silences warnings about unused functions (in an anonymous
namespace).
Differential Revision: https://reviews.llvm.org/D98036
Petr Hosek [Thu, 4 Mar 2021 06:40:11 +0000 (22:40 -0800)]
[runtimes] Use add_lit_testsuite to register lit testsuites
The runtimes build uses variables set by add_lit_testsuite to collect
testsuites from all the runtimes.
Differential Revision: https://reviews.llvm.org/D97913
Med Ismail Bennani [Fri, 5 Mar 2021 18:30:10 +0000 (18:30 +0000)]
[lldb/API] Add CommandInterpreter::{Get,Set}PrintErrors to SBAPI (NFC)
This patch exposes the getter and setter methods for the command
interpreter `print_errors` run option.
rdar://
74816984
Differential Revision: https://reviews.llvm.org/D98001
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Fri, 5 Mar 2021 18:30:48 +0000 (18:30 +0000)]
[lldb/Interpreter] Add `interpreter.repeat-previous-command` setting
This patch introduces a new interpreter setting to prevent LLDB from
re-executing the previous command when passing an empty command.
This can be very useful when performing actions that requires a long
time to complete.
To preserve the original behaviour, the setting defaults to `true`.
rdar://
74983516
Differential Revision: https://reviews.llvm.org/D97999
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Vy Nguyen [Thu, 4 Mar 2021 17:13:07 +0000 (12:13 -0500)]
Reland
293e8fa13d3f05e993771577a4c022deee5cbf6e
[llvm-exegesis] Disable the LBR check on AMD
https://bugs.llvm.org/show_bug.cgi?id=48918
The bug reported a hang (or very very slow runtime) on a Zen2. Unfortunately, we don't have the hardware right now to debug it and I was not able to reproduce the bug on a HSW.
Theory we've got is that the lbr-checking code could be confused on AMD.
Differential Revision: https://reviews.llvm.org/D97504
New change:
- Surround usages of x86 helper in llvm-exegesis/X86/Target.cpp with ifdef
- Fix bug which caused the caller of getVendorSignature to not have a copy of EAX that it expected.
Stella Laurenzo [Fri, 5 Mar 2021 04:46:47 +0000 (20:46 -0800)]
NFC: Glob all python sources in the MLIR Python bindings.
* Also switches to use symlinks vs copy as that enables edit-and-continue python development.
* Broken out of https://reviews.llvm.org/D97995 per request from reviewer.
Differential Revision: https://reviews.llvm.org/D98005
Philip Reames [Fri, 5 Mar 2021 18:16:12 +0000 (10:16 -0800)]
[gvn] CSE gc.relocates based on meaning, not spelling
The last two operands to a gc.relocate represent indices into the associated gc.statepoint's gc bundle list. (Effectively, gc.relocates are projections from the gc.statepoints multiple return values.)
We can use this to recognize when two gc.relocates are equivalent (and can be CSEd), even when the indices are non-equal. This is particular useful when considering a chain of multiple statepoints as it lets us eliminate all duplicate gc.relocates in a single pass.
Differential Revision: https://reviews.llvm.org/D97974
(Note: Part of the reviewed change was split and landed as
f352463a)
Philip Reames [Fri, 5 Mar 2021 18:07:17 +0000 (10:07 -0800)]
Mark gc.relocate and gc.result as readnone
For some reason, we had been marking gc.relocates as reading memory. There's no known reason for this, and I suspect it to be a legacy of very early implementation conservatism. gc.relocate and gc.result are simply projections of the return values from the associated statepoint. Note that the LangRef has always declared them readnone.
The EarlyCSE change is simply moving the special casing from readonly to readnone handling.
As noted by the test diffs, this does allow some additional CSE when relocates are separated by stores, but since we generate gc.relocates in batches, this is unlikely to help anything in practice.
This was reviewed as part of https://reviews.llvm.org/D97974, but split at reviewer request before landing. The motivation is to enable the GVN changes in that patch.
Philip Reames [Fri, 5 Mar 2021 18:04:07 +0000 (10:04 -0800)]
[tests] precommit some additional tests for D97974
Philip Reames [Fri, 5 Mar 2021 17:55:36 +0000 (09:55 -0800)]
[rs4gc] avoid insert base computation instructions for deopt uses
If we have a value live over a call which is used for deopt at the call, we know that the value must be a base pointer. We can avoid potentially inserting IR to materialize a base for this value.
In it's current form, this is mostly a compile time optimization. Building the base pointer graph (and then optimizing it away again) is a relatively expensive operation. We also sometimes end up with better codegen in practice - due to failures in optimizing away the inserted base pointer propogation - but those are optimization bugs we're fixing concurrently.
The alternative to this would be to extend the base pointer inference with the ability to generally reuse multiple-base input instructions (phis and selects). That's somewhat invasive and complicated, so we're defering it a bit longer.
Differential Revision: https://reviews.llvm.org/D97885
Zarko Todorovski [Fri, 5 Mar 2021 17:36:45 +0000 (12:36 -0500)]
[PowerPC][AIX] Enable the default AltiVec ABI on AIX
This patch adds support for the default AltiVec ABI for AIX.
Vector registers 20 through 31 are marked as reserved and cannot
be used in the default ABI. This patch adds handling for this case
and also remove the default AltiVec ABI errors.
Reviewed By: sfertile
Differential Revision: https://reviews.llvm.org/D96351
Martin Storsjö [Tue, 20 Oct 2020 18:23:41 +0000 (21:23 +0300)]
[libcxx] [test] Add an option to ssh.py for using a different temp path
If cross testing on Windows via WSL (at least with WSL 1), the Windows
executables can't be executed if they are in WSL specific directories
(like /tmp).
Differential Revision: https://reviews.llvm.org/D98028
Martin Storsjö [Thu, 15 Oct 2020 09:52:56 +0000 (12:52 +0300)]
[libcxx] [test] Fix path.decompose for windows
Add ifdefs to the test reference tables for cases where paths are
interpreted differently (paths that contain a root name).
Fix test assumptions regarding has_root_name() and is_absolute() and
add logic to verify the results of is_absolute() for the test cases in
the table.
Also add a testcase for the path "//net/", which seemed like an
omission.
Differential Revision: https://reviews.llvm.org/D89943
Andrzej Warzynski [Fri, 5 Mar 2021 17:36:09 +0000 (17:36 +0000)]
[Utils] Add missing attributes in syntax files
Added the following attributes to all LLVM syntax files:
* allocsize
* cold
* convergent
* dereferenceable_or_null
* hot
* inaccessiblemem_or_argmemonly
* inaccessiblememonly
* inalloca
* jumptable
* nocallback
* nocf_check
* noduplicate
* nofree
* nomerge
* noprofile
* nosync
* null_pointer_is_valid
* optforfuzzing
* preallocated
* safestack
* sanitize_hwaddress
* sanitize_memtag
* shadowcallstack
* speculative_load_hardening
* swifterror
* syncscope
* tailcc
* willreturn
I generated that list by comparing:
* Attributes.inc (generated from Attributes.td), and
* the Vim syntax file: llvm/utils/vim/syntax/llvm.vim
My original intention was to focus on the Vim syntax file. Since other
syntax files are also out-of-date, I added these attributes (if missing)
to other files as well. Note that in the other sytnax files (i.e. for
Emacs, VScode and Kate), there will be other attributes missing too.
I've also sorted all attributes alphabetically. Otherwise it's really
hard to automate adding new attributes. And I think that it was the
original intent to keep all of them ordered alphabetically.
Differential Revision: https://reviews.llvm.org/D97627
Nico Weber [Fri, 5 Mar 2021 16:17:08 +0000 (11:17 -0500)]
[mac/lld] Fix scale computation for vector ops in PAGEOFF12 relocations
With this, llvm-tblgen no longer tries and fails to allocate 7953 petabyte
when it runs during the build. Instead, `check-llvm` with lld/mac as host
linker now completes without any failures on an m1 mac.
This vector op handling code matches what happens in:
- ld64's OutputFile::applyFixUps() in OutputFile.cpp for kindStoreARM64PageOff12
- lld.ld64.darwinold's offset12KindFromInstruction() in
lld/lib/ReaderWriter/MachO/ArchHandler_arm64.cpp for offset12scale16
- RuntimeDyld's decodeAddend() in
llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOAArch64.h for
ARM64_RELOC_PAGEOFF12
Fixes PR49444.
Differential Revision: https://reviews.llvm.org/D98053
LemonBoy [Fri, 5 Mar 2021 15:46:10 +0000 (16:46 +0100)]
[LegalizeDAG] Implement promotion rules for SELECT_CC
Implement the promotion rule for SELECT_CC nodes by upcasting all the parameters and downcasting the result.
The AArch64 target makes use of this rule and, since it was not implemented, in some cases the instruction selector would hit an assertion upon encountering the illegal node.
This patch requires D97840, the included test cases hit both problems.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D97859
RamNalamothu [Fri, 5 Mar 2021 08:25:43 +0000 (13:55 +0530)]
[AMDGPU] Do not attempt sgpr spills to vgpr, when it is disabled
This covers a path missed in https://reviews.llvm.org/D95768.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D98013
Nico Weber [Fri, 5 Mar 2021 17:13:51 +0000 (12:13 -0500)]
[gn build] allow setting clang_base_path to a source-absolute path
With this, you can set `clang_base_path = "//out/gn1"` in `out/gn2/args.gn` and
the build in out/gn2 will use clang and lld from out/gn1.
Setting `clang_base_path` to an absolute path (with e.g.
`clang_base_path = getenv("HOME") + "/src/..."`) should behave as before.
Differential Revision: https://reviews.llvm.org/D97989
Nico Weber [Fri, 5 Mar 2021 17:12:56 +0000 (12:12 -0500)]
[lld/mac] fix clang-format violation from
0e319bd0be2
Jinsong Ji [Fri, 5 Mar 2021 14:25:35 +0000 (14:25 +0000)]
[PowerPC] Update Copy/Paste encodings according to ISA3.1
Copy-paste P9 insns were added back in 2016,
however, looks like the opcodes has changed in ISA3.1.
Reviewed By: #powerpc, nemanjai
Differential Revision: https://reviews.llvm.org/D97416
gbtozers [Wed, 30 Sep 2020 15:29:53 +0000 (16:29 +0100)]
[DebugInfo] Add DIArgList MD to store multple values in DbgVariableIntrinsics
This patch adds a new metadata node, DIArgList, which contains a list of SSA
values. This node is in many ways similar in function to the existing
ValueAsMetadata node, with the difference being that it tracks a list instead of
a single value. Internally, it uses ValueAsMetadata to track the individual
values, but there is also a reasonable amount of DIArgList-specific
value-tracking logic on top of that. Similar to ValueAsMetadata, it is a special
case in parsing and printing due to the fact that it requires a function state
(as it may reference function-local values).
This patch should not result in any immediate functional change; it allows for
DIArgLists to be parsed and printed, but debug variable intrinsics do not yet
recognize them as a valid argument (outside of parsing).
Differential Revision: https://reviews.llvm.org/D88175
Aart Bik [Fri, 5 Mar 2021 03:05:37 +0000 (19:05 -0800)]
[mlir][sparse] mask reduction update
Reduction updates should be masked, just like the load and stores.
Note that alternatively, we could use the fact that masked values are
zero of += updates and mask invariants to get this working but that
would not work for *= updates. Masking the update itself is cleanest.
This change also replaces the constant mask with a broadcast of "true"
since this constant folds much better for various folding patterns.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D98000
Simon Pilgrim [Fri, 5 Mar 2021 14:02:00 +0000 (14:02 +0000)]
[X86] X86ISelDAGToDAG.cpp - include cstdint instead of stdint.h NFCI.
Fixes clang-tidy warning
Simon Pilgrim [Fri, 5 Mar 2021 13:55:57 +0000 (13:55 +0000)]
[X86] X86DAGToDAGISel::Select - merge X86::TEST load bitsize checks. NFCI.
Simon Pilgrim [Fri, 5 Mar 2021 11:53:34 +0000 (11:53 +0000)]
Fix Wdocumentation unknown parameter warning. NFCI.
Nathan James [Fri, 5 Mar 2021 15:35:24 +0000 (15:35 +0000)]
[clang-tidy][NFC] Remove unsupported language version checks from vector
tlwilmar [Fri, 5 Mar 2021 15:21:39 +0000 (09:21 -0600)]
Added API for "masked" construct via two entrypoints: __kmpc_masked,
and __kmpc_end_masked. The "master" construct is deprecated. Changed
proc-bind keyword from "master" to "primary". Use of both master
construct and master as proc-bind keyword is still allowed, but
deprecated.
Remove references to "master" in comments and strings, and replace
with "primary" or "primary thread". Function names and variables were
not touched, nor were references to deprecated master construct. These
can be updated over time. No new code should refer to master.
Valentin Clement [Fri, 5 Mar 2021 15:20:51 +0000 (10:20 -0500)]
[flang][fir] Add diagnostic tests for FIR ops verifier
Add diagnostic tests with fir-opt for the diagnostics emitted by the ops verifier
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D97996
Nicolas Vasilache [Fri, 5 Mar 2021 15:08:10 +0000 (15:08 +0000)]
[mlir][Linalg] Fix order of dimensions in hoistPaddingOnTensors.
LemonBoy [Fri, 5 Mar 2021 15:01:45 +0000 (16:01 +0100)]
[AArch64] Legalize horizontal fmax/fmin reductions on f16 vectors
Expand the horizontal reduction during the instruction selection phase, but only if the target doesn't support the full fp16 instruction set.
Fixes https://bugs.llvm.org/show_bug.cgi?id=49401
Reviewed By: aemerson
Differential Revision: https://reviews.llvm.org/D97840
Christian Sigg [Fri, 5 Mar 2021 10:29:27 +0000 (11:29 +0100)]
[mlir] Make cuInit() call thread-safe.
Reviewed By: herhut
Differential Revision: https://reviews.llvm.org/D98024
Markus Böck [Fri, 5 Mar 2021 14:30:13 +0000 (15:30 +0100)]
[libcxxabi] Add LIBCXXABI_HAS_WIN32_THREAD_API build option
A few files in libc++abi make use of libc++ headers and a few of those use threading primitives provided by libc++. Since libc++ has multiple threading APIs it may be necessary to override auto-detection.
This patch adds the LIBCXXABI_HAS_WIN32_THREAD_API which does roughly the same as LIBCXXABI_HAS_PTHREAD_API and the similarly named LIBCXX_HAS_WIN32_THREAD_API from libc++. Instead of using autodetection it will force the use of win32 threads instead of pthreads in headers included from libc++.
Without this patch, libc++abi may depend on pthreads if present on the users build environment, even if win32 threading was selected for libc++.
Differential revision: https://reviews.llvm.org/D98021
Chen Zheng [Fri, 5 Mar 2021 14:20:48 +0000 (09:20 -0500)]
[XCOFF][DWARF] set default DWARF version to 3.
Reviewed By: jsji
Differential Revision: https://reviews.llvm.org/D98010
Nico Weber [Fri, 5 Mar 2021 14:16:55 +0000 (09:16 -0500)]
[lld/mac] minor formatting tweak to test just added in
0e319bd0be2
whitespace only, no behavior change
Nico Weber [Fri, 5 Mar 2021 14:07:58 +0000 (09:07 -0500)]
[lld/mac] ad-hoc sign dylibs and bundles on arm64 by default, support -(no_)adhoc_codesign flags
Previously, lld/mac only ad-hoc codesigned executables on arm64.
Matches ld64 behavior. Part of PR49443. Fixes 14 of 17 failures when running
check-llvm with lld as host linker on an M1 MBP.
Differential Revision: https://reviews.llvm.org/D97994
Ilya Leoshkevich [Fri, 5 Mar 2021 13:29:57 +0000 (14:29 +0100)]
[BPF] Add support for floats and doubles
Some BPF programs compiled on s390 fail to load, because s390
arch-specific linux headers contain float and double types. At the
moment there is no BTF_KIND for floats and doubles, so the release
version of LLVM ends up emitting type id 0 for them, which the
in-kernel verifier does not accept.
Introduce support for such types to libbpf by representing them using
the new BTF_KIND_FLOAT.
Reviewed By: yonghong-song
Differential Revision: https://reviews.llvm.org/D83289
Martin Boehme [Fri, 5 Mar 2021 12:16:00 +0000 (13:16 +0100)]
[clang-tidy] Use-after-move: Ignore moves inside a try_emplace.
We have no way to reason about the bool returned by try_emplace, so we
simply ignore any std::move()s that happen in a try_emplace argument.
A lot of the time in this situation, the code will be checking the
bool and doing something else if it turns out the value wasn't moved
into the map, and this has been causing false positives so far.
I don't currently have any intentions of handling "maybe move" functions
more generally.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D98034
Yaxun (Sam) Liu [Thu, 4 Mar 2021 18:15:54 +0000 (13:15 -0500)]
[HIP] do not use -munsafe-fp-atomics by default
A bug was introduced when adding -munsafe-fp-atomics.
By default it should be off.
Reviewed by: Artem Belevich
Differential Revision: https://reviews.llvm.org/D97967
Yaxun (Sam) Liu [Wed, 3 Mar 2021 21:42:57 +0000 (16:42 -0500)]
[HIP] do not use -mconstructor-aliases for device
Like nvptx and some other targets, -mconstructor-aliases does not work well with amdgpu,
therefore we disable it in the same approach.
Reviewed by: Artem Belevich
Differential Revision: https://reviews.llvm.org/D97959
Sven van Haastregt [Fri, 5 Mar 2021 13:43:30 +0000 (13:43 +0000)]
[OpenCL] Fix `mix` builtin overloads
`mix` is subtly different from `clamp`: in the overloads where the
last argument is a scalar, the second argument should be a gentype for
`mix`.
As scalars can be implicitly converted to vectors, this cannot be
caught in the Sema test. Hence adding a CodeGen test, where we can
verify the types using the mangled name.
David Spickett [Fri, 5 Mar 2021 11:13:58 +0000 (11:13 +0000)]
[clang-format] Improve clang-format-diff.py error message
Previously if we couldn't run the clang-format command
for some reason, you'd get an unhelpful error message:
```
OSError: [Errno 2] No such file or directory
```
Which doesn't tell you what was happening to cause this.
Catch the error and add the command we were attempting to run:
```
RuntimeError: Failed to run "<...>/clang-food <...>" - No such file or directory"
RuntimeError: Failed to run "<...>/clang-format <...>" - Permission denied"
```
Reviewed By: krasimir
Differential Revision: https://reviews.llvm.org/D98032
Stephen Tozer [Thu, 4 Mar 2021 12:02:28 +0000 (12:02 +0000)]
Reapply "[DebugInfo] Add new instruction and DIExpression operator for variadic debug values"
Rewrites test to use correct architecture triple; fixes incorrect
reference in SourceLevelDebugging doc; simplifies `spillReg` behaviour
so as to not be dependent on changes elsewhere in the patch stack.
This reverts commit
d2000b45d033c06dc7973f59909a0ad12887ff51.
Abhina Sreeskantharajan [Fri, 5 Mar 2021 12:20:51 +0000 (07:20 -0500)]
[test] Use host platform specific error message substitution in lit tests
This patch uses the errno python library to print out the correct error messages instead of hardcoding the error message per platform.
Reviewed By: jhenderson, ASDenysPetrov
Differential Revision: https://reviews.llvm.org/D97472
Sebastian Neubauer [Thu, 4 Mar 2021 09:39:42 +0000 (10:39 +0100)]
[AMDGPU] Keep skip branch for ds instructions
Same as other memory instructions, ds instructions add latency even if
exec is zero. Jumping over them if exec=0 is cheaper than executing
them.
With this change, the branch instruction that skips over a basic block
if exec=0 is not removed when the block contains a ds instruction.
Differential Revision: https://reviews.llvm.org/D97922
Jingu Kang [Thu, 4 Mar 2021 14:40:01 +0000 (14:40 +0000)]
[AArch64] Add missing intrinsics for vrnd
Simon Pilgrim [Fri, 5 Mar 2021 11:23:49 +0000 (11:23 +0000)]
Fix Wdocumentation unknown parameter warning. NFCI.
LLVM GN Syncbot [Fri, 5 Mar 2021 11:09:38 +0000 (11:09 +0000)]
[gn build] Port
a60d06d8b757
Simon Pilgrim [Fri, 5 Mar 2021 10:52:42 +0000 (10:52 +0000)]
Revert rG8198d83965ba4b9db6922b44ef3041030b2bac39: "[X86] Pass to transform amx intrinsics to scalar operation."
This reverts commit
8198d83965ba4b9db6922b44ef3041030b2bac39.due to buildbot breakages
Simon Pilgrim [Thu, 4 Mar 2021 18:53:07 +0000 (18:53 +0000)]
[X86] X86ISelLowering.cpp - try to use for-range loops. NFCI.
Andy Wingo [Thu, 4 Mar 2021 09:33:11 +0000 (10:33 +0100)]
[lld][WebAssembly] Allow element sections for nonzero table numbers
This patch fixes LLD to allow element sections for tables whose number
is nonzero. We also add a test for linking multiple tables, showing
that nonzero table numbers for the indirect function table,
user-declared imported tables, and local user table definitions work.
Differential Revision: https://reviews.llvm.org/D92321
Jann Horn [Fri, 5 Mar 2021 10:48:37 +0000 (11:48 +0100)]
[test] Fix new CodeGenPrepare test for non-X86 systems
The new test llvm/test/Transforms/CodeGenPrepare/remove-assume-block.ll
breaks on non-X86 machines. Change it to look like the existing test
llvm/test/Transforms/CodeGenPrepare/X86/delete-assume-dead-code.ll
to fix it.
Reviewed By: bkramer
Differential Revision: https://reviews.llvm.org/D97952
Andy Wingo [Thu, 4 Mar 2021 09:30:00 +0000 (10:30 +0100)]
[WebAssembly][yaml2obj][obj2yaml] Elem sections for nonzero tables
With reference types, tables can have non-zero table numbers. This
commit adds support for element sections against these tables.
Differential Revision: https://reviews.llvm.org/D97923
Jan Svoboda [Mon, 1 Mar 2021 17:52:15 +0000 (18:52 +0100)]
[clang][modules] Use extensible RTTI for ModuleFileExtension
Clang exposes an interface for extending the PCM/PCH file format: `ModuleFileExtension`.
Clang itself has only a single implementation of the interface: `TestModuleFileExtension` that can be instantiated via the `-ftest-module-file_extension=` command line argument (and is stored in `FrontendOptions::ModuleFileExtensions`).
Clients of the Clang library can extend the PCM/PCH file format by pushing an instance of their extension class to the `FrontendOptions::ModuleFileExtensions` vector.
When generating the `-ftest-module-file_extension=` command line argument from `FrontendOptions`, a downcast is used to distinguish between the Clang's testing extension and other (client) extensions.
This functionality is enabled by LLVM-style RTTI. However, this style of RTTI is hard to extend, as it requires patching Clang (adding new case to the `ModuleFileExtensionKind` enum).
This patch switches to the LLVM RTTI for open class hierarchies, which allows libClang users (e.g. Swift) to create implementations of `ModuleFileExtension` without patching Clang. (Documentation of the feature: https://llvm.org/docs/HowToSetUpLLVMStyleRTTI.html#rtti-for-open-class-hierarchies)
Reviewed By: artemcm
Differential Revision: https://reviews.llvm.org/D97702
Petar Avramovic [Thu, 4 Mar 2021 13:40:31 +0000 (14:40 +0100)]
Reland AMDGPU/GlobalISel: Combine zext(trunc x) to x after RegBankSelect
Recommit
bf5a5826504754788a8f1e3fec7a7dc95cda5782. Depends on
4c8fb7ddd6fa49258e0e9427e7345fb56ba522d4 which was reverted.
RegBankSelect creates zext and trunc when it selects banks for uniform i1.
Add zext_trunc_fold from generic combiner to post RegBankSelect combiner.
Differential Revision: https://reviews.llvm.org/D95432
Petar Avramovic [Thu, 4 Mar 2021 13:34:21 +0000 (14:34 +0100)]
Reland [GlobalISel] Combine zext(trunc x) to x
Recommit
4112299ee761a9b6a309c8ff4a7e75f8c8d8851b. Depends on
4c8fb7ddd6fa49258e0e9427e7345fb56ba522d4 which was reverted.
Combine zext(trunc x) to x when truncated bits are known to be zero.
Differential Revision: https://reviews.llvm.org/D96031
David Sherwood [Fri, 15 Jan 2021 14:12:50 +0000 (14:12 +0000)]
[SVE][LoopVectorize] Add support for extracting the last lane of a scalable vector
There are certain loops like this below:
for (int i = 0; i < n; i++) {
a[i] = b[i] + 1;
*inv = a[i];
}
that can only be vectorised if we are able to extract the last lane of the
vectorised form of 'a[i]'. For fixed width vectors this already works since
we know at compile time what the final lane is, however for scalable vectors
this is a different story. This patch adds support for extracting the last
lane from a scalable vector using a runtime determined lane value. I have
added support to VPIteration for runtime-determined lanes that still permit
the caching of values. I did this by introducing a new class called VPLane,
which describes the lane we're dealing with and provides interfaces to get
both the compile-time known lane and the runtime determined value. Whilst
doing this work I couldn't find any explicit tests for extracting the last
lane values of fixed width vectors so I added tests for both scalable and
fixed width vectors.
Differential Revision: https://reviews.llvm.org/D95139
Jan Svoboda [Fri, 26 Feb 2021 14:11:11 +0000 (15:11 +0100)]
[clang][cli] Fix generation of '-fvisibility' with regards to '-mignore-xcoff-visibility'
This patch fixes failure of the `CodeGen/aix-ignore-xcoff-visibility.cpp` test with command line round-trip.
The absence of '-fvisibility' implies '-mignore-xcoff-visibility'.
The problem is that when '-fvisibility default' is passed to -cc1, it isn't being generated. (This adheres to the principle that generation doesn't produce arguments with default values.)
However, that caused '-mignore-xcoff-visibility' to be implied in the generated command line (without '-fvisibility'), while it wasn't implied in the original command line (with '-fvisibility').
This patch fixes that by always generating '-fvisibility' and explains the situation in comment.
(The '-mginore-xcoff-visibility' option was added in D87451).
Reviewed By: Bigcheese
Differential Revision: https://reviews.llvm.org/D97552
Nicolas Vasilache [Thu, 4 Mar 2021 21:52:05 +0000 (21:52 +0000)]
[mlir][scf] Canonicalize scf.for last tensor iteration result.
Canonicalize the iter_args of an scf::ForOp that involve a tensor_load and
for which only the last loop iteration is actually visible outside of the
loop. The canonicalization looks for a pattern such as:
```
%t0 = ... : tensor_type
%0 = scf.for ... iter_args(%bb0 : %t0) -> (tensor_type) {
...
// %m is either tensor_to_memref(%bb00) or defined above the loop
%m... : memref_type
... // uses of %m with potential inplace updates
%new_tensor = tensor_load %m : memref_type
...
scf.yield %new_tensor : tensor_type
}
```
`%bb0` may have either 0 or 1 use. If it has 1 use it must be exactly a
`%m = tensor_to_memref %bb0` op that feeds into the yielded `tensor_load`
op.
If no aliasing write of `%new_tensor` occurs between tensor_load and yield
then the value %0 visible outside of the loop is the last `tensor_load`
produced in the loop.
For now, we approximate the absence of aliasing by only supporting the case
when the tensor_load is the operation immediately preceding the yield.
The canonicalization rewrites the pattern as:
```
// %m is either a tensor_to_memref or defined above
%m... : memref_type
scf.for ... { // no iter_args
... // uses of %m with potential inplace updates
}
%0 = tensor_load %m : memref_type
```
Differential revision: https://reviews.llvm.org/D97953
Marek Kurdej [Fri, 5 Mar 2021 08:19:39 +0000 (09:19 +0100)]
[libc++] [C++2b] [P1682] Add to_underlying.
* https://wg21.link/P1682
Reviewed By: ldionne, Mordante, #libc
Differential Revision: https://reviews.llvm.org/D97365
Sam McCall [Thu, 4 Mar 2021 15:21:01 +0000 (16:21 +0100)]
[clangd] Rename Module -> FeatureModule to avoid confusion. NFC
As pointed out in D96244, "Module" is already pretty overloaded to refer
to clang and llvm modules. (And clangd deals directly with the former).
FeatureModule is a bit of a mouthful but it's pretty self-descriptive.
I think it might be better than "Component" which doesn't really capture
the "common interface" aspect - it's IMO confusing to refer to
"components" but exclude CDB for example.
Differential Revision: https://reviews.llvm.org/D97950
James Henderson [Tue, 23 Feb 2021 15:32:45 +0000 (15:32 +0000)]
[llvm-objcopy] Fix crash for binary input files with non-ascii names
The code was using the standard isalnum function which doesn't handle
values outside the non-ascii range. Switching to using llvm::isAlnum
instead ensures we don't provoke undefined behaviour, which can in some
cases result in crashes.
Reviewed by: MaskRay
Differential Revision: https://reviews.llvm.org/D97663
James Henderson [Thu, 25 Feb 2021 15:50:48 +0000 (15:50 +0000)]
[llvm-objcopy][test] Fix test that could have passed spuriously
The test was showing that when --strip-unneeded is specified for an
executable, all the symbols are stripped. However, the set of symbols
used in the test would be stripped by --strip-unneeded for an ET_REL
object too. Fix this by adding additional symbols that aren't normally
stripped by --strip-unneeded.
Reviewed by: MaskRay
Differential Revision: https://reviews.llvm.org/D97664
Fangrui Song [Fri, 5 Mar 2021 08:52:25 +0000 (00:52 -0800)]
[profile][test] Pin Linux/instrprof-value-prof-warn.test to -fuse-ld=bfd
To work around https://sourceware.org/bugzilla/show_bug.cgi?id=27490
Martin Storsjö [Sat, 27 Feb 2021 14:09:49 +0000 (16:09 +0200)]
[libcxx] Map ERROR_BAD_PATHNAME to errc::no_such_file_or_directory on windows
Opening a path like \\server (without a trailing share name and
path) produces this error, while opening e.g. \\server\share
(for a nonexistent server/share) produces ERROR_BAD_NETPATH (which
already is mapped).
This happens in some testcases (in fs.op.proximate); as proximate()
calls weakly_canonical() on the inputs, weakly_canonical() checks
whether the path exists or not. When the error code wasn't recognized
(it mapped to errc::invalid_argument), the stat operation wasn't
conclusive and weakly_canonical() errored out. With the proper error
code mapping, this isn't considered an error, just a nonexistent
path, and weakly_canonical() can proceed.
This roughly matches what MS STL does - it doesn't have
ERROR_BAD_PATHNAME in its error code mapping table, but it
checks for this error code specifically in the return of their
correspondence of the stat function.
Differential Revision: https://reviews.llvm.org/D97619
Martin Storsjö [Sat, 27 Feb 2021 17:12:25 +0000 (19:12 +0200)]
[libcxx] Avoid infinite recursion in create_directories, if the root directory doesn't exist
Differential Revision: https://reviews.llvm.org/D97618
Martin Storsjö [Thu, 25 Feb 2021 22:41:35 +0000 (00:41 +0200)]
[libcxx] Implement semaphores for windows
Also add WIN32_LEAN_AND_MEAN before including windows.h, for consistency
with other sources.
Differential Revision: https://reviews.llvm.org/D97539
Rainer Orth [Fri, 5 Mar 2021 08:43:47 +0000 (09:43 +0100)]
[asan][test] Don't XFAIL Posix/unpoison-alternate-stack.cpp on Solaris
One ASan test currently `XPASS`es on Solaris:
AddressSanitizer-i386-sunos :: TestCases/Posix/unpoison-alternate-stack.cpp
It was originally `XFAIL`ed in D88501 <https://reviews.llvm.org/D88501>
because `longjmp` from a signal handled is highly unportable, warned
against in XPG7, and was not supported by Solaris `libc` at the time.
However, since then support has been added for some cases including the
current one, so the `XFAIL` can go.
Tested on `amd64-pc-solaris2.11` and `x86_64-pc-linux-gnu`.
Differential Revision: https://reviews.llvm.org/D97933
Rainer Orth [Fri, 5 Mar 2021 08:42:29 +0000 (09:42 +0100)]
[asan][test] Don't XFAIL Posix/no_asan_gen_globals.c on Solaris
One ASan test currently `XPASS`es on Solaris:
AddressSanitizer-i386-sunos :: TestCases/Posix/no_asan_gen_globals.c
It was originally `XFAIL`ed in D88218 <https://reviews.llvm.org/D88218>
because Solaris `ld`, unlike GNU `ld`, doesn't strip local labels. Since
then, the integrated assembler has stopped emitting those local labels, so
the difference becomes moot and the `XFAIL` can go.
Tested on `amd64-pc-solaris2.11` and `x86_64-pc-linux-gnu`.
Differential Revision: https://reviews.llvm.org/D97932
Luo, Yuanke [Thu, 4 Mar 2021 01:42:06 +0000 (09:42 +0800)]
[X86] Pass to transform amx intrinsics to scalar operation.
This pass runs in any situations but we skip it when it is not O0 and the
function doesn't have optnone attribute. With -O0, the def of shape to amx
intrinsics is near the amx intrinsics code. We are not able to find a
point which post-dominate all the shape and dominate all amx intrinsics.
To decouple the dependency of the shape, we transform amx intrinsics
to scalar operation, so that compiling doesn't fail. In long term, we
should improve fast register allocation to allocate amx register.
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D93594
Yang Fan [Fri, 5 Mar 2021 07:27:10 +0000 (15:27 +0800)]
[JITLink] Fix Wtype-limits gcc warning (NFC)
GCC warning:
```
In file included from /usr/include/c++/9/cassert:44,
from /home/vsts/work/1/llvm-project/llvm/include/llvm/ADT/BitVector.h:21,
from /home/vsts/work/1/llvm-project/llvm/include/llvm/Support/Program.h:17,
from /home/vsts/work/1/llvm-project/llvm/include/llvm/Support/Process.h:32,
from /home/vsts/work/1/llvm-project/llvm/lib/ExecutionEngine/JITLink/JITLinkMemoryManager.cpp:11:
/home/vsts/work/1/llvm-project/llvm/lib/ExecutionEngine/JITLink/JITLinkMemoryManager.cpp: In member function ‘virtual llvm::Expected<std::unique_ptr<llvm::jitlink::JITLinkMemoryManager::Allocation> > llvm::jitlink::InProcessMemoryManager::allocate(const llvm::jitlink::JITLinkDylib*, const SegmentsRequestMap&)’:
/home/vsts/work/1/llvm-project/llvm/lib/ExecutionEngine/JITLink/JITLinkMemoryManager.cpp:129:40: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
129 | assert(SlabRemaining.allocatedSize() >= 0 && "Mapping exceeds allocation");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
```
The return type of `allocatedSize()` is `size_t`, thus the expression
`SlabRemaining.allocatedSize() >= 0` always evaluate to `true`.
Craig Topper [Fri, 5 Mar 2021 07:05:30 +0000 (23:05 -0800)]
[SelectionDAG] Assert that operands to SelectionDAG::getNode are not DELETED_NODE to catch issues like PR49393 earlier.
I'm not sure this would catch all such issues, but it would catch some.
The problem for PR49393 was that we were holding a reference to a node that
wasn't connect edto the DAG across a function that could delete unused nodes. In
this particular case we managed to try to use the deleted node while it was in
the deleted state before its memory got recycled.
It could also happen that we delete the node, something allocates a new node
which recycles the memory. Then we try to use the reference we were holding and
it is now a completely different node with different valid opcode. This patch
would not catch that.
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D97969
Craig Topper [Fri, 5 Mar 2021 06:30:38 +0000 (22:30 -0800)]
[TargetLowering] Use HandleSDNodes to prevent nodes from being deleted by recursive calls in getNegatedExpression.
For binary or ternary ops we call getNegatedExpression multiple
times and then compare costs. While we're doing this we need to
hold a node from the first call across the second call, but its
not yet attached to the DAG. Its possible the second call creates
an identical node and then decides it didn't need it so will try
to delete it if it has no uses. This can cause a reference to the
node we're holding further up the call stack to become invalidated.
To prevent this, we can use a HandleSDNode to artifically give
the node a use without connecting it to the DAG.
I've used a std::list of HandleSDNodes so we can create handles
only when we have a node to hold. HandleSDNode does not have
default constructor and cannot be copied or moved.
Fixes PR49393.
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D97914
Fangrui Song [Fri, 5 Mar 2021 06:44:37 +0000 (22:44 -0800)]
[Driver][test] Fix ClangDriverTest
Fangrui Song [Fri, 5 Mar 2021 06:31:05 +0000 (22:31 -0800)]
[Driver] Switch Exherbo/Alpine/Arch Linux to /etc/os-release
Christopher Di Bella [Fri, 5 Mar 2021 06:07:45 +0000 (22:07 -0800)]
[libcxx] fixes up some [concepts]-related code
* moves `std::copy_constructible` so it comes before
`std::equality_comparable_with`
* replaces a few uses of `auto`