platform/upstream/llvm.git
16 months agoReland "Give NullabilityKind a printing operator<<"
Sam McCall [Mon, 8 May 2023 11:07:11 +0000 (13:07 +0200)]
Reland "Give NullabilityKind a printing operator<<"

This reverts commit 5326c9e480d70e16c2504cb5143524aff3ee2605.

The problem that caused the revert was downstream
(missing dep in user of clang).

16 months agoFix possible self assign issue for DIEValue
Wang, Xin10 [Mon, 8 May 2023 09:55:08 +0000 (05:55 -0400)]
Fix possible self assign issue for DIEValue

In DIEValue's operator assignment constructor, it didn't identify if
the two obj is the same.
I add code to identify them so that it will work correctly when we do
self assign here.

Reviewed By: skan

Differential Revision: https://reviews.llvm.org/D150020

16 months ago[PowerPC] Add target feature requirement to builtins
Qiu Chaofan [Mon, 8 May 2023 09:51:36 +0000 (17:51 +0800)]
[PowerPC] Add target feature requirement to builtins

Clang has mechanism to specify required target features of a built-in
function. This patch adds such definitions to Altivec, VSX, HTM,
PairedVec and MMA builtins.

This will help frontend to detect incompatible target features of
bulitin when using target attribute syntax.

Reviewed By: nemanjai, kamaub

Differential Revision: https://reviews.llvm.org/D143467

16 months ago[clang-repl] Do not assert if we have weak references left.
Vassil Vassilev [Sun, 30 Apr 2023 17:23:04 +0000 (17:23 +0000)]
[clang-repl] Do not assert if we have weak references left.

Non-incremental Clang can also exit with the WeakRefReferences not empty upon
such example. This patch makes clang-repl consistent to what Clang does.

Differential revision: https://reviews.llvm.org/D148435

16 months ago[JITLink][RISCV] Only generate PLT entries for external symbols
Job Noorman [Mon, 8 May 2023 08:05:46 +0000 (10:05 +0200)]
[JITLink][RISCV] Only generate PLT entries for external symbols

R_RISCV_CALL has been deprecated. [1] Both GCC and LLVM seem to not
generate it anymore and always use R_RISCV_CALL_PLT (even for calls that
do not need a PLT entry). Generating PLT entries based on relocation
type is not recommended and a better heuristic is to only generate them
when the target symbol is preemptable [2]. This patch implements this by
only generating PLT entries for undefined symbols.

[1] https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/340
[2] https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues/98

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D149525

16 months ago[Clang][RISCV] Update vreinterpret.c test case with new script. NFC
eopXD [Mon, 8 May 2023 08:16:13 +0000 (01:16 -0700)]
[Clang][RISCV] Update vreinterpret.c test case with new script. NFC

16 months ago[MLIR][Linalg] Rename `packElementWiseOp` to `packGenericOp` (NFC)
Lorenzo Chelini [Fri, 5 May 2023 09:20:35 +0000 (11:20 +0200)]
[MLIR][Linalg] Rename `packElementWiseOp` to `packGenericOp` (NFC)

Commit b4563ee17ce45728a323c2708e549627b0a8ee9c enabled propagation for
pack and unpack through non-elementwise operations, update comments and
methods names to reflect the changes made.

Rework some tests where the `linalg.generic` was reading from
`tensor.empty`, which is undefined behaviour.

Reviewed By: hanchung, qedawkins

Differential Revision: https://reviews.llvm.org/D149952

16 months ago[NFC][ASAN] Sort includes
Vitaly Buka [Mon, 8 May 2023 07:47:53 +0000 (00:47 -0700)]
[NFC][ASAN] Sort includes

16 months ago[NFC][ASAN] Add const to getter
Vitaly Buka [Mon, 8 May 2023 07:47:36 +0000 (00:47 -0700)]
[NFC][ASAN] Add const to getter

16 months ago[CodeGen][ShrinkWrap] Split restore point
sgokhale [Mon, 8 May 2023 07:51:07 +0000 (13:21 +0530)]
[CodeGen][ShrinkWrap] Split restore point

Try to reland D42600

Differential Revision: https://reviews.llvm.org/D42600

16 months ago[test][lsan] Don't recompile the test
Vitaly Buka [Mon, 8 May 2023 07:41:22 +0000 (00:41 -0700)]
[test][lsan] Don't recompile the test

16 months ago[test][sanitizer] Improve test expectation
Vitaly Buka [Mon, 8 May 2023 07:31:10 +0000 (00:31 -0700)]
[test][sanitizer] Improve test expectation

Now we can fix sanitizers for the test one by one.

16 months ago[test][sanitizer] Check pthread_create return value
Vitaly Buka [Mon, 8 May 2023 07:26:39 +0000 (00:26 -0700)]
[test][sanitizer] Check pthread_create return value

16 months ago[NFC][ASAN] Use alignof instead of constant
Vitaly Buka [Mon, 8 May 2023 06:30:24 +0000 (23:30 -0700)]
[NFC][ASAN] Use alignof instead of constant

16 months ago[NFC][ASAN] Extract ThreadRegistry initialization
Vitaly Buka [Mon, 8 May 2023 06:29:48 +0000 (23:29 -0700)]
[NFC][ASAN] Extract ThreadRegistry initialization

