platform/upstream/llvm.git
2 years ago[X86][AVX] matchUnaryShuffle - avoid creation of on-the-fly nodes (PR45974)
Simon Pilgrim [Sun, 30 Jan 2022 17:59:05 +0000 (17:59 +0000)]
[X86][AVX] matchUnaryShuffle - avoid creation of on-the-fly nodes (PR45974)

Don't extract the ANY/ZERO_EXTEND_VECTOR_INREG subvector source until we're definitely combining to a new node.

2 years ago[test][lld-macho] Improve LC_FUNCTION_STARTS test coverage
Keith Smiley [Sat, 29 Jan 2022 01:03:02 +0000 (17:03 -0800)]
[test][lld-macho] Improve LC_FUNCTION_STARTS test coverage

Previously functions that aren't included in the symtab were also
excluded from the function starts. Symbols missing from function starts
degrades the debugger experience in the case you don't have debug info
for them.

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

2 years ago[X86] Attempt to fold MOVMSK(CMPEQ(AND(X,C1),0)) -> MOVMSK(NOT(SHL(X,C2)))
Simon Pilgrim [Sun, 30 Jan 2022 15:53:21 +0000 (15:53 +0000)]
[X86] Attempt to fold MOVMSK(CMPEQ(AND(X,C1),0)) -> MOVMSK(NOT(SHL(X,C2)))

Allows pow2 mask tests to avoid an unnecessary constant load.

Noticed while investigating how to extend MatchVectorAllZeroTest to support more allof/anyof patterns.

2 years ago[X86] Add tests showing failure to fold MOVMSK(CMPEQ(AND(X,C1),0)) -> MOVMSK(NOT...
Simon Pilgrim [Sun, 30 Jan 2022 15:25:07 +0000 (15:25 +0000)]
[X86] Add tests showing failure to fold MOVMSK(CMPEQ(AND(X,C1),0)) -> MOVMSK(NOT(SHL(X,C2)))

This would allow pow2 mask tests to avoid an unnecessary constant load.

Noticed while investigating how to extend MatchVectorAllZeroTest to support more allof/anyof patterns.

2 years ago[InstCombine] Do not combine atomic and non-atomic loads
Ricky Zhou [Sun, 30 Jan 2022 15:05:11 +0000 (10:05 -0500)]
[InstCombine] Do not combine atomic and non-atomic loads

Before this change, InstCombine was willing to fold atomic and
non-atomic loads through a PHI node as long as the first PHI argument
is not an atomic load. The combined load would be non-atomic, which is
incorrect.

Fix this by only combining the loads in a PHI node when all of the
arguments are non-atomic loads.

Thanks to Eli Friedman for pointing out the bug at
https://github.com/llvm/llvm-project/issues/50777#issuecomment-981045342!

Fixes #50777

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

2 years ago[InstCombine] Add test reproducing PR51435 (NFC)
Ricky Zhou [Sun, 30 Jan 2022 15:03:49 +0000 (10:03 -0500)]
[InstCombine] Add test reproducing PR51435 (NFC)

Baseline test for D115113

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

2 years agoRevert "[InstCombine] Do not combine atomic and non-atomic loads"
Sanjay Patel [Sun, 30 Jan 2022 15:02:20 +0000 (10:02 -0500)]
Revert "[InstCombine] Do not combine atomic and non-atomic loads"

This reverts commit a2bb7313e62daa8aaa9b06fe57386ed7221a990a.

The baseline test was not pre-committed as expected.

2 years ago[InstCombine] Do not combine atomic and non-atomic loads
Ricky Zhou [Sun, 30 Jan 2022 14:28:56 +0000 (09:28 -0500)]
[InstCombine] Do not combine atomic and non-atomic loads

Before this change, InstCombine was willing to fold atomic and
non-atomic loads through a PHI node as long as the first PHI argument
is not an atomic load. The combined load would be non-atomic, which is
incorrect.

Fix this by only combining the loads in a PHI node when all of the
arguments are non-atomic loads.

Thanks to Eli Friedman for pointing out the bug at
https://github.com/llvm/llvm-project/issues/50777#issuecomment-981045342!

Fixes #50777

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

2 years ago[InstCombine] Use range for loops (NFC)
Ricky Zhou [Sun, 30 Jan 2022 14:08:42 +0000 (09:08 -0500)]
[InstCombine] Use range for loops (NFC)

Preliminary clean-up for D115113

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

2 years ago[InstCombine] Uppercase some variable names (NFC)
Ricky Zhou [Sun, 30 Jan 2022 13:57:48 +0000 (08:57 -0500)]
[InstCombine] Uppercase some variable names (NFC)

Uppercase some variable names, per LLVM coding standards. This change
intentionally does not rename every miscased variable, as a follow-up
change ( D116086 ) intends to eliminate many of those by switching
loops to range for loops.

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

2 years ago[mlir][linalg][bufferize] Fix insertion point InitTensorElimination
Matthias Springer [Sun, 30 Jan 2022 13:19:06 +0000 (22:19 +0900)]
[mlir][linalg][bufferize] Fix insertion point InitTensorElimination

There was a bug where some of the OpOperands needed in the replacement op were not in scope.

It does not matter where the replacement op is inserted. Any insertion point is OK as long as there are no dominance errors. In the worst case, the newly inserted op will bufferize out-of-place. This is no worse than not eliminating the InitTensorOp at all.

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

2 years ago[libc++][format][nfc] Move tests.
Mark de Wever [Sun, 30 Jan 2022 13:21:13 +0000 (14:21 +0100)]
[libc++][format][nfc] Move tests.

The formatter specialization tests were placed in the wrong
subdirectory. This moves them to the proper place.

2 years ago[libc++][doc] Update the release notes.
Mark de Wever [Sat, 22 Jan 2022 11:34:44 +0000 (12:34 +0100)]
[libc++][doc] Update the release notes.

I had a look at the changes since the last release and updated the
release notes with interesting changes.

It seems this time the release notes were already rather up to date :-)

