Commit Graph

447783 Commits

Author SHA1 Message Date
Tue Ly
05727d94de [libc][Obvious] Fix typos in LLVMLibCArchitectures.cmake defining target architectures.
Fix typos in LLVMLibCArchitectures.cmake defining target architectures.

Differential Revision: https://reviews.llvm.org/D141314
2023-01-09 15:53:22 -05:00
Fangrui Song
a5519b99bc [sanitizer] Don't intercept LFS64 symbols on musl
LFS64 symbols in musl are for glibc-ABI-compat and not intended for linking
(correct usage will not create LFS64 references). The next release 1.2.4 will
disallow linking against LFS64 symbols[1].

For sanitizers, let's just remove LFS64 interceptors. In case of erroneous LFS64
references, asan/tsan will detect fewer problems and msan may have false
positives.

[1]: https://git.musl-libc.org/cgit/musl/commit/?id=246f1c811448f37a44b41cd8df8d0ef9736d95f4

Reviewed By: thesamesam

Differential Revision: https://reviews.llvm.org/D141186
2023-01-09 12:43:23 -08:00
Alex Brachet
3af4e4031d Revert "[libc] Templatize str{,n}cmp"
This reverts commit c6dcbed2e5.

Broke tests on arm and aarch64
2023-01-09 20:24:16 +00:00
Corentin Jabot
e1111e2056 [Clang] Correctly capture bindings in dependent lambdas.
Structured bindings were not properly marked odr-used
and therefore captured in generic lambddas.

Fixes #57826

It is unclear to me if further simplification can be gained
through the allowance described in
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0588r1.html.

Either way, I think this makes support for P0588 completes,
but we probably want to add test for that in a separate PR.
(and I lack confidence I understand P0588 sufficiently to assert
the completeness of our cnformance).

Reviewed By: aaron.ballman, #clang-language-wg

Differential Revision: https://reviews.llvm.org/D137244
2023-01-09 21:20:57 +01:00
Alex Brachet
dc1b614bb8 [libc] Move b* string functions to strings.h
Traditionally these functions are exposed in string*s*.h not string.h

Differential Revision: https://reviews.llvm.org/D141237
2023-01-09 20:16:20 +00:00
Alex Brachet
c6dcbed2e5 [libc] Templatize str{,n}cmp
This will be used to implement the case insensitive str{,n}casecmp

Differential Revision: https://reviews.llvm.org/D141235
2023-01-09 20:13:02 +00:00
spupyrev
61eb12e1f4 [BOLT] introducing profi params
We want to use profile inference (**profi**) in BOLT for stale profile matching.
To this end, I am making a few changes modifying the interface of the algorithm.
This is the first change for existing usages of profi (e.g., CSSPGO):
- introducing an object holding the algorithmic parameters;
- some renaming of existing options;
- dropped unused option, SampleProfileInferEntryCount, as we don't plan to change its default value;
- no changes in the output / tests.

Reviewed By: hoy

Differential Revision: https://reviews.llvm.org/D134756
2023-01-09 12:03:28 -08:00
Fangrui Song
8e0c1aaf6b [msan] Use SizeClassAllocator64 for AArch64
Now that D137666 requires 48-bit VMA for AArch64, we can switch to
SizeClassAllocator64 for a slightly more efficient allocator
(asan/lsan already switched by default).

It seems that we can pick kSpaceBeg = 0xE00000000000ULL to support both Linux
("app-15") and FreeBSD ("high memory").

Reviewed By: #sanitizers, vitalybuka

Differential Revision: https://reviews.llvm.org/D140792
2023-01-09 19:49:08 +00:00
Yitzhak Mandelbaum
01ccf7b3ce Revert "Revert "[clang][dataflow] Only model struct fields that are used in the function being analyzed.""
This reverts commit 2b1a517a92. It's a fix forward
with two memory errors fixed, one of which was the cause of the build breakage
in the buildbots.

Original message:

Previously, the model for structs modeled all fields in a struct when
`createValue` was called for that type. This patch adds a prepass on the
function under analysis to discover the fields referenced in the scope and then
limits modeling to only those fields. This reduces wasted memory usage
(modeling unused fields) which can be important for programs that use large
structs.

Note: This patch obviates the need for https://reviews.llvm.org/D123032.
2023-01-09 19:32:10 +00:00
Philip Reames
3df27e9741 [RISCV] Minor style cleanup in advance of D141311 [nfc] 2023-01-09 11:31:54 -08:00
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