16 months ago[clang][dataflow][NFC] Remove `SkipPast` parameter from `getStorageLocation(const...
Martin Braenne [Mon, 8 May 2023 06:38:42 +0000 (06:38 +0000)]
[clang][dataflow][NFC] Remove `SkipPast` parameter from `getStorageLocation(const ValueDecl &).

This parameter was already a no-op, so removing it doesn't change behavior.

Depends On D149144

Reviewed By: ymandel, xazax.hun, gribozavr2

Differential Revision: https://reviews.llvm.org/D149151

16 months ago[MachineLateInstrsCleanup] Improve compile time for huge functions.
Jonas Paulsson [Sun, 2 Apr 2023 18:23:34 +0000 (20:23 +0200)]
[MachineLateInstrsCleanup] Improve compile time for huge functions.

It was discovered that this pass could be slow on huge functions, meaning 20%
compile time instead of the usual ~0.5% (with a test case spending ~19 mins
just in the backend).

The problem related to the necessary clearing of earlier kill flags when a
redundant instruction is removed. With this patch, the handling of kill flags
is now done by maintaining a map instead of scanning backwards in the
function. This remedies the compile time on the huge file fully.

Reviewed By: vpykhtin, arsenm

Differential Revision: https://reviews.llvm.org/D147532

Resolves https://github.com/llvm/llvm-project/issues/61397

16 months ago[CodeGen] Autogen tests as prerequisite for D42600
sgokhale [Mon, 8 May 2023 06:55:51 +0000 (12:25 +0530)]
[CodeGen] Autogen tests as prerequisite for D42600

Autogenerating tests as suggested in D42600

16 months ago[RISCV] Add MC support of RISCV zcmp Extension
WuXinlong [Mon, 8 May 2023 05:21:00 +0000 (13:21 +0800)]
[RISCV] Add MC support of RISCV zcmp Extension

This patch add the instructions of zcmp extension.

Instructions in zcmp extension try to optimise `mv` inst and the prologue & epilogue in functions

co-author: @Scott Egerton, @ZirconLiu, @Lukacma, @Heda Chen, @luxufan, @heyiliang, @liaochunyu

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D132819

16 months ago[NFC][ASAN] Reformat the file
Vitaly Buka [Mon, 8 May 2023 06:23:30 +0000 (23:23 -0700)]
[NFC][ASAN] Reformat the file

16 months agoRevert "[InstCombine] Improve bswap + logic_op optimization"
Noah Goldstein [Mon, 8 May 2023 05:34:39 +0000 (00:34 -0500)]
Revert "[InstCombine] Improve bswap + logic_op optimization"

The generic cast to `BinaryOperator` can break if `V` is not a
`BinaryOperator` (i.e a `ConstantExpr`). This occurs in things like
PPC linux build.

This reverts commit fe733f54da6faca95070b36b1640dbca3e43d396.

16 months ago[gn build] Port 8d657c461a5a
LLVM GN Syncbot [Mon, 8 May 2023 05:27:42 +0000 (05:27 +0000)]
[gn build] Port 8d657c461a5a

16 months ago[X86][AsmParser] Refactor code in AsmParser
Shengchen Kan [Sun, 7 May 2023 14:20:36 +0000 (22:20 +0800)]
[X86][AsmParser] Refactor code in AsmParser

1. Share code `optimizeInstFromVEX3ToVEX2` with MCInstLower
2. Move the code of optimization for shift/rotate to a separate file

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D150068

16 months ago[SCEV][reland] More precise trip multiples
Joshua Cao [Tue, 25 Apr 2023 00:51:01 +0000 (17:51 -0700)]
[SCEV][reland] More precise trip multiples

We currently have getMinTrailingZeros(), from which we can get a SCEV's
multiple by computing 1 << MinTrailingZeroes. However, this only gets us
multiples that are a power of 2. This patch introduces a way to get max
constant multiples that are not just a power of 2. The logic is similar
to that of getMinTrailingZeros. getMinTrailingZerosImpl is replaced by
computing the max constant multiple, and counting the number of trailing
bits.

I have so far found this useful in two places:

1) Computing unsigned constant ranges. For example, if we have i8
   {10,+,10}<nuw>, we know the max constant it can be is 250.

2) My original intent was to use this in getSmallConstantTripMultiples,
   but it has no effect right now due to change from D110587. For
   example, if we have backedge count `(6 * %N) - 1`, the trip count
   becomes `1 + zext((6 * %N) - 1)`, and we cannot say that 6 is a
   multiple of the SCEV. I plan to look further into this separately.

The implementation assumes the value is unsigned. It can probably be
extended to handle signed values as well.

If the code sees that a SCEV does not have <nuw>, it will fall back to
finding the max multiple that is a power of 2. Multiples that are a
power of 2 will still be a multiple even after the SCEV overflows. This
does not apply to other values. This is the 1st commit message:

---

This relands https://reviews.llvm.org/D141823. The verification fails
when expensive checks are turned on. This can occur when:

1. SCEV S's multiple is cached
2. SCEV S's no wrap flags are strengthened, and the multiple changes
3. SCEV verifier finds that S's cached and recomputed multiple are
   different

We eliminate most cases by forgetting SCEVAddRecExpr's cached values
when the flags are modified, but there are still cases for other SCEV
types. We relax the check by making sure the cached multiple divides the
recomputed multiple, ensuring the cached multiple is correct,
conservative multiple.

