Commit Graph

447773 Commits

Author SHA1 Message Date
Alexander Yermolovich
e262b8f48a [LLDB] Change formatting to use llvm::formatv
In preparation for eanbling 64bit support in LLDB switching to use llvm::formatv
instead of format MACROs.

Reviewed By: labath, JDevlieghere

Differential Revision: https://reviews.llvm.org/D139955
2023-01-09 11:29:43 -08:00
Heejin Ahn
78f01f69b3 [WebAssembly] Ensure 'end_function' in functions
Local info is supposed to be emitted in the start of every function.
When there are locals, `.local` section should be present, and we emit
local info according to the section.

If there is no locals, empty local info should be emitted. This empty
local info is emitted whenever a first instruction is emitted within a
function without encountering a `.local` section. If there is no
instruction, `end_function` pseudo instruction should be present and the
empty local info will be emitted when parsing the pseudo instruction.

The following assembly is malformed because the function `test` doesn't
have an `end_function` at the end, and the parser doesn't end up
emitting the empty local info needed. But currently we don't error out
and silently produce an invalid binary.
```
.functype test () -> ()
test:
```

This patch adds one extra state to the Wasm assembly parser,
`FunctionLabel` to detect whether a function label is parsed but not
ended properly when the next function starts or the file ends.

It is somewhat tricky to distinguish `FunctionLabel` and
`FunctionStart`, because it is not always possible to ensure the state
goes from `FunctionLabel` -> `FunctionStart`. `.functype` directive does
not seem to be mandated before a function label, in which case we don't
know if the label is a function at the time of parsing. But when we do
know the label is function, we would like to ensure it ends with an
`end_function` properly. Also we would like to error out when it does
not.

For example,
```
.functype test() -> ()
test:
```
We should error out for this because we know `test` is a function and it
doesn't end with an `end_function`. This PR fixes this.

```
test:
```
We don't error out for this because there is no info that `test` is a
function, so we don't know whether there should be an `end_function` or
not.

```
test:
.functype test() -> ()
```
We error out for this currently already, because we currently switch to
`FunctionStart` state when we first see `.functype` directive after its
label definition.

Fixes https://github.com/llvm/llvm-project/issues/57427.

Reviewed By: sbc100

Differential Revision: https://reviews.llvm.org/D141103
2023-01-09 11:09:35 -08:00
Matt Arsenault
925aa514ed AMDGPU: Use DataExtractor for printf string extraction
Attempt 2 to fix big endian bot failures.
2023-01-09 14:03:42 -05:00
Peiming Liu
dd0d5acfa6 [mlir][sparse] remove redundant template parameter (NFC)
The template parameter is no longer needed after MutSparseTensorDescriptor
is implemented as a subclass of SparseTensorDescriptorImpl. The only purpose
for it was to enable SFINAE.

Reviewed By: bixia

Differential Revision: https://reviews.llvm.org/D141303
2023-01-09 19:01:37 +00:00
Philip Reames
7ca0af8943 [RISCV] Consolidate test lines in fence lowering test
These are identical for RV32 and RV64.
2023-01-09 11:00:47 -08:00
Thurston Dang
df3af581e7 tsan: increase app mappings for aarch64 48-bit
Currently, tsan's memory mappings include 4GB
for high app, 20GB for mid app, and 8GB for low
app. The high app and mid app mappings are
too small for large programs, especially if ASLR
entropy (mmap_rnd_bits) is set higher. The low app
region (for non-PIE) is too small for some of tcmalloc's
internal tests (this does not affect normal apps,
since tsan will replace malloc).

This CL increases the memory mappings to 4TB for
high app, 1.3TB for mid app, and 10TB for low app. Note
that tsan's 44-bit pointer compression/decompression imposes
a 16TB limit on the combined size of the app mappings, making
this set of mappings more or less maximal.

Differential Revision: https://reviews.llvm.org/D140923
2023-01-09 18:45:43 +00:00
Augusto Noronha
1d6243db90 [lldb] Fix symbol table use after free
The symbol file stores a raw pointer to the main object file's symbol
table. This pointer, however, can be freed, if ObjectFile::ClearSymtab
is ever called. This patch makes sure out pointer to the symbol file
is valid before using it.
2023-01-09 10:27:18 -08:00
Philip Reames
0fcbb12465 [RISCV] Add test coverage for singlethread fences 2023-01-09 10:14:12 -08:00
Alexey Bataev
755282ec1e [SLP][NFC]Move getExtractIndex function for future changes, NFC. 2023-01-09 09:53:01 -08:00
Kazu Hirata
51ddfd76dd [mlir] Fix a warning
This patch fixes:

  mlir/lib/Dialect/Vector/Transforms/VectorDistribute.cpp:947:13:
  error: variable 'distributedDim' set but not used
  [-Werror,-Wunused-but-set-variable]
