Roman Lebedev [Fri, 2 Jul 2021 08:48:44 +0000 (11:48 +0300)]
Revert "[WebAssembly] Implementation of global.get/set for reftypes in LLVM IR"
This reverts commit
4facbf213c51e4add2e8c19b08d5e58ad71c72de.
```
********************
FAIL: LLVM :: CodeGen/WebAssembly/funcref-call.ll (44466 of 44468)
******************** TEST 'LLVM :: CodeGen/WebAssembly/funcref-call.ll' FAILED ********************
Script:
--
: 'RUN: at line 1'; /builddirs/llvm-project/build-Clang12/bin/llc < /repositories/llvm-project/llvm/test/CodeGen/WebAssembly/funcref-call.ll --mtriple=wasm32-unknown-unknown -asm-verbose=false -mattr=+reference-types | /builddirs/llvm-project/build-Clang12/bin/FileCheck /repositories/llvm-project/llvm/test/CodeGen/WebAssembly/funcref-call.ll
--
Exit Code: 2
Command Output (stderr):
--
llc: /repositories/llvm-project/llvm/include/llvm/Support/LowLevelTypeImpl.h:44: static llvm::LLT llvm::LLT::scalar(unsigned int): Assertion `SizeInBits > 0 && "invalid scalar size"' failed.
```
Michał Górny [Sun, 11 Apr 2021 10:31:06 +0000 (12:31 +0200)]
[lldb] [gdb-remote server] Support selecting process via Hg
Support using the extended thread-id syntax with Hg packet to select
a subprocess. This makes it possible to start providing support for
running some of the debugger packets against another subprocesses.
Differential Revision: https://reviews.llvm.org/D100261
Balázs Kéri [Fri, 2 Jul 2021 07:08:54 +0000 (09:08 +0200)]
[clang][AST] Add support for BindingDecl to ASTImporter.
Reviewed By: martong
Differential Revision: https://reviews.llvm.org/D102492
Sam McCall [Fri, 2 Jul 2021 07:48:58 +0000 (09:48 +0200)]
[clangd] CMake: express -Iclangd/ at top level and inherit
For files directly under clangd/, -Iclang-tools-extra/clangd (and the
equivalent for generated files) are not required, as CMake/the compiler puts
these directories on the include path by default.
However this means each subdirectory needs to
include_directories(.. ${CMAKE_CURRENT_BINARY_DIR}/..) etc, and this
proved annoying and error-prone to maintain and debug.
Since include_directories is inherited by subdirectories, we just
configure this explicitly at the top level instead.
Paulo Matos [Thu, 10 Jun 2021 08:02:10 +0000 (10:02 +0200)]
[WebAssembly] Implementation of global.get/set for reftypes in LLVM IR
Reland of
31859f896.
This change implements new DAG notes GLOBAL_GET/GLOBAL_SET, and
lowering methods for load and stores of reference types from IR
globals. Once the lowering creates the new nodes, tablegen pattern
matches those and converts them to Wasm global.get/set.
Differential Revision: https://reviews.llvm.org/D104797
Tobias Gysi [Fri, 2 Jul 2021 07:20:09 +0000 (07:20 +0000)]
[mlir][linalg][python] Introduce python integration test folder.
Introduce an integration test folder in the test/python subfolder and move the opsrun.py test into the newly created folder. The test verifies named operations end-to-end using both the yaml and the python path.
Differential Revision: https://reviews.llvm.org/D105276
Tobias Gysi [Fri, 2 Jul 2021 06:45:34 +0000 (06:45 +0000)]
[mlir][linalg][python] Add max operation in OpDSL
Add the max operation to the OpDSL and introduce a max pooling operation to test the implementation. As MLIR has no builtin max operation, the max function is lowered to a compare and select pair.
Differential Revision: https://reviews.llvm.org/D105203
Sam McCall [Fri, 2 Jul 2021 06:55:34 +0000 (08:55 +0200)]
[clangd] Add some more missing include dirs for completeness
Martin Storsjö [Thu, 17 Jun 2021 18:51:37 +0000 (21:51 +0300)]
[LLD] [COFF] Fix up missing stdcall decorations in MinGW mode
If linking directly against a DLL without an import library, the
DLL export symbols might not contain stdcall decorations.
If we have an undefined symbol with decoration, and we happen to have
a matching undecorated symbol (which either is lazy and can be loaded,
or already defined), then alias it against that instead.
This matches what's done in reverse, when we have a def file
declaring to export a symbol without decoration, but we only have
a defined decorated symbol. In that case we do a fuzzy match
(SymbolTable::findMangle). This case is more straightforward; if we
have a decorated undefined symbol, just strip the decoration and look
for the corresponding undecorated symbol name.
Add warnings and options for either silencing the warning or disabling
the whole feature, corresponding to how ld.bfd does it.
(This feature works for any symbol decoration mismatch, not only when
linking against a DLL directly; ld.bfd also tolerates it anywhere,
and also fixes up mismatches in the other direction, like
SymbolTable::findMangle, for any symbol, not only exports. But in
practice, at least for lld, it would primarily end up used for linking
against DLLs.)
Differential Revision: https://reviews.llvm.org/D104532
Martin Storsjö [Thu, 17 Jun 2021 12:57:20 +0000 (15:57 +0300)]
[LLD] [MinGW] Allow linking to DLLs directly
As the COFF linker is capable of linking directly against a DLL now
(after D104530, as long as it is running in mingw mode), don't error
out here but successfully load libraries specified with "-l" from DLLs
if that's what ld.bfd would have matched.
Differential Revision: https://reviews.llvm.org/D104531
Martin Storsjö [Wed, 16 Jun 2021 13:59:46 +0000 (16:59 +0300)]
[LLD] [COFF] Support linking directly against DLLs in MinGW mode
GNU ld.bfd supports linking directly against DLLs without using an
import library, and some projects have picked up on this habit.
(There's no one single unsurmountable issue with using import
libraries, but this is a regularly surfacing missing feature.)
As long as one is linking by name (instead of by ordinal), the DLL
export table contains most of the information needed. (One can
inspect what section a symbol points at, to see if it's a function
or data symbol. The practical implementation of this loops over all
sections for each symbol, but as long as they're not very many, that
should hopefully be tolerable performance wise.)
One exception where the information in the DLL isn't entirely enough
is on i386 with stdcall functions; depending on how they're done,
the exported function name can be a plain undecorated name, while
the import library would contain the full decorated symbol name. This
issue is addressed separately in a different patch.
This is implemented mimicing the structure of a regular import library,
with one InputFile corresponding to the static archive that just adds
lazy symbols, which then are fetched when they are needed. When such
a symbol is fetched, we synthesize a coff_import_header structure
in memory and create a regular ImportFile out of it.
The implementation could be even smaller by just creating ImportFiles
for every symbol available immediately, but that would have the
drawback of actually ending up importing all symbols unless running
with GC enabled (and mingw mode defaults to having it disabled for
historical reasons).
Differential Revision: https://reviews.llvm.org/D104530
Sam McCall [Fri, 2 Jul 2021 06:47:46 +0000 (08:47 +0200)]
[clangd] Fix XPC build due to missing include path
(Tentative, untested as I don't have a mac)
Douglas Yung [Fri, 2 Jul 2021 06:08:48 +0000 (23:08 -0700)]
Relax newly added opcode check to check only for a number instead of a specific opcode.
Vitaly Buka [Fri, 2 Jul 2021 04:40:04 +0000 (21:40 -0700)]
[scudo] Fix test on aarch64 without MTE
Evgeniy Brevnov [Fri, 2 Jul 2021 02:59:06 +0000 (09:59 +0700)]
[NFC][DSE]Change 'do-while' to 'for' loop to simplify code structure
With 'for' loop there is is a single place where 'Current' is adjusted. It helps to avoid copy paste and makes a bit easy to understand overall loop controll flow.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D101044
Fangrui Song [Fri, 2 Jul 2021 02:43:49 +0000 (19:43 -0700)]
[llvm-symbolizer] Move setGroupedShortOptions and don't ignore case
setGroupedShortOptions in the ctor seems more popular.
Lang Hames [Fri, 2 Jul 2021 02:37:22 +0000 (12:37 +1000)]
[ORC] Rename SPSTargetAddress to SPSExecutorAddress.
Also removes SPSTagTargetAddress, which was accidentally introduced at some
point (and never used).
Craig Topper [Fri, 2 Jul 2021 00:08:23 +0000 (17:08 -0700)]
[ScalarizeMaskedMemIntrin][SelectionDAGBuilder] Use the element type to calculate alignment for gather/scatter when alignment operand is 0.
Previously we used the vector type, but we're loading/storing
invididual elements so I think only element alignment should matter.
Noticed while looking at the code for something else so I don't
have a test case.
Differential Revision: https://reviews.llvm.org/D105220
Richard Smith [Fri, 2 Jul 2021 01:43:01 +0000 (18:43 -0700)]
Support for merging UsingPackDecls across modules.
Fixes a false-positive error if the same std::variant<...> type is
instantiated across multiple modules.
Jez Ng [Fri, 2 Jul 2021 00:33:55 +0000 (20:33 -0400)]
[lld-macho] Factor out common InputSection members
We have been creating many ConcatInputSections with identical values due
to .subsections_via_symbols. This diff factors out the identical values
into a Shared struct, to reduce memory consumption and make copying
cheaper.
I also changed `callSiteCount` from a uint32_t to a 31-bit field to save an
extra word.
All in all, this takes InputSection from 120 to 72 bytes (and
ConcatInputSection from 160 to 112 bytes), i.e. 30% size reduction in
ConcatInputSection.
Numbers for linking chromium_framework on my 3.2 GHz 16-Core Intel Xeon W:
N Min Max Median Avg Stddev
x 20 4.14 4.24 4.18 4.183 0.
027548999
+ 20 4.04 4.11 4.075 4.0775 0.
018027756
Difference at 95.0% confidence
-0.1055 +/- 0.0149005
-2.52211% +/- 0.356215%
(Student's t, pooled s = 0.0232803)
Reviewed By: #lld-macho, thakis
Differential Revision: https://reviews.llvm.org/D105305
Jez Ng [Sun, 27 Jun 2021 19:31:34 +0000 (15:31 -0400)]
[lld-macho][nfc] Remove unnecessary vertical spacing
This makes NonLazyPointerSectionBase's style more in line with the rest
of the classes in its file.
Jez Ng [Fri, 2 Jul 2021 00:33:44 +0000 (20:33 -0400)]
[lld-macho] Deduplicate CFStrings
`__cfstring` is a special literal section, so instead of breaking it up
at symbol boundaries, we break it up at fixed-width boundaries (since
each literal is the same size). Symbols can only occur at one of those
boundaries, so this is strictly more powerful than
`.subsections_via_symbols`.
With that in place, we then run the section through ICF.
This change is about perf-neutral when linking chromium_framework.
Reviewed By: #lld-macho, gkm
Differential Revision: https://reviews.llvm.org/D105045
Jez Ng [Fri, 2 Jul 2021 00:33:42 +0000 (20:33 -0400)]
[lld-macho] Move ICF earlier to avoid emitting redundant binds
This is a pretty big refactoring diff, so here are the motivations:
Previously, ICF ran after scanRelocations(), where we emitting
bind/rebase opcodes etc. So we had a bunch of redundant leftovers after
ICF. Having ICF run before Writer seems like a better design, and is
what LLD-ELF does, so this diff refactors it accordingly.
However, ICF had two dependencies on things occurring in Writer: 1) it
needs literals to be deduplicated beforehand and 2) it needs to know
which functions have unwind info, which was being handled by
`UnwindInfoSection::prepareRelocations()`.
In order to do literal deduplication earlier, we need to add literal
input sections to their corresponding output sections. So instead of
putting all input sections into the big `inputSections` vector, and then
filtering them by type later on, I've changed things so that literal
sections get added directly to their output sections during the 'gather'
phase. Likewise for compact unwind sections -- they get added directly
to the UnwindInfoSection now. This latter change is not strictly
necessary, but makes it easier for ICF to determine which functions have
unwind info.
Adding literal sections directly to their output sections means that we
can no longer determine `inputOrder` from iterating over
`inputSections`. Instead, we store that order explicitly on
InputSection. Bloating the size of InputSection for this purpose would
be unfortunate -- but LLD-ELF has already solved this problem: it reuses
`outSecOff` to store this order value.
One downside of this refactor is that we now make an additional pass
over the unwind info relocations to figure out which functions have
unwind info, since want to know that before `processRelocations()`. I've
made sure to run that extra loop only if ICF is enabled, so there should
be no overhead in non-optimizing runs of the linker.
The upside of all this is that the `inputSections` vector now contains
only ConcatInputSections that are destined for ConcatOutputSections, so
we can clean up a bunch of code that just existed to filter out other
elements from that vector.
I will test for the lack of redundant binds/rebases in the upcoming
cfstring deduplication diff. While binds/rebases can also happen in the
regular `.text` section, they're more common in `.data` sections, so it
seems more natural to test it that way.
This change is perf-neutral when linking chromium_framework.
Reviewed By: oontvoo
Differential Revision: https://reviews.llvm.org/D105044
Matthias Springer [Fri, 2 Jul 2021 00:44:41 +0000 (09:44 +0900)]
[mlir] Move BufferizeDimOp to Tensor/Transforms/Bufferize.cpp
Differential Revision: https://reviews.llvm.org/D105256
Rob Suderman [Fri, 2 Jul 2021 00:44:52 +0000 (17:44 -0700)]
[mlir][tosa] Update Bazel files for TOSA pass changes
There were some missing bazel dependencies for the Tosa dialect.
Added these deps.
Reviewed By: GMNGeoffrey
Differential Revision: https://reviews.llvm.org/D105326
Rob Suderman [Fri, 2 Jul 2021 00:04:37 +0000 (17:04 -0700)]
[mlir][tosa] Include TosaDialect as include in tosa PassDetail.h
Tosa's PassDetail.h may be used in non-TOSA transforms. Include
TosaDialect to avoid transient dependency.
Differential Revision: https://reviews.llvm.org/D105324
Matt Arsenault [Fri, 11 Jun 2021 16:02:38 +0000 (12:02 -0400)]
Mips/GlobalISel: Use accurate memory LLTs
Akira Hatanaka [Fri, 2 Jul 2021 00:02:45 +0000 (17:02 -0700)]
Precommit test cases in https://reviews.llvm.org/D104953
Rob Suderman [Thu, 1 Jul 2021 23:35:49 +0000 (16:35 -0700)]
[mlir][tosa] Added missing includes on PassDetails.h
Includes were missing in the PassDetails.h that cause downstream failures
on TOSA passes.
Differential Revision: https://reviews.llvm.org/D105323
Jessica Paquette [Thu, 1 Jul 2021 20:32:07 +0000 (13:32 -0700)]
[GlobalISel] Translate <1 x N> getelementptrs to scalar G_PTR_ADDs
In `IRTranslator::translateGetElementPtr`, when we run into a vector gep with
some scalar operands, we try to normalize those operands using
`buildSplatVector`.
This is fine except for when the getelementptr has a <1 x N> type. In that case
it is treated as a scalar. If we run into one of these then every call to
```
// With VectorWidth = 1
LLT::fixed_vector(VectorWidth, PtrTy)
```
will assert.
Here's an example (equivalent to the added testcase):
https://godbolt.org/z/hGsTnMYdW
To get around this, this patch adds a variable, `WantSplatVector`, which
is true when our vector type ought to actually be represented using a vector.
When it's false, we'll translate as a scalar. This checks if `VectorWidth > 1`.
This fixes this bug:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=35496
Differential Revision: https://reviews.llvm.org/D105316
Rob Suderman [Thu, 17 Jun 2021 22:58:37 +0000 (15:58 -0700)]
[mlir][tosa] Add tosa shape inference with InferReturnTypeComponent
Added InferReturnTypeComponents for NAry operations, reshape, and reverse.
With the additional tosa-infer-shapes pass, we can infer/propagate shapes
across a set of TOSA operations. Current version does not modify the
FuncOp type by inserting an unrealized conversion cast prior to any new
non-matchin returns.
Differential Revision: https://reviews.llvm.org/D105312
Eli Friedman [Thu, 1 Jul 2021 22:35:48 +0000 (15:35 -0700)]
[AArch64] Optimize SVE bitcasts of unpacked types.
Target-independent code only knows how to spill to the stack; instead,
use AArch64ISD::REINTERPRET_CAST.
Differential Revision: https://reviews.llvm.org/D104573
LLVM GN Syncbot [Thu, 1 Jul 2021 22:26:09 +0000 (22:26 +0000)]
[gn build] Port
33a7b4d9d8e6
Petr Hosek [Wed, 30 Jun 2021 07:19:04 +0000 (00:19 -0700)]
[InstrProfiling] Use external weak reference for bias variable
We need the compiler generated variable to override the weak symbol of
the same name inside the profile runtime, but using LinkOnceODRLinkage
results in weak symbol being emitted which leads to an issue where the
linker might choose either of the weak symbols potentially disabling the
runtime counter relocation.
This change replaces the use of weak definition inside the runtime with
an external weak reference to address the issue. We also place the
compiler generated symbol inside a COMDAT group so dead definition can
be garbage collected by the linker.
Differential Revision: https://reviews.llvm.org/D105176
Jon Roelofs [Thu, 1 Jul 2021 15:25:30 +0000 (08:25 -0700)]
[GISel] Print better error messages for missing Combiner Observer calls
Differential revision: https://reviews.llvm.org/D105290
Mehdi Amini [Thu, 1 Jul 2021 20:57:53 +0000 (20:57 +0000)]
Update MLIRContext to allow injecting an external ThreadPool (NFC)
The context can be created with threading disabled, to avoid creating a thread pool
that may be destroyed when injecting another one later.
Differential Revision: https://reviews.llvm.org/D105302
Arthur O'Dwyer [Thu, 1 Jul 2021 22:12:30 +0000 (18:12 -0400)]
[libc++] IWYU <__utility/pair.h> in <__functional/hash.h>. NFCI.
This was the only thing preventing any one of our detail headers from
compiling on its own.
Hansang Bae [Wed, 30 Jun 2021 19:01:04 +0000 (14:01 -0500)]
[OpenMP] Fix a few issues with hidden helper task
This patch includes the following changes to address a few issues when
using hidden helper task.
- Assertion is triggered when there are inadvertent calls to hidden
helper functions on non-Linux OS
- Added deinit code in __kmp_internal_end_library function to fix random
shutdown crashes
- Moved task data access into the lock-guarded region in __kmp_push_task
Differential Revision: https://reviews.llvm.org/D105308
zoecarver [Thu, 1 Jul 2021 18:58:54 +0000 (11:58 -0700)]
[libcxx][ranges] Implement indirectly_swappable.
Differential Revision: https://reviews.llvm.org/D105304
Sanjay Patel [Thu, 1 Jul 2021 21:30:04 +0000 (17:30 -0400)]
[InstSimplify] do not propagate poison from select arm to icmp user
This is the cause of the miscompile in:
https://llvm.org/PR50944
The problem has likely existed for some time, but it was made visible with:
5af8bacc94024 ( D104661 )
handleOtherCmpSelSimplifications() assumed it can convert select of
constants to bool logic ops, but that does not work with poison.
We had a very similar construct in InstCombine, so the fix here
mimics the fix there.
The bug is in instsimplify, but I'm not sure how to reproduce it outside of
instcombine. The reason this is visible in instcombine is because we have a
hack (FIXME) to bypass simplification of a select when it has an icmp user:
https://github.com/llvm/llvm-project/blob/
955f12589940634acc6c9901e8b25534808f691c/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp#L2632
So we get to an unusual case where we are trying to simplify an instruction
that has an operand that would have already simplified if we had processed
it in normal order.
Differential Revision: https://reviews.llvm.org/D105298
Sanjay Patel [Thu, 1 Jul 2021 17:36:46 +0000 (13:36 -0400)]
[InstCombine][test] add tests for icmp simplify miscompile (PR50944); NFC
Caitlyn Cano [Thu, 1 Jul 2021 20:41:51 +0000 (20:41 +0000)]
[libc] Add minimal Windows config
A README file with procedure for building/testing LLVM libc on Windows
has also been added.
Reviewed By: sivachandra, aeubanks
Differential Revision: https://reviews.llvm.org/D105231
Daniel Rodríguez Troitiño [Thu, 1 Jul 2021 20:37:48 +0000 (13:37 -0700)]
[cmake] Invoke strip without -l and with non-grouped flags.
`llvm-strip` does not support `-l`. Apple's `strip` supports `-l`, but
it is not documented, and the latest code doesn't seem to do anything
meaningful. From the old source code drops it seems that `-l` was added
around version 795 of cctools and removed before 898. The code around
the flag usage in 795 talks about problems with kext and forcing the
execution of `ld -r`, which seems a behaviour that is not enforceable in
latest versions of cctools.
The `-l` flag was added in https://reviews.llvm.org/D15133 without a lot
of explanation.
Since the flag is not active, removing it should not modify the
behaviour for most people (except if someone is trying to compile LLVM
with a really old version of `strip`).
Additionally, break the invocation into two different flags, since
`llvm-strip` doesn't at the moment support grouped flags, and other
`strip` implementations should work the same no matter if grouped or
not.
Test Plan:
Using `strip` from Xcode 12.5 in Big Sur to strip the same binary (a
simple Hello World), using both `-Sxl` and `-Sx` produces exactly the
same binary.
Repeating the same process with `clang` results also in the same binary.
Reviewed By: smeenai
Differential Revision: https://reviews.llvm.org/D105243
Daniel Rodríguez Troitiño [Thu, 1 Jul 2021 20:36:32 +0000 (13:36 -0700)]
[llvm-strip] Support grouped options in llvm-strip
GNU and Apple `strip` implementations seems to support grouped options.
Enable the support for grouped options introduced in
https://reviews.llvm.org/D83639 for `llvm-strip` invocations.
Includes test that checks that both the grouped and non grouped
invocations produces the same result.
Reviewed By: alexander-shaposhnikov, MaskRay
Differential Revision: https://reviews.llvm.org/D105249
David Green [Thu, 1 Jul 2021 20:08:13 +0000 (21:08 +0100)]
[ARM] Reassociate BFI
D104868 removed an (incorrect) fold for distributing BFI instructions in
a chain, combining them into a single instruction. BFIs like that are
hard to test, as the patterns are often destroyed before they become
BFIs. But it can come up in places, with chains of BFIs that can be
combined.
This patch adds a replacement, which reassociates BFI instructions with
non-overlapping insertion masks so that low bits are inserted first.
This can end up sorting the nodes so that adjacent inserts are next to
one another, allowing the existing folds to combine into a single BFI.
Differential Revision: https://reviews.llvm.org/D105096
Vitaly Buka [Thu, 1 Jul 2021 03:22:41 +0000 (20:22 -0700)]
[scudo] Untag BlockEnd in reallocate
If we get here from reallocate, BlockEnd is tagged. Then we
will storeTag(UntaggedEnd) into the header of the next chunk.
Luckily header tag is 0 so unpatched code still works.
Reviewed By: pcc
Differential Revision: https://reviews.llvm.org/D105261
Vassil Vassilev [Thu, 1 Jul 2021 17:03:23 +0000 (17:03 +0000)]
[clang-repl] Allow passing in code as positional arguments.
Now we can do things like: clang-repl "int i = 1;" "int j = 2;".
Differential revision: https://reviews.llvm.org/D104898
Valentin Churavy [Wed, 30 Jun 2021 19:47:43 +0000 (21:47 +0200)]
[Orc] At CBindings for LazyRexports
At C bindings and an example for LLJIT with lazy reexports
Differential Revision: https://reviews.llvm.org/D104672
Joel E. Denny [Thu, 1 Jul 2021 19:42:33 +0000 (15:42 -0400)]
[lit] Extend --xfail/LIT_XFAIL to take full test name
The new documentation entry gives an example use case from
libomptarget.
Reviewed By: yln, jhenderson, davezarzycki
Differential Revision: https://reviews.llvm.org/D105208
Ahmed Taei [Wed, 30 Jun 2021 23:03:19 +0000 (16:03 -0700)]
Add linalg.mmt4d named op
This op performs matrix-matrix-transpose multiplication of 4-d inputs as the following:
```
C[m1, n1, m0, n0] = sum_{k1, k0}(A[m1, k1, m0, k0] * B[n1, k1, n0, k0])
```
Reviewed By: Benoit
Differential Revision: https://reviews.llvm.org/D105244
William S. Moses [Thu, 1 Jul 2021 19:05:27 +0000 (15:05 -0400)]
[MLIR] Allow Affine scalar replacement to handle inner operations
Affine scalar replacement (and other affine passes, though not fixed here) don't properly handle operations with nested regions. This patch fixes the pass and two affine utilities to function properly given a non-affine internal region
This patch prevents the pass from throwing an internal compiler error when running on the added test case.
Differential Revision: https://reviews.llvm.org/D105058
Vitaly Buka [Thu, 1 Jul 2021 06:39:12 +0000 (23:39 -0700)]
[scudo] Remove false DCHECK
MTE Cache.store passes MAP_NOACCESS here.
Reviewed By: pcc, cryptoad
Differential Revision: https://reviews.llvm.org/D105266
Leonard Grey [Thu, 1 Jul 2021 19:01:59 +0000 (15:01 -0400)]
[lld-macho] Add support for LTO optimization level
Everything (including test) modified from ELF/COFF. Using the same syntax
(--lto-O3, etc) as ELF.
Differential Revision: https://reviews.llvm.org/D105223
Vitaly Buka [Thu, 1 Jul 2021 18:56:11 +0000 (11:56 -0700)]
[NFC][scudo] Exctract getOptionsForConfig in test
Tobias Gysi [Thu, 1 Jul 2021 16:41:35 +0000 (16:41 +0000)]
[CMake][MLIR][Linalg] Adding variable to specify tablegen file dependencies.
Synchronizing multiple custom targets requires not only target but also
file dependencies. Building Linalg involves running yaml-gen followed by
tablegen. Currently, these custom targets are only synchronized using a
target dependency resulting in issues in specific incremental build
setups (https://llvm.discourse.group/t/missing-build-cmake-tblgen-dependency/3727/10).
This patch introduces a novel LLVM_TARGET_DEPENDS variable to the
TableGen.cmake file to provide a way to specify file dependencies.
Additionally, it adapts the Linalg CMakeLists.txt to introduce the
necessary file dependency between yaml-gen and tablegen.
Differential Revision: https://reviews.llvm.org/D105272
Nico Weber [Thu, 1 Jul 2021 18:51:46 +0000 (14:51 -0400)]
[gn build] Port
050b064f15ee
Nikita Popov [Thu, 1 Jul 2021 18:32:10 +0000 (20:32 +0200)]
[OpaquePtr] Support VecOfAnyPtrsToElt intrinsics
In this case the pointer type is part of the mangled name, so we
can allow on opaque pointer outside --force-opaque-pointers mode
as well.
Scott Linder [Thu, 1 Jul 2021 18:21:04 +0000 (18:21 +0000)]
[ADT] Follow up to fix bug in "Add makeVisitor to STLExtras.h"
Address mistakenly comparing the pointer values of two C-style strings
rather than comparing their contents in the unit tests for makeVisitor,
added in
6d6f35eb7b92c6dd4478834497752f4e963db16d
Louis Dionne [Fri, 18 Jun 2021 17:33:14 +0000 (13:33 -0400)]
[runtimes] Simplify how we specify XFAIL & friends based on the triple
Now that Lit supports regular expressions inside XFAIL & friends, it is
much easier to write Lit annotations based on the triple.
Differential Revision: https://reviews.llvm.org/D104747
jasonliu [Thu, 1 Jul 2021 17:59:47 +0000 (17:59 +0000)]
[libc++] Provide c++03 alternative for va_copy if available in xlocale.h
Summary:
If we are on c++03 mode for some reason, and __builtin_va_copy is
available, then use it instead of error out on not having va_copy
in 03 mode.
Reviewed by: ldionne
Differential Revision: https://reviews.llvm.org/D100336
Christopher Di Bella [Thu, 1 Jul 2021 13:25:35 +0000 (09:25 -0400)]
[libcxx][functional][modular] splices <functional> into modular headers
Differential Revision: https://reviews.llvm.org/D104942
zoecarver [Thu, 1 Jul 2021 17:18:27 +0000 (10:18 -0700)]
[libcxx] Update optional star operator to be noexcept.
Differential Revision: https://reviews.llvm.org/D105296
Louis Dionne [Thu, 1 Jul 2021 17:36:09 +0000 (13:36 -0400)]
[libc++] Migrate the additional_features parameter to the DSL
This is required to run the tests under any configuration that uses
additional_features using a from-scratch config. That is the case of
e.g. the Debug mode (which uses LIBCXX-DEBUG-FIXME) and the tests on
Windows.
Vitaly Buka [Wed, 30 Jun 2021 21:27:53 +0000 (14:27 -0700)]
[gwp_asan] Improve symbolizer script
Show inlined functions.
Hide unhelpful DWARF related warnings.
Reviewed By: hctim
Differential Revision: https://reviews.llvm.org/D105230
Vitaly Buka [Thu, 1 Jul 2021 17:22:35 +0000 (10:22 -0700)]
[NFC][scudo] Extract MapAllocatorTest for TEST_F
Emily Shi [Thu, 1 Jul 2021 17:13:00 +0000 (10:13 -0700)]
[NFC][compiler-rt] add back solaris xfail for unpoison-alternate-stack.cpp
Philip Reames [Thu, 1 Jul 2021 16:17:04 +0000 (09:17 -0700)]
[instcombine] Fold overflow check using overflow intrinsic to comparison
This follows up to D104665 (which added umulo handling alongside the existing uaddo case), and generalizes for the remaining overflow intrinsics.
I went to add analogous handling to LVI, and discovered that LVI already had a more general implementation. Instead, we can port was LVI does to instcombine. (For context, LVI uses makeExactNoWrapRegion to constrain the value 'x' in blocks reached after a branch on the condition `op.with.overflow(x, C).overflow`.)
Differential Revision: https://reviews.llvm.org/D104932
Aaron Ballman [Thu, 1 Jul 2021 16:39:17 +0000 (12:39 -0400)]
Fix an accepts-invalid issue with [[]] attributes in the type position in C
A user reported an issue to me via email that Clang was accepting some
code that GCC was rejecting. After investigation, it turned out to be a
general problem of us failing to properly reject attributes written in
the type position in C when they don't apply to types. The root cause
was a terminology issue -- we sometimes use "CXX11Attr" to mean [[]] in
C++11 mode and sometimes [[]] in general -- and this came back to bite
us because in this particular case, it really meant [[]] in C++ mode.
I fixed the issue by introducing a new function
AttributeCommonInfo::isStandardAttributeSyntax() to represent [[]] in
either C or C++ mode.
This fix pointed out that we've had the issue in some of our existing
tests, which have all been corrected. This resolves
https://bugs.llvm.org/show_bug.cgi?id=50954.
Geoffrey Martin-Noble [Thu, 1 Jul 2021 16:38:35 +0000 (09:38 -0700)]
[Bazel] Fixes for
266a7414d8
Adds LinalgOps dep needed for
https://github.com/llvm/llvm-project/commit/
266a7414d8f26
Differential Revision: https://reviews.llvm.org/D105294
Arjun P [Thu, 1 Jul 2021 14:42:56 +0000 (20:12 +0530)]
[MLIR] FlatAffineConstraints: Use Matrix objects to store the constraints
This results in significant deduplication of code. This patch is not expected to change any functionality, it's just some simplification in preparation for future work. Also slightly simplified some code that was being touched anyway and added some unit tests for some functions that were touched.
Reviewed By: bondhugula
Differential Revision: https://reviews.llvm.org/D105152
Shilei Tian [Thu, 1 Jul 2021 16:31:45 +0000 (12:31 -0400)]
[OpenMP][Offloading] Refined return value of `DeviceTy::getOrAllocTgtPtr`
`DeviceTy::getOrAllocTgtPtr` just returns a target pointer. In addition,
two bool values (`IsNew` and `IsHostPtr`) are passed by reference to make the
change in the function available in callee.
In this patch, a struct, which contains the target pointer, two flags, and an
iterator to the map table entry corresponding to the queried host pointer, will
be returned. In addition to make the logic clearer regarding the two bool values,
this paves the way for the next patch to fix the data race in `bug49334.cpp` by
attaching an event to the map table entry (and that's why we need the iterator).
Reviewed By: grokos
Differential Revision: https://reviews.llvm.org/D104382
Aart Bik [Wed, 30 Jun 2021 21:41:10 +0000 (14:41 -0700)]
[mlir][sparse] move tensor expression builder into Merger utility
Rationale:
Follow-up on migrating lattice and tensor expression related methods into the new utility.
This also prepares the next step of generalizing the op kinds that are handled.
Reviewed By: gussmith23
Differential Revision: https://reviews.llvm.org/D105219
Nikita Popov [Tue, 29 Jun 2021 21:30:27 +0000 (23:30 +0200)]
[OpaquePtr] Support opaque pointers in intrinsic type check
This adds support for opaque pointers in intrinsic type checks
of IIT kind Pointer and PtrToElt.
This is less straight-forward than it might initially seem, because
we should only accept opaque pointers here in --force-opaque-pointers
mode. Otherwise, there would be more than one valid type signature
for a given intrinsic name.
Differential Revision: https://reviews.llvm.org/D105155
Matt Arsenault [Thu, 10 Jun 2021 21:31:30 +0000 (17:31 -0400)]
GlobalISel: Use LLT in call lowering callbacks
This preserves the memory type so the lowerings can rely on them.
Bradley Smith [Tue, 29 Jun 2021 11:40:46 +0000 (12:40 +0100)]
[SelectionDAG] Implement PromoteIntRes_INSERT_SUBVECTOR
Inserting into a smaller-than-legal scalable vector would result in an
internal compiler error. For example, inserting a <vscale x 4 x i8> into
a <vscale x 8 x i8> (both illegal vector types for SVE) would cause a
crash.
This crash was happening because there was no code to promote (legalise)
the result of an INSERT_SUBVECTOR node.
This patch implements PromoteIntRes_INSERT_SUBVECTOR, which legalises
the ISD node. This is currently done by going through memory. This is
necessary because of the requirement that the SubVec parameter of the
INSERT_SUBVECTOR node must be smaller than the Vec parameter, which
means that INSERT_SUBVECTOR cannot always have a legal result/operand
types.
Co-Authored-by: Joe Ellis <joe.ellis@arm.com>
Differential Revision: https://reviews.llvm.org/D102766
Stanislav Mekhanoshin [Wed, 30 Jun 2021 21:48:34 +0000 (14:48 -0700)]
[AMDGPU] Fix immediate sign during V_MOV_B64_PSEUDO expansion
Creating a V_MOV_B32 with zero extended immediate source
prevented conversion to V_BFREV_B32.
Differential Revision: https://reviews.llvm.org/D105235
David Green [Thu, 1 Jul 2021 15:56:23 +0000 (16:56 +0100)]
[ARM] Extra BFI codegen tests. NFC
Irina Dobrescu [Wed, 30 Jun 2021 14:49:48 +0000 (15:49 +0100)]
[AArch64][GlobalISel]Legalise some vector types for min/max
Differential Revision: https://reviews.llvm.org/D105200
Alexey Bataev [Thu, 1 Jul 2021 13:42:16 +0000 (06:42 -0700)]
[OPENMP]Fix PR50640: OpenMP target clause implicitly scaling loop bounds to uint64_t.
Need to add some conversions to suppress possible warning messages.
Differential Revision: https://reviews.llvm.org/D105187
Nico Weber [Thu, 1 Jul 2021 14:49:10 +0000 (10:49 -0400)]
[clangd] Unbreak mac build differently
0c96a92d8666b8
This reverts
b56e5f8a10c1 (and follow-up
f6db88535cb) and instead
restores the state we had before
0c96a92d8666b8: ClangdMain.cpp
includes Features.inc before including Transport.h.
This is a bit ugly, but it matches the former state and making Transport.h
include Features.h means that xpc/ needs to be able to find the generated
Features.inc, wich is also a bit ugly.
Simon Pilgrim [Thu, 1 Jul 2021 14:17:48 +0000 (15:17 +0100)]
[LoopVectorize][X86] Regenerate conversion-cost.ll tests
Simon Pilgrim [Thu, 1 Jul 2021 13:16:02 +0000 (14:16 +0100)]
[CostModel][X86] Adjust fp<->int vXi32 SSE legalized costs based on llvm-mca reports.
Building on rG2a1ef8784ad9a, adjust the SSE cost tables to use the legalized types based on the worst case costs from the script in D103695.
To account for different numbers of src/dst legalized type registers we must scale the cost by maximum of the src/dst, not just use src
Arnold Schwaighofer [Wed, 30 Jun 2021 13:57:40 +0000 (06:57 -0700)]
[coro async] Add support for specifying which parameter is swiftself in
async resume functions
Differential Revision: https://reviews.llvm.org/D104147
Sjoerd Meijer [Thu, 1 Jul 2021 13:44:35 +0000 (14:44 +0100)]
[AArch64] Add some more tests to CodeGen/AArch64/aarch64-load-ext.ll. NFC.
Sam Tebbs [Mon, 21 Jun 2021 15:00:11 +0000 (16:00 +0100)]
[ARM] Transform a floating-point to fixed-point conversion to a VCVT_fix
Much like fixed-point to floating-point conversion, the converse can
also be transformed into a fixed-point VCVT. This patch transforms
multiplications of floating point numbers by 2^n into a VCVT_fix. The
exception is that a float to fixed conversion with 1 fractional bit
ends up being an FADD (FADD(x, x) emulates FMUL(x, 2)) rather than an FMUL so there is a special case for that. This patch also moves the code from https://reviews.llvm.org/D103903 into a separate function as fixed to float and float to fixed are very similar.
Differential Revision: https://reviews.llvm.org/D104793
Louis Dionne [Thu, 1 Jul 2021 14:09:13 +0000 (10:09 -0400)]
[libc++] Fix incorrect shell expansion in macos-ci-setup
Alexey Bataev [Thu, 1 Jul 2021 13:39:53 +0000 (06:39 -0700)]
Revert "[OPENMP]Fix PR50640: OpenMP target clause implicitly scaling loop bounds to uint64_t."
This reverts commit
67643f46ee9fb08e32075d67715a59c840aa761b to fix
unexpected diagnostic notes.
David Sherwood [Fri, 18 Jun 2021 12:20:10 +0000 (13:20 +0100)]
[NFC] Add new setDebugLocFromInst that uses the class Builder by default
In lots of places we were calling setDebugLocFromInst and passing
in the same Builder member variable found in InnerLoopVectorizer.
I personally found this confusing so I've changed the interface
to take an Optional<IRBuilder<> *> and we can now pass in None
when we want to use the class member variable.
Differential Revision: https://reviews.llvm.org/D105100
Alexey Bataev [Wed, 30 Jun 2021 12:47:19 +0000 (05:47 -0700)]
[OPENMP]Fix PR50640: OpenMP target clause implicitly scaling loop bounds to uint64_t.
Need to add some conversions to suppress possible warning messages.
Differential Revision: https://reviews.llvm.org/D105187
Andrzej Warzynski [Thu, 1 Jul 2021 08:33:00 +0000 (09:33 +0100)]
[flang][driver] Extend the `flang` bash script to act as a driver
Until now, `f18` would:
1. Use Flang to unparse the input files
2. Call an external Fortran compiler to compile the unparsed source
files (generated in step 1)
With this patch, `f18` will stop after unparsing the input source files,
i.e. step 1 above. The `flang` bash script will take care of step 2,
i.e. calling an external Fortran compiler driver to compile them. This
way:
* the functionality of `f18` is reduced - it will only drive Flang (as
opposed to delegating code-generation to an external tool on top of
this)
* we will able to switch between `f18` and `flang-new` for unparsing before
an external Fortran compiler is called for code-generation
The updated `flang` bash script needs to specify the output file when
using the `-fdebug-unparse` action. Both `f18` and `flang-new` have been
updated accordingly.
These changes were discussed in [1] as a requirement for replacing `f18`
with `flang-new`.
[1] https://lists.llvm.org/pipermail/flang-dev/2021-April/000677.html
Differential Revision: https://reviews.llvm.org/D103177
Florian Hahn [Thu, 1 Jul 2021 12:10:26 +0000 (13:10 +0100)]
[AArch64] Add fp16 tests for vector copysign.
Add additional fp16 vector tests for copysign, to show improvements in
follow-up patch.
Haojian Wu [Wed, 30 Jun 2021 08:15:59 +0000 (10:15 +0200)]
[clang] Fix CallExpr dependence bit may not respect all its arguments.
Before this patch, the dependence of CallExpr was only computed in the
constructor, the dependence bits might not reflect truth -- some arguments might
be not set (nullptr) during this time, e.g. CXXDefaultArgExpr will be set via
the setArg method in the later parsing stage, so we need to recompute the
dependence bits.
Irina Dobrescu [Thu, 17 Jun 2021 11:41:23 +0000 (12:41 +0100)]
[AArch64] Add test for min/max
Differential Revision: https://reviews.llvm.org/D104447
Jeremy Morse [Thu, 1 Jul 2021 11:34:50 +0000 (12:34 +0100)]
[DebugInfo][InstrRef][2/4] Use subreg substitutions in LiveDebugValues
Added in
47c3fe2a22cf, we sometimes need to describe a variable value
substitution with a subregister qualifier, to say that "the value is the
lower 32 bits of this 64 bit register def" for example. That then needs
support during LiveDebugValues to interpret the subregister qualifiers,
which is what this patch adds.
Whenever we encounter a DBG_INSTR_REF and find its value by using a
substitution, collect any subregister qualifiers seen. Then, accumulate the
effects of the qualifiers to work out what offset and what size should be
extracted from the defined register. Finally, for the target ValueIDNum,
extract whatever subregister is in the correct position
Currently, describing a subregister field of a larger value that has been
spilt to the stack, is unimplemented.
Differential Revision: https://reviews.llvm.org/D88894
Marcos Horro [Thu, 1 Jul 2021 10:49:24 +0000 (11:49 +0100)]
[llvm-mca] Fix JSON output (PR50922)
Based on the discussion in PR50922, minor changes have been done to properly
output a valid JSON. Removed "not implemented" keys.
Differential Revision: https://reviews.llvm.org/D105064
Jon Chesterfield [Thu, 1 Jul 2021 11:53:03 +0000 (12:53 +0100)]
[libomptarget][nfc] Move grid size computation
Change getLaunchVals to return the integers used for launch
Reviewed By: pdhaliwal
Differential Revision: https://reviews.llvm.org/D105237
Nicolas Vasilache [Wed, 30 Jun 2021 21:18:13 +0000 (21:18 +0000)]
[mlir][Linalg] Add comprehensive bufferization support for ConstantOp (13/n)
ConstantOp are only supported in the ModulePass because they require a GlobalCreator object that must be constructed from a ModuleOp.
If the standlaone FunctionPass encounters a ConstantOp, bufferization fails.
Differential revision: https://reviews.llvm.org/D105156
Nicolas Vasilache [Wed, 30 Jun 2021 21:10:26 +0000 (21:10 +0000)]
[mlir][Linalg] Drop comprehensive-func-bufferize (12/n)
This revision drops the comprehensive bufferization Function pass, which has issues when trying to bufferize constants.
Instead, only support the comprehensive-module-bufferize by default.
Differential Revision: https://reviews.llvm.org/D105228
Hussain Kadhem [Thu, 1 Jul 2021 09:30:49 +0000 (11:30 +0200)]
[VP] Implementation of intrinsic and SDNode definitions for VP load, store, gather, scatter.
This patch adds intrinsic definitions and SDNodes for predicated
load/store/gather/scatter, based on the work done in D57504.
Reviewed By: simoll, craig.topper
Differential Revision: https://reviews.llvm.org/D99355
Nicolas Vasilache [Tue, 29 Jun 2021 12:53:09 +0000 (12:53 +0000)]
[mlir][Linalg] Add comprehensive bufferization support for linalg::InitTensor and tensor::CastOp (11/n)
Also add an integration test that connects all the dots end to end, including with cast to unranked tensor for external library calls.
Differential Revision: https://reviews.llvm.org/D105106