Reviewed By: mkazantsev

Differential Revision: https://reviews.llvm.org/D149529

16 months ago[DWARF][MC] improve the error message when DwarfLineStrSection is null.
esmeyi [Mon, 8 May 2023 04:55:27 +0000 (00:55 -0400)]
[DWARF][MC] improve the error message when DwarfLineStrSection is null.

Summary: Currently the crush info is ambiguous when DwarfLineStrSection is null. The patch adds an assertion in the constructor of MCDwarfLineStr when DwarfLineStrSection is null.

Reviewed By: shchenz

Differential Revision: https://reviews.llvm.org/D149121

16 months ago[MC][ARM] Fix redundant errors for .quad/.8byte relocations on ELF
Fangrui Song [Mon, 8 May 2023 04:41:38 +0000 (21:41 -0700)]
[MC][ARM] Fix redundant errors for .quad/.8byte relocations on ELF

For a .quad/.8byte directive that needs a relocation, Mach-O emits one error
while ELF emits two. Emit just one for ELF and change the diagnostic to match
other ports.

16 months ago[MC] x86-32: properly report error for .quad relocation
Fangrui Song [Mon, 8 May 2023 03:57:07 +0000 (20:57 -0700)]
[MC] x86-32: properly report error for .quad relocation

Fix a llvm_unreachable crash in -DLLVM_ENABLE_ASSERTIONS=on builds and
possible accept-invalid in -DLLVM_ENABLE_ASSERTIONS=off builds.

16 months ago[LoongArch] Add some comments to getBPReg. NFC
wanglei [Mon, 8 May 2023 03:31:51 +0000 (11:31 +0800)]
[LoongArch] Add some comments to getBPReg. NFC

16 months ago[DWARFLinker] Remove an unused raw_svector_ostream
Fangrui Song [Mon, 8 May 2023 03:20:25 +0000 (20:20 -0700)]
[DWARFLinker] Remove an unused raw_svector_ostream

16 months agoMCDwarfFrameEmitter::EncodeAdvanceLoc: use SmallVectorImpl instead of raw_ostream...
Fangrui Song [Mon, 8 May 2023 02:32:53 +0000 (19:32 -0700)]
MCDwarfFrameEmitter::EncodeAdvanceLoc: use SmallVectorImpl instead of raw_ostream. NFC

Similar to 49488490d195591bfc90daef111cd7293f8c80aa.
Remove MCDwarfFrameEmitter::EmitAdvanceLoc which is only called once.

16 months ago[gn build] Port 746cf7e38cc4
LLVM GN Syncbot [Mon, 8 May 2023 01:38:47 +0000 (01:38 +0000)]
[gn build] Port 746cf7e38cc4

16 months ago[libc++] Use the __is_trivially_equality_comparable builtin
Nikolas Klauser [Sun, 7 May 2023 18:18:32 +0000 (11:18 -0700)]
[libc++] Use the __is_trivially_equality_comparable builtin

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D148553

16 months ago[libc++][Modules] Add missing includes and exports
Ian Anderson [Sun, 7 May 2023 00:26:49 +0000 (19:26 -0500)]
[libc++][Modules] Add missing includes and exports

Several headers are missing includes for things they use.

type_traits.is_enum needs to export type_traits.integral_constant so that clients can access its `value` member without explicitly including __type_traits/integral_constant.h themselves.

Make `subrange_fwd` a peer submodule to `subrange` rather than a submodule of it, and have `subrange` export `subrange_fwd`. That will make it easier to programmatically generate modules for the private detail headers, and it will accomplish the same effect that __ranges/subrange.h will make subrange_kind visible.

Reviewed By: Mordante, #libc

Differential Revision: https://reviews.llvm.org/D150055

16 months ago[libc++] test/libcxx/transitive_includes.sh.cpp dumps loads of unhelpful preprocessor...
Ian Anderson [Sun, 7 May 2023 00:50:33 +0000 (19:50 -0500)]
[libc++] test/libcxx/transitive_includes.sh.cpp dumps loads of unhelpful preprocessor output when it fails

Send stdout to dev/null since the preprocessor output isn't relevant to the test and is tons of noise when the test fails.

Reviewed By: Mordante, #libc, philnik

Differential Revision: https://reviews.llvm.org/D150056

16 months agoReland D147524 "[LoongArch] Provide basic TargetTransformInfo implementation"
Zhao Qi [Mon, 8 May 2023 00:40:06 +0000 (08:40 +0800)]
Reland D147524 "[LoongArch] Provide basic TargetTransformInfo implementation"

This patch only provides basic LoongArchTTIImpl, and more hooks
will be added to provide TTI machinery for LoongArch soon.

Reviewed By: SixWeining, xen0n

Differential Revision: https://reviews.llvm.org/D147524

16 months agoRevert "[LoongArch] Provide basic TargetTransformInfo implementation"
Weining Lu [Mon, 8 May 2023 00:37:44 +0000 (08:37 +0800)]
Revert "[LoongArch] Provide basic TargetTransformInfo implementation"

This reverts commit 040a41a852933d3d1b855aebc8b054baa60f61e2.

Author name is wrong.

16 months ago[libc] Use Linux errno and signal strings for Fuchsia
Roland McGrath [Sat, 6 May 2023 08:35:56 +0000 (01:35 -0700)]
[libc] Use Linux errno and signal strings for Fuchsia