2023-01-09 09:51:17 -08:00
Paul Kirth
20894a478d [lld-macho] Prevent assertions for aliases to weak_def_can_be_hidden symbols
In https://reviews.llvm.org/D137982 we found that on Mach-O private
aliases could trigger an assert in lld when the aliasee was a
weak_def_can_be_hidden symbol.

This appears to be incorrect, and should be allowed in Mach-O.
Disallowing this behavior is also inconsistent with how ld64 handles
a private alias to weak_def_can_be_hidden symbols.

This patch removes the assert and tests that LLD handles such aliases
gracefully.

Reviewed By: #lld-macho, int3

Differential Revision: https://reviews.llvm.org/D141082
2023-01-09 17:50:45 +00:00
Craig Topper
1153313c33 [LocalStackSlotAllocation] Minor simplifications. NFC
Instead of maintaining a separate valid flag for BaseReg, Use
BaseReg.isValid(). I think this is left over from an older
implementation that maintained a vector of base registers.

The other change is not do a speculative assignment to BaseOffset
that needs to be reverted. Only commit it after we do the check.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D141153
2023-01-09 09:45:22 -08:00
Theodore Luo Wang
b37758356a [mlir] Print a newline when dumping Type
Fixes https://github.com/llvm/llvm-project/issues/59673

Reviewed By: mehdi_amini, Mogball

Differential Revision: https://reviews.llvm.org/D141201
2023-01-09 17:33:46 +00:00
Sanjay Patel
0eedc9e567 [InstCombine] bitrev (zext i1 X) --> select X, SMinC, 0
https://alive2.llvm.org/ce/z/ZXCtgi

This breaks the infinite combine loop for issue #59897,
but we may still need more changes to avoid those loops.
2023-01-09 12:27:37 -05:00
Sanjay Patel
b1e6947618 [InstCombine] add tests for bitreverse of i1; NFC 2023-01-09 12:27:37 -05:00
Nikolas Klauser
64f06dda87 [libc++] Use %{clang-query} when calling clang-query 2023-01-09 18:21:06 +01:00
Ivan Kosarev
2d945ef864 [AMDGPU][NFC] Rename GFX10A16 operands.
They do not seem to be GFX10-specific anymore. Also renames the
corresponding feature.

Reviewed By: dp

Differential Revision: https://reviews.llvm.org/D141069
2023-01-09 17:18:46 +00:00
Valentin Clement
fdc3dd70c7 [flang] Add runtime default initialization for polymorphic intent(out) dummy
This patch adds runtime default initialization for polymorphic
dummy argument. The dynamic type might require default initialization
but not the declared type.

Reviewed By: jeanPerier, PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D141278
2023-01-09 17:53:41 +01:00
Valentin Clement
747211b712 [flang] Handle emboxing of a fir.ref<none> to an unlimited polymorphic box
When an array element is extracted from an unlimited polymorphic array, the
emboxing of this element has to retrive the type code and element size from
the initial array. This patch retrive this information through the extracted
type descriptor.

This situation can be found in code like:

```
subroutine sub1(a)
  class(*) :: a(:)
  select type (x=>a(1))
  type is (integer)
    x = 10
  end select
end subroutine
```

Reviewed By: jeanPerier, PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D141274
2023-01-09 17:52:44 +01:00
Florian Hahn
596a8d07d4 [AArch64] Add additional reassociation test.
Add a test where the reassociation candidates are split across 2 blocks.
2023-01-09 16:38:19 +00:00
Jakub Kuderski
80d5400d92 [mlir][spirv] Account for type conversion failures in scf-to-spirv
Fixes: https://github.com/llvm/llvm-project/issues/59136

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D141292
2023-01-09 11:35:47 -05:00
Joseph Huber
a5098e5f27 [OpenMP] Fix some tests failing with 'libgomp' as the default library
Summary:
There's some static checks on the library, we can't do offloading with
`libgomp` for OpenMP. This patch specifies the library for the tests to
avoid this breaking tests.
2023-01-09 10:03:19 -06:00
Nikita Popov
bd66251864 [ConstantRange] Test 1 bit ranges in exhaustive tests (NFC)
There have been multiple cases where range calculations were wrong
in the 1 bit case. Make sure we catch these by not specifying the
bit width explicitly, and letting the test framework pick it (which
will now always test 1 and 4 bits both).
2023-01-09 16:57:08 +01:00
Alex Brachet
70ab8e8ad9 [compiler-rt] Move up undefined macro checks
Previously HWCAP_ATOMIC and others were being used before checking if
they were defined. This moves up all the ifndef checks to define these
macros if they are not yet defined.