If there are more interesting changes, please let me know and I'll
update the patch. I'd like to commit these changes latest next weekend
so they land before branching the 14.0 release.

I've added most active libc++ contributors. If I forgot anybody please add them.

Reviewed By: Quuxplusone, ldionne, philnik, #libc

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

2 years ago[mlir][bufferize][NFC] Move std BufferizableOpInterfaceImpl to std dialect
Matthias Springer [Sun, 30 Jan 2022 13:02:22 +0000 (22:02 +0900)]
[mlir][bufferize][NFC] Move std BufferizableOpInterfaceImpl to std dialect

Also reimplement `std-bufferize` in terms of BufferizableOpInterface-based bufferization. The old `std.select` bufferization pattern is no longer needed and deleted.

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

2 years ago[VPlan] Use VPlan to check if only the first lane is used.
Florian Hahn [Sun, 30 Jan 2022 13:07:29 +0000 (13:07 +0000)]
[VPlan] Use VPlan to check if only the first lane is used.

This removes the remaining dependence on LoopVectorizationCostModel from
buildScalarSteps and is required so it can be moved out of ILV.

It also improves allows us to remove a few unneeded instructions.

Reviewed By: Ayal

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

2 years ago[mlir][bufferize][NFC] Move scf BufferizableOpInterface impl to scf dialect
Matthias Springer [Sun, 30 Jan 2022 12:53:02 +0000 (21:53 +0900)]
[mlir][bufferize][NFC] Move scf BufferizableOpInterface impl to scf dialect

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

2 years agoUpdate BUILD.bazel.
Matthias Springer [Sun, 30 Jan 2022 12:48:37 +0000 (21:48 +0900)]
Update BUILD.bazel.

This should have been done as part of D118483.

2 years ago[mlir][bufferize] Merge tensor-constant-bufferize into arith-bufferize
Matthias Springer [Sun, 30 Jan 2022 12:23:28 +0000 (21:23 +0900)]
[mlir][bufferize] Merge tensor-constant-bufferize into arith-bufferize

The bufferization of arith.constant ops is also switched over to BufferizableOpInterface-based bufferization. The old implementation is deleted. Both implementations utilize GlobalCreator, now renamed to just `getGlobalFor`.

GlobalCreator no longer maintains a set of all created allocations to avoid duplicate allocations of the same constant. Instead, `getGlobalFor` scans the module to see if there is already a global allocation with the same constant value.

For compatibility reasons, it is still possible to create a pass that bufferizes only `arith.constant`. This pass (createConstantBufferizePass) could be deleted once all users were switched over to One-Shot bufferization.

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

2 years ago[InstCombine] remove incorrect gep(x, undef) -> undef optimization
Nuno Lopes [Sun, 30 Jan 2022 11:34:32 +0000 (11:34 +0000)]
[InstCombine] remove incorrect gep(x, undef) -> undef optimization
gep(x, undef) carries the provenance of x, so we can't replace it with any
pointer like undef.
This leaves room for improvement for the poison case, but that's currently
not possible as the demanded bits API doesn't distinguish between undef &
poison bits.

Fixes #44790

2 years ago[InstSimplify] fold 'xor X, poison' and 'div/rem X, poison' to poison
Nuno Lopes [Sun, 30 Jan 2022 10:46:54 +0000 (10:46 +0000)]
[InstSimplify] fold 'xor X, poison' and 'div/rem X, poison' to poison

2 years ago[NewGVN][NFC] add poison tests
Nuno Lopes [Sun, 30 Jan 2022 10:04:00 +0000 (10:04 +0000)]
[NewGVN][NFC] add poison tests

2 years ago[ELF] copyShtGroup: replace unordered_set<uint32_t> with DenseSet<uint32_t>. NFC
Fangrui Song [Sun, 30 Jan 2022 09:18:41 +0000 (01:18 -0800)]
[ELF] copyShtGroup: replace unordered_set<uint32_t> with DenseSet<uint32_t>. NFC

We don't need to support the empty/tombstone key section index.

2 years ago[ELF] crtbegin/crtend test: replace std::regex with hand-written matcher. NFC
Fangrui Song [Sun, 30 Jan 2022 09:11:19 +0000 (01:11 -0800)]
[ELF] crtbegin/crtend test: replace std::regex with hand-written matcher. NFC

My x86-64 lld executable is 18KiB smaller.