The exact set of supported values is determined by the <errno.h>
and <signal.h> headers, which don't (yet) come from llvm-libc on
Fuchsia. The mappings of SIG* and E* codes to psignal/strsignal
and perror/strerror text used in Fuchsia libc today is the same
as for Linux.

Reviewed By: abrachet

Differential Revision: https://reviews.llvm.org/D150026

16 months ago[KnownBits] Improve `KnownBits::rem(X, Y)` in cases where we can deduce low-bits...
Noah Goldstein [Sun, 7 May 2023 21:46:49 +0000 (16:46 -0500)]
[KnownBits] Improve `KnownBits::rem(X, Y)` in cases where we can deduce low-bits of output

The first `cttz(Y)` bits in `X` are translated 1-1 in the output.

Alive2 Links:
    https://alive2.llvm.org/ce/z/Qc47p7
    https://alive2.llvm.org/ce/z/19ut5H

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D149421

16 months ago[KnownBits] Add tests for getting lowbits of `rem X, Y`; NFC
Noah Goldstein [Sun, 7 May 2023 21:46:46 +0000 (16:46 -0500)]
[KnownBits] Add tests for getting lowbits of `rem X, Y`; NFC

Reviewed By: foad

Differential Revision: https://reviews.llvm.org/D149420

16 months ago[X86] Lower used `(atomicrmw xor p, SignBit)` as `(atomicrmw add p, SignBit)`
Noah Goldstein [Sun, 7 May 2023 21:46:20 +0000 (16:46 -0500)]
[X86] Lower used `(atomicrmw xor p, SignBit)` as `(atomicrmw add p, SignBit)`

`(xor X, SignBit)` == `(add X, SignBit)`. For atomics whose result is
used, the `add` option is preferable because of the `xadd` instruction
which allows us to avoid either a CAS loop or a `btc; setcc; shl`.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D149689

16 months ago[X86] Add tests for `(atomicrmw xor p, Imm)`; NFC
Noah Goldstein [Sun, 7 May 2023 21:46:14 +0000 (16:46 -0500)]
[X86] Add tests for `(atomicrmw xor p, Imm)`; NFC

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D149687

16 months agoRevert "[clang] Make predefined expressions string literals under -fms-extensions"
Arthur Eubanks [Sun, 7 May 2023 23:50:33 +0000 (16:50 -0700)]
Revert "[clang] Make predefined expressions string literals under -fms-extensions"

This reverts commit 856f384bf94513c89e754906b7d80fbe5377ab53.

Breaks bots, e.g. https://lab.llvm.org/buildbot/#/builders/123/builds/18775

16 months agoRevert "[AArch64] Emit FNMADD instead of FNEG(FMADD)"
Manoj Gupta [Sun, 7 May 2023 23:09:37 +0000 (16:09 -0700)]
Revert "[AArch64] Emit FNMADD instead of FNEG(FMADD)"

This reverts commit ea228bd0bd0173ffd4aac497a312a852e8f7ffad.

Cuases a crash on AArch64. Testcase provided at D149260.

16 months ago[MC] MCDwarfLineAddr::Encode: use SmallVectorImpl instead of raw_ostream. NFC
Fangrui Song [Sun, 7 May 2023 23:26:52 +0000 (16:26 -0700)]
[MC] MCDwarfLineAddr::Encode: use SmallVectorImpl instead of raw_ostream. NFC

Similar to D145791: most call sites need a SmallString, but have to provide a
raw_svector_ostream wrapper with unneeded abstraction and overhead:

raw_ostream::write =(inlinable)=> flush_tied_then_write (unneeded TiedStream check) =(virtual function call)=> raw_svector_ostream::write_impl ==> SmallVector append(ItTy in_start, ItTy in_end) (range; less efficient then push_back).

Just use SmallVectorImpl to simplify and optimize code. Unfortunately most call
sites use SmallString, so we have to use SmallVectorImpl<char> instead of
<uint8_t> to avoid large refactoring.

16 months ago[NFC][HWASAN] Add more pthread interceptors
Vitaly Buka [Sun, 7 May 2023 23:12:04 +0000 (16:12 -0700)]
[NFC][HWASAN] Add more pthread interceptors

They are empty for now. Follow up patches will introduce behaviour
changes.

16 months ago[NFC][LSAN] Add more pthread interceptors
Vitaly Buka [Sat, 6 May 2023 21:50:34 +0000 (14:50 -0700)]
[NFC][LSAN] Add more pthread interceptors

They are empty for now. Follow up patches will introduce behaviour
changes.

16 months ago[NFC][ASAN] Add more pthread interceptors
Vitaly Buka [Sat, 6 May 2023 20:01:08 +0000 (13:01 -0700)]
[NFC][ASAN] Add more pthread interceptors

They are empty for now. Follow up patches will introduce behaviour
changes.

16 months ago[NFC][HWASAN] Fix mutex in thread safety annotation
Vitaly Buka [Sun, 7 May 2023 06:58:32 +0000 (23:58 -0700)]
[NFC][HWASAN] Fix mutex in thread safety annotation

16 months ago[NFC][HWASAN] Reformat InitializeInterceptors
Vitaly Buka [Sat, 6 May 2023 21:57:45 +0000 (14:57 -0700)]
[NFC][HWASAN] Reformat InitializeInterceptors