Differential Revision: https://reviews.llvm.org/D141285
2023-01-09 15:54:11 +00:00
Jakub Kuderski
a35a8f4b19 [mlir][spirv] Clean up transform pass definitions. NFC.
- Make naming more consistent.
- Drop unnecessary custom constructors definitions.
- Move pass documentation to pass descriptions.

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D141159
2023-01-09 10:51:08 -05:00
Matthias Springer
1523b72946 [mlir][vector] Distribute vector.insert op
In case the distributed dim of the dest vector is also a dim of the src vector, each lane inserts a smaller part of the source vector. Otherwise, one lane inserts the entire src vector and the other lanes do nothing.

Differential Revision: https://reviews.llvm.org/D137953
2023-01-09 16:50:28 +01:00
Jay Foad
6a6f62a719 [AMDGPU] S_MULK_I32 does not define SCC. NFCI.
Differential Revision: https://reviews.llvm.org/D141281
2023-01-09 15:44:56 +00:00
Matthias Springer
73ce971c63 [mlir][vector] Distribute vector.insertelement op
In case of a distribution, only one lane inserts the scalar value. In case of a broadcast, every lane inserts the scalar.

Differential Revision: https://reviews.llvm.org/D137929
2023-01-09 16:41:08 +01:00
Matthias Springer
9085f00b4d [mlir][vector] Support vector.extract distribution of >1D vectors
Ops such as `%1 = vector.extract %0[2] : vector<5x96xf32>`.

Distribute the source vector, then extract. In case of a 1d extract, rewrite to vector.extractelement.

Differential Revision: https://reviews.llvm.org/D137646
2023-01-09 16:39:50 +01:00
Nikolas Klauser
1f5d698a8b [libc++] Add missing include in __format/unicode.h 2023-01-09 16:37:31 +01:00
Nikita Popov
fd07583ca4 [ConstantRange] Fix single bit abs range (PR59887)
For a full range input, we would produce an empty range instead
of a full range. The change to the SMin.isNonNegative() branch is
an optimality fix, because we should account for the potentially
discarded SMin value in the IntMinIsPoison case.

Change TestUnaryOpExhaustive to test both 4 and 1 bits, to both
cover this specific case in unit tests, and make sure all other
unary operations deal with 1-bit inputs correctly.

Fixes https://github.com/llvm/llvm-project/issues/59887.
2023-01-09 16:34:09 +01:00
Joe Loser
835cf3ca6b [libc++][test] Fix missing include in bit_ceil.fail.cpp
The test uses `size_t` but does not include a header defining it.  Include
`<cstddef>` which provides `size_t`.

Differential Revision: https://reviews.llvm.org/D141284
2023-01-09 08:32:31 -07:00
Louis Dionne
5efc81166d [libc++] Remove HIDE_FROM_ABI from virtual functions
_LIBCPP_HIDE_FROM_ABI (which is what _LIBCPP_INLINE_VISIBILITY is) uses
ABI tags to avoid ODR violations when linking together object files
compiled against different versions of libc++. However, pointer
authentication uses the mangled name of the function to sign the
function pointer in the vtable, which means that the ABI tag effectively
changes how the pointers are signed.

This leads to PAC failures when passing an object that holds one of these
pointers in its vtable across an ABI boundary: one side will sign the
pointer using one function mangling (with one ABI tag), and the other
side will authenticate the pointer expecting it to have a different
mangled name, which won't work.

To make sure this does not regress in the future, this patch also adds
a clang-query test to detect incorrect applications of _LIBCPP_HIDE_FROM_ABI.

Differential Revision: https://reviews.llvm.org/D140453
2023-01-09 10:29:42 -05:00
Sanjay Patel
2dcbd740ee [InstCombine] reduce smul.ov with i1 types to 'and'
https://alive2.llvm.org/ce/z/5tLkW6

There's still a miscompile bug as shown in issue #59876 / D141214 .
2023-01-09 10:27:15 -05:00
Sanjay Patel
fc9d54a4a1 [InstCombine] add tests for smul/umul with overflow with i1 types; NFC
More coverage for D141214 / issue #59876
2023-01-09 10:27:15 -05:00
Florian Hahn
70520e2f1c [AArch64] Add test showing reassociation potential.
Add a test case where some ops of a reassociate-able expression are in
an earlier block.

This can appear in practice, e.g. when computing the final reduction
value after vectorization.
2023-01-09 15:20:55 +00:00
Nikita Popov
b50961bded [CVP] Add test for PR59887 (NFC)
Also fix all the incorrect intrinsic name mangling while here.
2023-01-09 16:16:23 +01:00
Sander de Smalen
8aff167b34 [AArch64][SME] Improve streaming-compatible codegen for extending loads/truncating stores.
This is another step in aligning addTypeForStreamingSVE with addTypeForFixedLengthSVE,
which also improves code quality for extending loads and truncating stores.