2 years ago[ELF][test] Test {crtbegin,crtend}{S,T}.o
Fangrui Song [Sun, 30 Jan 2022 09:08:09 +0000 (01:08 -0800)]
[ELF][test] Test {crtbegin,crtend}{S,T}.o

2 years ago[ELF] Simplify maybeCompress with lld::split. NFC
Fangrui Song [Sun, 30 Jan 2022 08:44:19 +0000 (00:44 -0800)]
[ELF] Simplify maybeCompress with lld::split. NFC

2 years ago[ELF] Optimize MergeInputSection::splitNonStrings with resize_for_overwrite. NFC
Fangrui Song [Sun, 30 Jan 2022 08:10:52 +0000 (00:10 -0800)]
[ELF] Optimize MergeInputSection::splitNonStrings with resize_for_overwrite. NFC

2 years ago[ELF] Add some Mips*Section to InStruct and change make<Mips*Section> to std::make_unique
Fangrui Song [Sun, 30 Jan 2022 07:55:29 +0000 (23:55 -0800)]
[ELF] Add some Mips*Section to InStruct and change make<Mips*Section> to std::make_unique

Similar to D116143. My x86-64 lld executable is 20+KiB smaller.

2 years ago[ELF] Remove make<std::unique_ptr<MemoryBuffer>>. NFC
Fangrui Song [Sun, 30 Jan 2022 07:35:15 +0000 (23:35 -0800)]
[ELF] Remove make<std::unique_ptr<MemoryBuffer>>. NFC

2 years ago[ELF] De-template getErrorPlace. NFC
Fangrui Song [Sun, 30 Jan 2022 07:05:54 +0000 (23:05 -0800)]
[ELF] De-template getErrorPlace. NFC

2 years ago[RISCV] Remove RISCVISD::BREV8 and use RISCVISD::GREV instead.
Craig Topper [Sun, 30 Jan 2022 06:19:15 +0000 (22:19 -0800)]
[RISCV] Remove RISCVISD::BREV8 and use RISCVISD::GREV instead.

We already have an ISD opcode for the more general GREV/GREVI
instructon. We can just use it with the encoding that corresponds
to the behavior of brev8. This is similar to what we do for orc.b
where we use the GORC ISD opcode.

2 years ago[RISCV] Rerrange RISCVInstrInfoZB.td to better group related wthings. NFC
Craig Topper [Sun, 30 Jan 2022 05:15:11 +0000 (21:15 -0800)]
[RISCV] Rerrange RISCVInstrInfoZB.td to better group related wthings. NFC

Especially placing W instructions/patterns near their non-W versions.

2 years ago[ELF] De-template getAndFeatures. NFC
Fangrui Song [Sun, 30 Jan 2022 04:11:59 +0000 (20:11 -0800)]
[ELF] De-template getAndFeatures. NFC

2 years ago[clang-tidy] Organize the release notes a little better
Richard [Sat, 29 Jan 2022 01:14:33 +0000 (18:14 -0700)]
[clang-tidy] Organize the release notes a little better

- Sort new checks by check name
- Sort changes to existing checks by check name
- Add docs for changes to readability-simplify-boolean-expr
- Move check changes from "Improvements to clang-tidy" to
  "Changes in existing checks" section

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

2 years ago[ELF] Make errorOrWarn opaque to decrease code size. NFC
Fangrui Song [Sun, 30 Jan 2022 03:31:09 +0000 (19:31 -0800)]
[ELF] Make errorOrWarn opaque to decrease code size. NFC

In my x86-64 lld, .text is -3.08Ki smaller.

2 years ago[RISCV] Use RVBUnary to simplify ZEXT_H_RV32/ZEXT_H_RV64 definitions. NFC
Craig Topper [Sun, 30 Jan 2022 02:26:20 +0000 (18:26 -0800)]
[RISCV] Use RVBUnary to simplify ZEXT_H_RV32/ZEXT_H_RV64 definitions. NFC

2 years ago[clang][AVR] Set '-fno-use-cxa-atexit' to default
Ben Shi [Fri, 28 Jan 2022 10:09:12 +0000 (10:09 +0000)]
[clang][AVR] Set '-fno-use-cxa-atexit' to default

AVR is baremetal environment, so the avr-libc does not support
'__cxa_atexit()'.

Reviewed By: MaskRay

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

2 years ago[Clang] Move XCore specific options from Clang.cpp to XCore.cpp
Ben Shi [Sat, 29 Jan 2022 12:42:06 +0000 (12:42 +0000)]
[Clang] Move XCore specific options from Clang.cpp to XCore.cpp

Reviewed By: MaskRay

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

2 years ago[ELF] Optimize obj.getSectionIndex. NFC
Fangrui Song [Sun, 30 Jan 2022 02:01:58 +0000 (18:01 -0800)]
[ELF] Optimize obj.getSectionIndex. NFC

2 years ago[ELF] Simplify eSyms. NFC
Fangrui Song [Sun, 30 Jan 2022 01:00:38 +0000 (17:00 -0800)]
[ELF] Simplify eSyms. NFC

2 years ago[ELF] createInputSection: remove unneeded argument. NFC
Fangrui Song [Sun, 30 Jan 2022 00:52:32 +0000 (16:52 -0800)]
[ELF] createInputSection: remove unneeded argument. NFC