16 months ago[test][sanitizer] Extend the test
Vitaly Buka [Sun, 7 May 2023 22:31:59 +0000 (15:31 -0700)]
[test][sanitizer] Extend the test

Add pthread_exit and pthread_attr_setdetachstate.

16 months ago[NFC][AArch64][GlobalISel] Add a gisel run line for shift-logic.ll
Amara Emerson [Sun, 7 May 2023 22:43:01 +0000 (15:43 -0700)]
[NFC][AArch64][GlobalISel] Add a gisel run line for shift-logic.ll

16 months ago[RISCV] Use inheritance instead of nesting multiclass instantiaions. NFC
Craig Topper [Sun, 7 May 2023 22:00:51 +0000 (15:00 -0700)]
[RISCV] Use inheritance instead of nesting multiclass instantiaions. NFC

16 months ago[RISCV] Ues PatGpr to reduce some tablegen code. NFC
Craig Topper [Sun, 7 May 2023 22:00:45 +0000 (15:00 -0700)]
[RISCV] Ues PatGpr to reduce some tablegen code. NFC

16 months ago[DAG] Calculate the number of sign bits for constant BUILD_VECTOR directly.
David Green [Sun, 7 May 2023 21:31:10 +0000 (22:31 +0100)]
[DAG] Calculate the number of sign bits for constant BUILD_VECTOR directly.

For constant BUILD_VECTORs the operands need to be legal types. This can mean
that when the number of sign bits is calculated it may look that the entire
constant and inefficiently produce less sign bits than it could. For example i8
vectors could use i32 elements, for which 0x000000ff would be incorrectly
limited to 1 sign bit as the original value has 24 sign bits. This makes it
look at the constant directly, truncated to the correct type for the element so
that it can correctly return 8.

Differential Revision: https://reviews.llvm.org/D149956