Reviewed By: hassnaa-arm

Differential Revision: https://reviews.llvm.org/D141266
2023-01-09 15:08:04 +00:00
David Goldman
042dd99484 [clangd] Full support for #import insertions
These are still disabled by default, but will work in ObjC code if you
enable the `-import-insertions` flag.

Completion requires ASTSignals to be available; before ASTSignals are
available, we will always use #include. Once they are available, the
behavior varies as follows:

- For source files, use #import if the ObjC language flag is enabled
- For header files:
  - If the ObjC language flag is disabled, use #include
  - If the header file contains any #imports, use #import
  - If the header file references any ObjC decls, use #import
  - Otherwise, use #include

IncludeFixer support is similar, but it does not rely upon ASTSignals,
instead it does the above checks excluding the scan for ObjC symbols.

Differential Revision: https://reviews.llvm.org/D139458
2023-01-09 09:48:30 -05:00
David Goldman
814c0bb316 [clangd] Add flag to control #import include insertions
This will be disabled by default, hopefully we can enable for the next
major release.

Differential Revision: https://reviews.llvm.org/D139446
2023-01-09 09:48:29 -05:00
Nikita Popov
59f91ddf90 [InstCombine] Preserve alignment in atomicrmw -> store fold
Preserve the alignment of the original atomicrmw, rather than using
the ABI alignment.

The same problem exists for loads, but that code is being removed
in D141277 anyway.
2023-01-09 15:37:24 +01:00
David Truby
15e734fe6c [flang] Disable LTO when building the flang runtime
When building the flang runtime if LTO is enabled the archive file
contains LLVM IR rather than object code. Currently flang is not
LTO aware so cannot link this file to compiled Fortran code.

This patch disables LTO when building the flang runtime to avoid
this issue.

Differential Revision: https://reviews.llvm.org/D140016
2023-01-09 14:35:01 +00:00
Nikita Popov
22cafc7381 [InstCombine] Test alignment in atomicrmw -> store transform (NFC)
And regenerate test checks. The current alignment is incorrect.
2023-01-09 15:26:01 +01:00
Martin Storsjö
151ab65c0d [LLD] [COFF] Add a testcase for the type of autoexported symbols from LTO
This adds test coverage for the behaviour that broke in
7370ff624d.
2023-01-09 16:11:36 +02:00
Martin Storsjö
398c2ad6f6 Revert "[LLD] Remove global state in lld/COFF"
This reverts commit 7370ff624d.
(and 47fb8ae2f9).

This commit broke the symbol type in import libraries generated
for mingw autoexported symbols, when the source files were built
with LTO. I'll commit a testcase that showcases this issue after
the revert.
2023-01-09 16:04:44 +02:00
Alexey Baturo
35b8bb0ab3 [RISC-V][HWASAN] Don't explicitly load GOT entry to call hwasan mismatch routine
Reviewed by: luismarques

Differential Revision: https://reviews.llvm.org/D132994
2023-01-09 16:46:28 +03:00
David Green
90f24bef47 [ARM] Fold And/Or into CSel if possible
This is the ARM equivalent of D141119, where we fold `and x, (csel 0, 1, cc)`
to `csel ZR, x, cc` if we know that x is 0/1 and for `or x, (csel 0, 1, cc)`
emit `csinc x, ZR, cc`. The or pattern gets recognized from a cmov under Arm.

Differential Revision: https://reviews.llvm.org/D141137
2023-01-09 13:28:57 +00:00
Jamie Hill-Daniel
6b9317f52a [InstCombine] Fold zero check followed by decrement to usub.sat
Fold (a == 0) : 0 ? a - 1 into usub.sat(a, 1).

Differential Revision: https://reviews.llvm.org/D140798
2023-01-09 14:22:25 +01:00
Jamie Hill-Daniel
8f4795ef13 [InstCombine] Add tests for saturating subtract by one (NFC)
Tests for D140798.
2023-01-09 14:10:28 +01:00
Alex Zinenko
984c2c8cb3 [mlir] verify against nullptr payload in transform dialect
When establishing the correspondence between transform values and
payload operations or parameters, check that the latter are non-null and
report errors. This was previously allowed for exotic cases of partially
successfull transformations with "apply each" trait, but was dangerous.
The "apply each" implementation was reworked to remove the need for this
functionality, so this can now be hardned to avoid null pointer
dereferences.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D141142
2023-01-09 14:03:35 +01:00