2 years ago[ELF] Avoid repeated getObj construction in getSectionIndex. NFC
Fangrui Song [Sun, 30 Jan 2022 00:51:00 +0000 (16:51 -0800)]
[ELF] Avoid repeated getObj construction in getSectionIndex. NFC

2 years ago[ELF] Reorder InputSectionBase::parent. NFC
Fangrui Song [Sun, 30 Jan 2022 00:20:40 +0000 (16:20 -0800)]
[ELF] Reorder InputSectionBase::parent. NFC

Move it before others.

2 years ago[ELF] Reorder InputFile members. NFC
Fangrui Song [Sun, 30 Jan 2022 00:10:52 +0000 (16:10 -0800)]
[ELF] Reorder InputFile members. NFC

`symbols` is used frequently. Moving it before others can decrease offsets.

2 years ago[openmp][cmake] `CMAKE_INSTALL_BINDIR` usage should not be quoted
John Ericson [Fri, 28 Jan 2022 18:21:21 +0000 (18:21 +0000)]
[openmp][cmake] `CMAKE_INSTALL_BINDIR` usage should not be quoted

As @mstorsjo wrote in https://reviews.llvm.org/D117945#inline-1132920 :

> This change seems to have broken one aspect: When doing `ninja
install` I now get a warning saying `Error copying file "libomp.dll" to
"libiomp5md.dll".`, and `libiomp5md.dll` isn't installed.
>
> I believe the reason is that the inline cmake snippet is written to
`runtime/src/cmake_install.cmake` and then executed on install, but on
install, `${CMAKE_INSTALL_BINDIR}` isn't set (as `GNUInstallDirs` isn't
included there). Should this maybe expand `${CMAKE_INSTALL_BINDIR}`
right here instead of deferring it to the install cmake, or what's the
right course of action?

I agree that is the right course of action. We also agreed to restore the `CMAKE_INSTALL_PREFIX` that was there before, too.

Reviewed By: mstorsjo

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

2 years agoRemove reference to LLVMLibC as the doc has moved.
Jeff Bailey [Sat, 29 Jan 2022 15:54:23 +0000 (15:54 +0000)]
Remove reference to LLVMLibC as the doc has moved.

https://reviews.llvm.org/D117436 caused a build failure
due to this error.

Tested:
ninja docs-llvm-libc builds

Reviewed By: abrachet

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

2 years ago[ELF] --gdb-index: switch to SmallVector. NFC
Fangrui Song [Sat, 29 Jan 2022 23:24:56 +0000 (15:24 -0800)]
[ELF] --gdb-index: switch to SmallVector. NFC

2 years ago[libc++][test] Clean up libcxx/test/support/MoveOnly.h
Joe Loser [Fri, 28 Jan 2022 19:38:10 +0000 (14:38 -0500)]
[libc++][test] Clean up libcxx/test/support/MoveOnly.h

Remove copy and copy assignment rather than have them as private declarations.
They are superfluous given the move and move assignment.

As a drive-by, also specialize `std::hash` without reopening `namespace std`.

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

2 years ago[ELF] Refactor -z combreloc
Fangrui Song [Sat, 29 Jan 2022 22:45:58 +0000 (14:45 -0800)]
[ELF] Refactor -z combreloc

* `RelocationBaseSection::addReloc` increases `numRelativeRelocs`, which
  duplicates the work done by RelocationSection<ELFT>::writeTo.
* --pack-dyn-relocs=android has inappropropriate DT_RELACOUNT.
  AndroidPackedRelocationSection does not necessarily place relative relocations
  in the front and DT_RELACOUNT might cause semantics error (though our
  implementation doesn't and Android bionic doesn't use DT_RELACOUNT anyway.)

Move `llvm::partition` to a new function `partitionRels` and compute
`numRelativeRelocs` there. Now `RelocationBaseSection::addReloc` is trivial and
can be moved to the header to enable inlining.

The rest of DynamicReloc and `-z combreloc` handling is moved to the
non-template `RelocationBaseSection::computeRels` to decrease code size. My
x86-64 lld executable is 44+KiB smaller.

While here, rename `sort` to `combreloc`.

2 years ago[LLD][MinGW] Add --heap argument support
Mateusz Mikuła [Sat, 29 Jan 2022 21:36:50 +0000 (23:36 +0200)]
[LLD][MinGW] Add --heap argument support

Noticed in https://github.com/msys2/MINGW-packages/pull/10567.

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

2 years ago[sanitizer_common] Use atomic builtin in sanitizer_atomic_clang.h
Rainer Orth [Sat, 29 Jan 2022 21:52:55 +0000 (22:52 +0100)]
[sanitizer_common] Use atomic builtin in sanitizer_atomic_clang.h

As discussed in D118021 <https://reviews.llvm.org/D118021>, `clang -m32` on
Solaris/sparcv9 currently incorrectly doesn't inline atomics on 8-byte
operands, unlike `gcc`.  With the workaround in that patch in place, we're
left with may undefined references to `__sync_val_compare_and_swap_8`,
which isn't provided by `libatomic`.  This reference is due to the use of
`__sync_val_compare_and_swap` in `sanitizer_atomic_clang.h`'s
`atomic_compare_exchange_strong`.  As is already done in
`scudo/standalone/atomic_helpers.h`, using `__atomic_compare_exchange`
instead avoids this problem.