16 months ago[X86] lowerShuffleAsElementInsertion - fold to or(vzext_movl(scalar_to_vector(zext...
Simon Pilgrim [Sun, 7 May 2023 18:47:28 +0000 (19:47 +0100)]
[X86] lowerShuffleAsElementInsertion - fold to or(vzext_movl(scalar_to_vector(zext(x))), and(constant, mask))

The logic in this function is a bit of a mess, but masking a vector constant should allow us to OR the zero-extended i8/i16 scalar value in place.

We can do more here - reusing the OR pattern if the relevant unused elements are known zero etc. but this is enough to address a regression from D127115.

16 months agoObjectFile: introduce a COFF object file plugin
Saleem Abdulrasool [Sun, 7 May 2023 18:12:43 +0000 (11:12 -0700)]
ObjectFile: introduce a COFF object file plugin

Windows uses COFF as an object file format and PE/COFF as an executable
file format. They are subtly different and certain elements of a COFF
file may not be present in an executable. Introduce a new plugin to add
support for the COFF object file format which is required to support
loading of modules built with -gmodules. This is motivated by Swift
which serialises debugging information into a PCM which is a COFF object
file.

Differential Revision: https://reviews.llvm.org/D149987
Reviewed By: bulbazord

16 months ago[clang] Make predefined expressions string literals under -fms-extensions
Arthur Eubanks [Sun, 7 May 2023 18:24:48 +0000 (11:24 -0700)]
[clang] Make predefined expressions string literals under -fms-extensions

MSVC makes these string literals [1][2].

[1] https://godbolt.org/z/6vnTzbExx
[2] https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-170

Fixes #114

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D146764

16 months ago[clang-tidy][NFC] Split bugprone-exception-escape tests
Piotr Zegar [Sun, 7 May 2023 17:19:33 +0000 (17:19 +0000)]
[clang-tidy][NFC] Split bugprone-exception-escape tests

Split tests files into noexcept and throw().
This is preparation for a C++20 support in this check.

Reviewed By: carlosgalvezp

Differential Revision: https://reviews.llvm.org/D148458

16 months ago[X86] Add getConstVector helper variant without undef mask
Simon Pilgrim [Sun, 7 May 2023 17:25:47 +0000 (18:25 +0100)]
[X86] Add getConstVector helper variant without undef mask

16 months ago[VPlan] Use RecipeBuilder to look up member when fixing IG (NFC).
Florian Hahn [Sun, 7 May 2023 17:02:27 +0000 (18:02 +0100)]
[VPlan] Use RecipeBuilder to look up member when fixing IG (NFC).

Recipes for interleave group members are recorded directly in the
RecipeBuilder. Use it directly instead of going indirectly through
VPlan's Value->VPValue mapping.

16 months ago[clang-tidy] Support SystemHeaders in .clang-tidy
Carlos Galvez [Thu, 4 May 2023 19:47:41 +0000 (19:47 +0000)]
[clang-tidy] Support SystemHeaders in .clang-tidy

A previous patch update the clang-tidy documentation
incorrectly claiming that SystemHeaders can be provided
in the .clang-tidy configuration file.

This patch adds support for it, together with tests.

Differential Revision: https://reviews.llvm.org/D149899

16 months ago[Tests] Preserve original test scenario
Dávid Bolvanský [Sun, 7 May 2023 14:55:16 +0000 (16:55 +0200)]
[Tests] Preserve original test scenario

16 months ago[flang][hlfir] Add TODO for polymorphic vector subscripted entities
Jean Perier [Sun, 7 May 2023 14:24:45 +0000 (16:24 +0200)]
[flang][hlfir] Add TODO for polymorphic vector subscripted entities

I removed the barriers a bit fast. Some mold is needed on
hlfir.elemental for polymorphic vector subscripted designator (and for
parenthesized polymorphic) so that a temporary can be later created.

The parenthesized array case may also just used asExpr and that
could later use AssignTemporary to deal with this. But the vector
subscripted designator case will need to use some new runtime
to get some mold allocation done for the temp.

Add TODOs in the meantime.

Differential Revision: https://reviews.llvm.org/D149970

16 months ago[MC][X86] Fix encoding for VMOVPQIto64Zmr for correct disassembly
Simon Pilgrim [Sun, 7 May 2023 14:25:13 +0000 (15:25 +0100)]
[MC][X86] Fix encoding for VMOVPQIto64Zmr for correct disassembly

Fixes #62412

16 months ago[MC][X86] Add test coverage for Issue #62412
Simon Pilgrim [Sun, 7 May 2023 13:57:57 +0000 (14:57 +0100)]
[MC][X86] Add test coverage for Issue #62412

16 months ago[bazel] Make labels to third-party dependencies explicit
Aaron Siddhartha Mondal [Sun, 7 May 2023 13:34:15 +0000 (15:34 +0200)]
[bazel] Make labels to third-party dependencies explicit

Prefix occurrences of `//utils/bazel` with an explicit `@llvm-raw`.

This change lets us reuse code from `configure.bzl` in future compatibility patches for the bzlmod
module system.

The llvm-project overlay will be made available as an `@llvm-project-overlay` (name WIP) module in
the Bazel Central Registry. This means that we will have an `@llvm-project-overlay` workspace in
addition to the `@llvm-raw` and `@llvm-project` workspaces currently involved in the build. To keep
future patches to the existing build files as small as possible, the explicit naming proposed in this
change appears to be the simplest way to not confuse the module workspace resolution.

This is not a functional change to the current WORKSPACE build. It is a foundation for future patches.

GitHub Issue in the BCR: https://github.com/bazelbuild/bazel-central-registry/issues/206
GitHub Issue in LLVM: https://github.com/llvm/llvm-project/issues/55924

Reviewed By: csigg

Differential Revision: https://reviews.llvm.org/D136496

16 months ago[SLC] Use unsigned char to fix test failures on some platforms
Dávid Bolvanský [Sun, 7 May 2023 13:50:36 +0000 (15:50 +0200)]
[SLC] Use unsigned char to fix test failures on some platforms

16 months ago[MC][X86] Split off avx512vpopcntdq tests and add att/intel coverage
Simon Pilgrim [Sun, 7 May 2023 13:42:37 +0000 (14:42 +0100)]
[MC][X86] Split off avx512vpopcntdq tests and add att/intel coverage

16 months ago[InstCombine] Improve bswap + logic_op optimization
Austin Chang [Sun, 7 May 2023 13:27:59 +0000 (14:27 +0100)]
[InstCombine] Improve bswap + logic_op optimization

The patch implements a helper function that matches and fold the following cases in the InstCombine pass:

    bswap(logic_op(x, bswap(y))) -> logic_op(bswap(x), y)
    bswap(logic_op(bswap(x), y)) -> logic_op(x, bswap(y))
    bswap(logic_op(bswap(x), bswap(y))) -> logic_op(x, y) in multiuse case, which still reduces the number of instructions.

The helper function accepts bswap and bitreverse intrinsics. This patch folds the bswap cases and remain the bitreverse optimization for the future

Differential Revision: https://reviews.llvm.org/D149699

16 months ago[InstCombine] Add bswap(logic_op(bswap(x), y)) regression test case; NFC
Austin Chang [Sun, 7 May 2023 13:24:56 +0000 (14:24 +0100)]
[InstCombine] Add bswap(logic_op(bswap(x), y)) regression test case; NFC

Fold the following case on IR InstCombine pass. This patch includes the new test cases for this optimization

bswap(logic_op(x, bswap(y))) -> logic_op(bswap(x), y)
bswap(logic_op(bswap(x), y)) -> logic_op(x, bswap(y))
bswap(logic_op(bswap(x), bswap(y))) -> logic_op(x, y) with multi-use

Differential Revision: https://reviews.llvm.org/D149577

16 months ago[SimplifyLibCalls] Transform memchr(STR, C, N) to chain of ORs
Dávid Bolvanský [Sun, 7 May 2023 13:00:53 +0000 (15:00 +0200)]
[SimplifyLibCalls] Transform memchr(STR, C, N) to chain of ORs

Motivation:

```
#include <string_view>

size_t findFirst_ABCDEF(std::string_view sv) {
  return sv.find_first_of("ABCDEF");
}
```

memchr("ABCDEF", C,  6) != NULL -> (C == 'A' || C == 'B' || C == 'C' || C == 'D' || C == 'E' || C == 'F') != 0

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D128011

16 months ago[ASAN] Support memory checks on vp.load/store.
Yeting Kuo [Sun, 7 May 2023 08:33:36 +0000 (16:33 +0800)]
[ASAN] Support memory checks on vp.load/store.

The patch adds new member MaybeEVL into InterestingMemoryOperand to represent
the effective vector length for vp intrinsics. It may be extended for some target intrinsics in the future.

Reviewed By: kito-cheng

Differential Revision: https://reviews.llvm.org/D146208

16 months agoRevert "[libc++] Soft-fail the two sanitizer jobs that have been failing in CI for...
Mark de Wever [Sun, 7 May 2023 10:39:18 +0000 (12:39 +0200)]
Revert "[libc++] Soft-fail the two sanitizer jobs that have been failing in CI for a while"

This reverts commit 3e44aa659b98674a1220da235bc2cbafcb311a78.

The CI has been fixed so this band aid is no longer needed.

16 months ago[libc++] Modernizes the forwarded ios headers.
Mark de Wever [Sat, 6 May 2023 09:45:13 +0000 (11:45 +0200)]
[libc++] Modernizes the forwarded ios headers.

Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D150030

16 months ago[RISCV] Make zve32f imply F and zve64d imply D.
Craig Topper [Sun, 7 May 2023 06:17:16 +0000 (23:17 -0700)]
[RISCV] Make zve32f imply F and zve64d imply D.

The 1.0 vector spec PDF has text that says that Zve32f is compatible
with F or Zfinx and that Zve64d is compatible with D and Zdinx.
The references to *inx were removed from the spec in the github repository in
October 2021. The 1.0 pdf was made in September 2021.

Relevant commit https://github.com/riscv/riscv-v-spec/commit/6fedb869e213da03f36092d661d14911a2f9d2c6

Reviewed By: jacquesguan

Differential Revision: https://reviews.llvm.org/D150021

16 months ago[clang-format] Don't indent Verilog `begin` keyword on its own line
sstwcw [Sun, 7 May 2023 05:12:20 +0000 (05:12 +0000)]
[clang-format] Don't indent Verilog `begin` keyword on its own line

When the line is too long and the `begin` keyword wraps to the next
line, it shouldn't be indented.

Reviewed By: HazardyKnusperkeks

Differential Revision: https://reviews.llvm.org/D149657

16 months ago[clang-format] Recognize Verilog edge identifiers
sstwcw [Sun, 7 May 2023 05:12:18 +0000 (05:12 +0000)]
[clang-format] Recognize Verilog edge identifiers

Previously the event expression would be misidentified as a port list.
A line break would be added after the comma.  The events can be
separated with either a comma or the `or` keyword, and a line break
would not be inserted if the `or` keyword was used.  We changed the
behavior of the comma to match the `or` keyword.

Before:
```
always @(posedge x,
         posedge y)
  x <= x;
always @(posedge x or posedge y)
  x <= x;
```

After:
```
always @(posedge x, posedge y)
  x <= x;
always @(posedge x or posedge y)
  x <= x;
```

Reviewed By: HazardyKnusperkeks

Differential Revision: https://reviews.llvm.org/D149561

16 months ago[lldb] [NetBSD] getValue => operator* for Optional migration
Nikita Ronja Gillmann [Sat, 6 May 2023 10:36:55 +0000 (12:36 +0200)]
[lldb] [NetBSD] getValue => operator* for Optional migration

Differential Revision: https://reviews.llvm.org/D150032

16 months ago[bazel] Fix missing deps for layering check
Aaron Siddhartha Mondal [Sun, 7 May 2023 03:55:24 +0000 (05:55 +0200)]
[bazel] Fix missing deps for layering check

Reviewed By: #bazel_build, stellaraccident

Differential Revision: https://reviews.llvm.org/D150058

16 months ago[OpenMP] Make `libomptarget` link against `libomp`
Shilei Tian [Sun, 7 May 2023 03:26:43 +0000 (23:26 -0400)]
[OpenMP] Make `libomptarget` link against `libomp`

In `libomptarget` we use a couple of functions from `libomp`, but we didn't link
`libomptarget` against `libomp`. That will not work on some platforms such
as macOS. A linker error will be encountered because those symbols are not resolved
at link time when building `libomptarget`. This patch simply makes `libomptarget`
link agains `libomp`, makes it a "user" of `libomp`. I think this will not break
the policies between `libomp` and `libomptarget`.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D149617

16 months ago[NFC][OpenMP] Remove trailing whitespaces in `openmp/runtime/src/CMakeLists.txt`
Shilei Tian [Sun, 7 May 2023 03:19:14 +0000 (23:19 -0400)]
[NFC][OpenMP] Remove trailing whitespaces in `openmp/runtime/src/CMakeLists.txt`

16 months ago[gn] port 3b6bc87 more
Nico Weber [Sun, 7 May 2023 02:43:02 +0000 (22:43 -0400)]
[gn] port 3b6bc87 more

16 months ago[gn build] Port 6ab43f9b87ce
LLVM GN Syncbot [Sun, 7 May 2023 02:22:39 +0000 (02:22 +0000)]
[gn build] Port 6ab43f9b87ce

16 months ago[gn build] Port 5902bb9584d6
LLVM GN Syncbot [Sun, 7 May 2023 02:22:38 +0000 (02:22 +0000)]
[gn build] Port 5902bb9584d6

16 months ago[gn build] Port 3b6bc8752027
LLVM GN Syncbot [Sun, 7 May 2023 02:22:37 +0000 (02:22 +0000)]
[gn build] Port 3b6bc8752027

16 months ago[gn build] Port 040a41a85293
LLVM GN Syncbot [Sun, 7 May 2023 02:22:36 +0000 (02:22 +0000)]
[gn build] Port 040a41a85293

16 months ago[gn] port e7e3711885133
Nico Weber [Sun, 7 May 2023 02:22:25 +0000 (22:22 -0400)]
[gn] port e7e3711885133

16 months ago[gn] port 95bb95ebe448
Nico Weber [Sun, 7 May 2023 02:21:04 +0000 (22:21 -0400)]
[gn] port 95bb95ebe448

16 months ago[X86][AsmParser] Move include forward to reduce unnecessary declaration, NFCI
Shengchen Kan [Sun, 7 May 2023 01:43:20 +0000 (09:43 +0800)]
[X86][AsmParser] Move include forward to reduce unnecessary declaration, NFCI

16 months ago[InstCombine] Remove Descale
Kazu Hirata [Sun, 7 May 2023 01:20:19 +0000 (18:20 -0700)]
[InstCombine] Remove Descale

The last use of Descale was removed on Apr 6, 2023 in commit
db6b30b1831095c216378a9df215b7c0ae6b959f.

Differential Revision: https://reviews.llvm.org/D150045

16 months ago[ARM] Remove unused declaration RematerializeIterCount
Kazu Hirata [Sun, 7 May 2023 00:31:40 +0000 (17:31 -0700)]
[ARM] Remove unused declaration RematerializeIterCount

The corresponding function definition was removed by:

  commit af45907653fd312264632b616eff0fad1ae1eb2e
  Author: Sjoerd Meijer <sjoerd.meijer@arm.com>
  Date:   Mon Jun 29 15:40:03 2020 +0100

16 months ago[ARM] Remove unused declaration LowerGLOBAL_OFFSET_TABLE
Kazu Hirata [Sun, 7 May 2023 00:31:39 +0000 (17:31 -0700)]
[ARM] Remove unused declaration LowerGLOBAL_OFFSET_TABLE

The unused declaration was introduced without a corresponding function
definition by:

  commit bd41cf880c9f3a65c9366565fa4db2ddb6b57e1c
  Author: Tim Northover <tnorthover@apple.com>
  Date:   Thu Jan 7 09:03:03 2016 +0000

16 months ago[ARM] Remove unused declaration EmitPatchedInstruction
Kazu Hirata [Sun, 7 May 2023 00:31:37 +0000 (17:31 -0700)]
[ARM] Remove unused declaration EmitPatchedInstruction

The corresponding function definition was removed by:

  commit db092d7aebb52699d800f20324f19970c2413a2d
  Author: Craig Topper <craig.topper@gmail.com>
  Date:   Tue Oct 9 04:23:49 2012 +0000

16 months ago[X86] or-with-overflow.ll - adjust or_i64_ri constant to not constant fold the icmp
Simon Pilgrim [Sat, 6 May 2023 21:42:14 +0000 (22:42 +0100)]
[X86] or-with-overflow.ll - adjust or_i64_ri constant to not constant fold the icmp

Better KnownBits handling of the icmp and/or an upcoming USUBSAT fold would constant fold this test away and prevent us testing for a cleared overflow flag.

16 months ago[DAG] computeOverflowForUnsignedAdd - use ConstantRange::unsignedAddMayOverflow as...
Simon Pilgrim [Sat, 6 May 2023 21:03:25 +0000 (22:03 +0100)]
[DAG] computeOverflowForUnsignedAdd - use ConstantRange::unsignedAddMayOverflow as fallback

Replaces the more specific uadd_ov case

16 months ago[lldb] Fix language label in ObjC Language unittest
Caroline Tice [Sat, 6 May 2023 07:04:57 +0000 (00:04 -0700)]
[lldb] Fix language label in ObjC Language unittest

The recently added ObjC Language unittest, InvalidMethondNameParsing, currently has CPlusPlusLanguage as its language label (see https://reviews.llvm.org/D149804). There is already a test with the same name and same language label in the C++ Language unittests, so this creates a name conflict. This patch corrects the language label on the ObjC test.

Differential Revision: https://reviews.llvm.org/D150019

16 months ago[mlir][doc] Fix typos in mlir/docs/LangRef.md
Yan Xin [Sat, 6 May 2023 18:52:28 +0000 (11:52 -0700)]
[mlir][doc] Fix typos in mlir/docs/LangRef.md

It fixes some typos in the language reference.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D150046

16 months ago[DAG] computeOverflowForUnsignedAdd - use getMaxValue().ult(2) to detect 0/1 values...
Simon Pilgrim [Sat, 6 May 2023 18:45:16 +0000 (19:45 +0100)]
[DAG] computeOverflowForUnsignedAdd - use getMaxValue().ult(2) to detect 0/1 values. NFCI.

16 months ago[libc] Fix typos in documentation
Kazu Hirata [Sat, 6 May 2023 18:26:32 +0000 (11:26 -0700)]
[libc] Fix typos in documentation

16 months ago[PowerPC] Remove dead declaration mightUseCTR
Kazu Hirata [Sat, 6 May 2023 18:26:31 +0000 (11:26 -0700)]
[PowerPC] Remove dead declaration mightUseCTR

The corresponding function definition was removed on Dec 2, 2022 in
commit b5e1fc19da9527b96665bc4937f96a60092e77c6.