Tested on `sparcv9-sun-solaris2.11`, `amd64-pc-solaris2.11`, and
`x86_64-pc-linux-gnu`.

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

2 years ago[NewGVN] do phi(undef, x) -> x only if x is not poison
Nuno Lopes [Wed, 26 Jan 2022 10:34:20 +0000 (10:34 +0000)]
[NewGVN] do phi(undef, x) -> x only if x is not poison

phi([undef, A], [x, B]) -> x is only correct x is guaranteed to be
a non-poison value.
Otherwise we would be changing an undef to poison in the branch A.

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

2 years ago[gn build] (manually) port 36892727e4f1
Nico Weber [Sat, 29 Jan 2022 21:06:24 +0000 (16:06 -0500)]
[gn build] (manually) port 36892727e4f1

2 years agoenable plugins for clang-tidy
Jameson Nash [Mon, 4 Oct 2021 22:37:57 +0000 (18:37 -0400)]
enable plugins for clang-tidy

Fixes #32739

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

2 years ago[SmallVector] Optimize move assignment operator for N==0 case
Fangrui Song [Sat, 29 Jan 2022 19:03:42 +0000 (11:03 -0800)]
[SmallVector] Optimize move assignment operator for N==0 case

Due to the SmallVector hierarchy, N==0 cannot be leveraged by functions defined
in base classes. This patch special cases N==0 for SmallVector to save code size
and be slightly more efficient.

In a Release build of x86 only clang, .text is -3.34KiB smaller. In lld .text is
7.17KiB smaller.

Reviewed By: lichray

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

2 years ago[InstCombine] add tests for demanded bit of mul; NFC
Sanjay Patel [Fri, 28 Jan 2022 22:10:39 +0000 (17:10 -0500)]
[InstCombine] add tests for demanded bit of mul; NFC

2 years ago[MLGO] Regalloc: allow multiple occurences of -regalloc-enable-advisor
Mircea Trofin [Sat, 29 Jan 2022 16:59:31 +0000 (08:59 -0800)]
[MLGO] Regalloc: allow multiple occurences of -regalloc-enable-advisor

This allows scearios where some central config sets it one way and a
user wants to override it.

2 years ago[clang][dataflow] Merge distinct pointer values in Environment::join
Stanislav Gatev [Fri, 28 Jan 2022 16:23:01 +0000 (16:23 +0000)]
[clang][dataflow] Merge distinct pointer values in Environment::join

This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.

Reviewed-by: ymandel, xazax.hun
Differential Revision: https://reviews.llvm.org/D118480

2 years ago[OpenMP] Fix link error on Windows caused by `interop` functions
Shilei Tian [Sat, 29 Jan 2022 16:29:19 +0000 (11:29 -0500)]
[OpenMP] Fix link error on Windows caused by `interop` functions

This patch fixes the link error on Windows caused by `interop`
functions.

Reviewed By: mstorsjo

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

2 years ago[VPlan] Handle IV vector splat using VPWidenCanonicalIV.
Florian Hahn [Sat, 29 Jan 2022 16:22:18 +0000 (16:22 +0000)]
[VPlan] Handle IV vector splat using VPWidenCanonicalIV.

This patch tries to use an existing VPWidenCanonicalIVRecipe
instead of creating another step-vector for canonical
induction recipes in widenIntOrFpInduction.

This has the following benefits:

 1. First step to avoid setting both vector and scalar values for the
    same induction def.
 2. Reducing complexity of widenIntOrFpInduction through making things
    more explicit in VPlan
 3. Only need to splat the vector IV for block in masks.

Reviewed By: Ayal

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

2 years ago[X86] LowerFunnelShift - enable v8i16 lowering
Simon Pilgrim [Sat, 29 Jan 2022 16:20:36 +0000 (16:20 +0000)]
[X86] LowerFunnelShift - enable v8i16 lowering

2 years ago[X86] lowerShuffleAsBlend - pull out repeated getVectorNumElements() calls. NFC.
Simon Pilgrim [Tue, 25 Jan 2022 22:52:09 +0000 (22:52 +0000)]
[X86] lowerShuffleAsBlend - pull out repeated getVectorNumElements() calls. NFC.

2 years ago[libc++] Fix the last instances of `namespace ranges::inline...`. NFC.
Arthur O'Dwyer [Sat, 29 Jan 2022 16:02:23 +0000 (11:02 -0500)]
[libc++] Fix the last instances of `namespace ranges::inline...`. NFC.

Make these look the same as everywhere else.

2 years ago[WebAssembly] Use cast<> instead of dyn_cast<> to avoid dereference of nullptr
Simon Pilgrim [Sat, 29 Jan 2022 16:08:06 +0000 (16:08 +0000)]
[WebAssembly] Use cast<> instead of dyn_cast<> to avoid dereference of nullptr

The pointers are dereferenced immediately, so assert the cast is correct instead of returning nullptr

2 years ago[lldb] TypeSystemClang - use castAs/cast<> instead of getAs/dyn_cast<> to avoid deref...
Simon Pilgrim [Sat, 29 Jan 2022 15:34:26 +0000 (15:34 +0000)]
[lldb] TypeSystemClang - use castAs/cast<> instead of getAs/dyn_cast<> to avoid dereference of nullptr

The pointers are dereferenced immediately, so assert the cast is correct instead of returning nullptr

2 years ago[clang][NFC] Change some ->getType()->isPlaceholderType() to just ->hasPlaceholderType()
Arthur O'Dwyer [Sat, 29 Jan 2022 00:50:48 +0000 (19:50 -0500)]
[clang][NFC] Change some ->getType()->isPlaceholderType() to just ->hasPlaceholderType()

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

2 years ago[X86] combinePredicateReduction - always use PMOVMSKB(PCMPEQB()) for allof(icmp_eq...
Simon Pilgrim [Sat, 29 Jan 2022 15:16:47 +0000 (15:16 +0000)]
[X86] combinePredicateReduction - always use PMOVMSKB(PCMPEQB()) for allof(icmp_eq()) reductions

This greatly simplifies the codegen for recognising PTEST patterns and matches the codegen from the very similar LowerVectorAllZero

2 years ago[libc++] [test] Mark two ranges tests with libcpp-has-no-incomplete-ranges.
Arthur O'Dwyer [Sat, 29 Jan 2022 15:14:02 +0000 (10:14 -0500)]
[libc++] [test] Mark two ranges tests with libcpp-has-no-incomplete-ranges.

Should fix the Apple build CI, e.g.
https://buildkite.com/llvm-project/libcxx-ci/builds/8227

2 years agoSpeculatively fix the sphinx build for Clang's attribute reference
Aaron Ballman [Sat, 29 Jan 2022 14:38:57 +0000 (09:38 -0500)]
Speculatively fix the sphinx build for Clang's attribute reference

2 years ago[X86] SimplifyDemandedBits - add X86ISD::BLENDV SimplifyMultipleUseDemandedBits handling
Simon Pilgrim [Sat, 29 Jan 2022 14:26:41 +0000 (14:26 +0000)]
[X86] SimplifyDemandedBits - add X86ISD::BLENDV SimplifyMultipleUseDemandedBits handling

Lets us see through multiple use operands

2 years ago[X86] LowerFunnelShift - allow non-constant vXi8 unpack(y,x) << zext(z) lowering...
Simon Pilgrim [Sat, 29 Jan 2022 13:58:25 +0000 (13:58 +0000)]
[X86] LowerFunnelShift - allow non-constant vXi8 unpack(y,x) << zext(z) lowering pre-AVX512

Without AVX512 (which can efficiently extend/truncate to vXi16/vXi32), unpacking/packing to vXi16 is more efficient that relying on the (uops-heavy) PBLENDV shift expansion

2 years agoRevert fad7e491a0770ac4336934030ac67d77e7af5520 with fixes applied
Aaron Ballman [Sat, 29 Jan 2022 13:11:14 +0000 (08:11 -0500)]
Revert fad7e491a0770ac4336934030ac67d77e7af5520 with fixes applied

fad7e491a0770ac4336934030ac67d77e7af5520 was a revert of
86797fdb6f51d32f285e48b6d3e0fc5b8b852734 due to build failures. This
hopefully fixes them.

2 years ago[M68k] Add addressing modes ARIPI and ARIPD support for BTST
Jim Lin [Fri, 28 Jan 2022 05:26:15 +0000 (13:26 +0800)]
[M68k] Add addressing modes ARIPI and ARIPD support for BTST

BTST missed ARIPI and ARIPD addressing modes support.

Reviewed By: myhsu

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

2 years ago[SVE] Remove AArch64ISD::PFALSE.
Paul Walker [Fri, 28 Jan 2022 14:40:50 +0000 (14:40 +0000)]
[SVE] Remove AArch64ISD::PFALSE.

AArch64ISD::PFALSE does not provide any value, in fact it can
prevent common combines from firing.  We only needed to lower
to PFALSE until ISD::SPLAT_VECTOR became generally available.

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

2 years ago[AArch64] Add isel for bitcasting between bfloat and half types.
Paul Walker [Fri, 28 Jan 2022 00:29:09 +0000 (00:29 +0000)]
[AArch64] Add isel for bitcasting between bfloat and half types.

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

2 years agoRaise the minimum Visual Studio version to VS2019
Simon Pilgrim [Sat, 29 Jan 2022 10:56:41 +0000 (10:56 +0000)]
Raise the minimum Visual Studio version to VS2019

As raised here: https://lists.llvm.org/pipermail/llvm-dev/2021-November/153881.html

Now that VS2022 is on general release, LLVM is expected to build on VS2017, VS2019 and VS2022, which is proving hazardous to maintain due to changes in behaviour including preprocessor and constexpr changes. Plus of the few developers that work with VS, many have already moved to VS2019/22.

This patch proposes to raise the minimum supported version to VS2019 (16.x) - I've made the hard limit 16.0 or later, with the soft limit VS2019 16.7 - older versions of VS2019 are "allowed" (at your own risk) via the LLVM_FORCE_USE_OLD_TOOLCHAIN cmake flag.

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

2 years ago[IR] Require matching signature in getCalledFunction()
Nikita Popov [Fri, 9 Jul 2021 20:56:53 +0000 (22:56 +0200)]
[IR] Require matching signature in getCalledFunction()

With opaque pointers, it's possible to directly call a function with
a different signature, without an intermediate bitcast. However,
lot's of code using getCalledFunction() reasonably assumes that the
signatures match (which is always true without opaque pointers).
Add an explicit check to that effect.

The test case is from D105313, where I ran into the problem, but on
further investigation this also affects lots of other code, we just
have little coverage with mismatching signatures. The change from
D105313 is still desirable for other reasons, but this patch
addresses the root problem when it comes to opaque pointers.

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

2 years ago[RISCV] Correct predicate orc.b pattern to not include Zbkb.
Craig Topper [Sat, 29 Jan 2022 08:09:03 +0000 (00:09 -0800)]
[RISCV] Correct predicate orc.b pattern to not include Zbkb.

This was incorrectly lumped in when the predicate was changed for
the rotate instructions.

2 years ago[WebAssembly][NFC] Refactor WasmSymbol type setting code
Paulo Matos [Fri, 28 Jan 2022 11:02:30 +0000 (12:02 +0100)]
[WebAssembly][NFC] Refactor WasmSymbol type setting code

This refactors some code dealing with setting Wasm symbol types.
Some of the code dealing with types was moved from
`WebAssemblyUtilities` to  `WebAssemblyTypeUtilities`.

Reviewed By: sbc100

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

2 years ago[RISCV] Custom legalize BITREVERSE with Zbkb.
Craig Topper [Sat, 29 Jan 2022 06:55:37 +0000 (22:55 -0800)]
[RISCV] Custom legalize BITREVERSE with Zbkb.

With Zbkb, a bitreverse can be split into a rev8 and a brev8.

Reviewed By: VincentWu

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

2 years ago[NFC] Add missing doxygen file tag in llvm/include/llvm/ADT/ headers
Shivam Gupta [Fri, 28 Jan 2022 15:12:54 +0000 (20:42 +0530)]
[NFC] Add missing doxygen file tag in llvm/include/llvm/ADT/ headers

Few header file don't have file tag in them. This patch can be help
in viewing doxygen documentation. When we hover on the included header
file, small description will display.

Reviewed By: aaron.ballman, xgupta

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

2 years ago[TableGen] Detect multiple Processors with the same name.
Craig Topper [Sat, 29 Jan 2022 06:37:00 +0000 (22:37 -0800)]
[TableGen] Detect multiple Processors with the same name.

Due to a bad merge we ended up with duplicate entries in our
downstream repo. I was surprised that nothing caught it. I wrote
this check so I could fix our downstream repo and figured I might
as well share it.

Reviewed By: RKSimon, spatel

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

2 years ago[libc++][ranges][NFC] Small cleanup to the Ranges status page.
Konstantin Varlamov [Sat, 29 Jan 2022 06:39:12 +0000 (22:39 -0800)]
[libc++][ranges][NFC] Small cleanup to the Ranges status page.

- add a few missing links to code reviews;
- reorder the views to follow the same order as in the Standard.

2 years ago[ELF][test] Improve INSERT [AFTER|BEFORE] and adjustSectionsBeforeSorting tests
Fangrui Song [Sat, 29 Jan 2022 06:21:12 +0000 (22:21 -0800)]
[ELF][test] Improve INSERT [AFTER|BEFORE] and adjustSectionsBeforeSorting tests

2 years ago[cmake] Partially deduplicate `{llvm,compiler_rt}_check_linker_flag` for runtime...
John Ericson [Sat, 22 Jan 2022 00:21:19 +0000 (19:21 -0500)]
[cmake] Partially deduplicate `{llvm,compiler_rt}_check_linker_flag` for runtime libs and llvm

We previously had a few varied definitions of this floating around.

I had tried to make the one installed with LLVM handle all the cases, and then made the others use it, but this ran into issues with `HandleOutOfTreeLLVM` not working for compiler-rt, and also `CMAKE_EXE_LINKER_FLAGS` not working right without `CMP0056` set to the new behavior.

 My compromise solution is this:

 - No not completely deduplicate: the runtime libs will instead use a version that still exists as part of the internal and not installed common shared CMake utilities. This avoids `HandleOutOfTreeLLVM` or a workaround for compiler-rt.

- Continue to use `CMAKE_REQUIRED_FLAGS`, which effects compilation and linking. Maybe this is unnecessary, but it's safer to leave that as a future change. Also means we can avoid `CMP0056` for now, to try out later, which is good incrementality too.

- Call it `llvm_check_compiler_linker_flag` since it, in fact is about both per its implementation (before and after this patch), so there is no name collision.

In the future, we might still enable CMP0056 and make compiler-rt work with HandleOutOfTreeLLVM, which case we delete `llvm_check_compiler_flag` and go back to the old way (as these are, in fact, linking related flags), but that I leave for someone else as future work.

The original issue was reported to me in https://reviews.llvm.org/D116521#3248117 as
D116521 made clang and LLVM use the common cmake utils.

Reviewed By: sebastian-ne, phosek, #libunwind, #libc, #libc_abi, ldionne

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

2 years ago[OpenMP] Fix wrong number in openmp/runtime/src/dllexports
Shilei Tian [Sat, 29 Jan 2022 05:22:57 +0000 (00:22 -0500)]
[OpenMP] Fix wrong number in openmp/runtime/src/dllexports

This patch fixes the issue that numbers assigned to `interop` functions were already taken in `openmp/runtime/src/dllexports`.

Reviewed By: jdoerfert

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

2 years ago[ELF] Change the search order for dependent libraries
Petr Hosek [Fri, 28 Jan 2022 09:50:49 +0000 (01:50 -0800)]
[ELF] Change the search order for dependent libraries

When processing dependent libraries, if there's a directory of the same
name as the library being searched for, either in the current directory
or earlier in the search order, LLD will try to open it and report an
error. This is because LLD uses file existence check. To address this
issue we reverse the order, searching the library by basename first
and only considering search paths later, and current directory last.

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

2 years agoRecommit "[InstCombine] Fold and-reduce idiom"
Max Kazantsev [Sat, 29 Jan 2022 04:01:35 +0000 (11:01 +0700)]
Recommit "[InstCombine] Fold and-reduce idiom"

Checks of original vector types made more thorough.

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

2 years ago[libc++][ranges][NFC] Update and slightly cleanup Ranges status page.
Konstantin Varlamov [Sat, 29 Jan 2022 04:13:53 +0000 (20:13 -0800)]
[libc++][ranges][NFC] Update and slightly cleanup Ranges status page.

- add missing links to sections of the Standard and to patches;
- update the status on a couple of items.

2 years agoDelete dead code
Sanjoy Das [Fri, 28 Jan 2022 19:04:31 +0000 (11:04 -0800)]
Delete dead code

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

2 years ago[X86][avx512fp16] Promote fp16 to fp32 for frem.
Luo, Yuanke [Fri, 28 Jan 2022 14:54:17 +0000 (22:54 +0800)]
[X86][avx512fp16] Promote fp16 to fp32 for frem.

Promote fp16 to fp32 for frem.

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

2 years ago[gn build] (manually) port 99217fa8a02
Nico Weber [Sat, 29 Jan 2022 03:33:19 +0000 (22:33 -0500)]
[gn build] (manually) port 99217fa8a02

2 years ago[OpenMP] disable build of old nvptx device runtime
Ye Luo [Sat, 29 Jan 2022 03:24:29 +0000 (21:24 -0600)]
[OpenMP] disable build of old nvptx device runtime

Fully respect LIBOMPTARGET_BUILD_NVPTX_BCLIB. There is no CUDA toolchain dependency. Complement D118268.

Reviewed By: jdoerfert

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

2 years ago[Test] Add pointer comparison test that crashed with D118317
Max Kazantsev [Sat, 29 Jan 2022 03:12:28 +0000 (10:12 +0700)]
[Test] Add pointer comparison test that crashed with D118317

2 years ago[RISCV] Improve extract_vector_elt for fixed mask registers.
jacquesguan [Sat, 15 Jan 2022 09:14:38 +0000 (17:14 +0800)]
[RISCV] Improve extract_vector_elt for fixed mask registers.

Now the backend promotes mask vector to an i8 vector and extract element from that. We could bitcast to a widen element vector, and extract from it to GPR, then use I instruction to extract the certain bit.

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

2 years ago[Test] Recommit tests that were reverted by mistake along with other patch
Max Kazantsev [Sat, 29 Jan 2022 02:53:36 +0000 (09:53 +0700)]
[Test] Recommit tests that were reverted by mistake along with other patch

2 years ago[M68k][GlobalISel] Legalize more instruction in M68k Legalizer.
Sheng [Sat, 29 Jan 2022 01:59:58 +0000 (09:59 +0800)]
[M68k][GlobalISel] Legalize more instruction in M68k Legalizer.

This patch legalizes more instructions and data types.

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

2 years agoAdd 'clangd' prefix to remote index proto targets
Sam McCall [Sat, 29 Jan 2022 01:19:43 +0000 (02:19 +0100)]
Add 'clangd' prefix to remote index proto targets

Some pieces of build infrastructure (shlib, debian package) classify
targets based on whether they begin with "clang".

2 years agoRevert "[UpdateTestChecks] Add --filter and --filter-out options"
David Greene [Sat, 29 Jan 2022 01:06:51 +0000 (17:06 -0800)]
Revert "[UpdateTestChecks] Add --filter and --filter-out options"

Broke some update-test-checks tests.  Reverting while developing a fix.

This reverts commit 030f71698d52f228929da5e3148602f4a3daff7d.

2 years agoMove LLVM Proposal to doc directory, create index
Jeff Bailey [Sat, 29 Jan 2022 00:27:34 +0000 (00:27 +0000)]
Move LLVM Proposal to doc directory, create index

The LLVM Libc project is no longer just a proposal and should have
a webpage tracking the status of the project.  This changes
puts the pieces into the right place so that the webpage can be
created.

Reviewed By: sivachandra

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

2 years ago[flang] Implement a runtime routine to report fatal errors with source position
Peter Steinfeld [Fri, 28 Jan 2022 21:21:29 +0000 (13:21 -0800)]
[flang] Implement a runtime routine to report fatal errors with source position

The title says it all.

I implemented a routine called "Crash" and added a test.

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