platform/upstream/llvm.git
2 years agoRevert "[CMake] Update internal libc++ configuration"
Petr Hosek [Mon, 13 Dec 2021 19:13:02 +0000 (11:13 -0800)]
Revert "[CMake] Update internal libc++ configuration"

This reverts commit e286fefa8caaddea521685a8de1879acca82c67c since
the issue affecting the sanitizer-ppc64le-linux builder is resolved.

2 years agoCheck subrange liveness at rematerialization
Stanislav Mekhanoshin [Tue, 7 Dec 2021 21:10:54 +0000 (13:10 -0800)]
Check subrange liveness at rematerialization

LiveRangeEdit::allUsesAvailableAt checks that VNI at use is the same
as at the original use slot. However, the VNI can be the same while
a specific subrange needed for use can be dead at the new index.

This patch adds subrange liveness check if there is a subreg use.

Fixes: SWDEV-312810

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

2 years ago[CMake] Update internal libc++ configuration
Petr Hosek [Mon, 13 Dec 2021 19:03:07 +0000 (11:03 -0800)]
[CMake] Update internal libc++ configuration

This is an attempt to address 458ead66dc378ee5b9cbeb453a9cb7c3de768b2e
by better matching the previous configuration.

2 years ago[lldb/plugin] Fix heap-use-after-free in ScriptedProcess::ReadMemory
Med Ismail Bennani [Mon, 13 Dec 2021 18:41:39 +0000 (10:41 -0800)]
[lldb/plugin] Fix heap-use-after-free in ScriptedProcess::ReadMemory

This commit should fix a heap-use-after-free bug that was caught by the
sanitizer bot.

The issue is that we were reading memory from a second target into a
`SBData` object in Python, that was passed to lldb's internal
`ScriptedProcess::DoReadMemory` C++ method.

The ScriptedPythonInterface then extracts the underlying `DataExtractor`
from the `SBData` object, and is used to read the memory with the
appropriate address size and byte order.

Unfortunately, it seems that even though the DataExtractor object was
still valid, it pointed to invalid, possibly garbage-collected memory
from Python.

To mitigate this, the patch uses `SBData::SetDataWithOwnership` to copy
the pointed buffer to lldb's heap memory which prevents the
use-after-free error.

rdar://84511405

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years ago[lldb/API] Add SetDataWithOwnership method to SBData
Med Ismail Bennani [Mon, 13 Dec 2021 18:34:49 +0000 (10:34 -0800)]
[lldb/API] Add SetDataWithOwnership method to SBData

This patch introduces a new method to SBData: SetDataWithOwnership.

Instead of referencing the pointer to the data, this method copies the
data buffer into lldb's heap memory.

This can prevent having the underlying DataExtractor object point to
freed/garbage-collected memory.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years agoAutogen more vectorizer tests in advance of D115387.
Philip Reames [Mon, 13 Dec 2021 19:03:13 +0000 (11:03 -0800)]
Autogen more vectorizer tests in advance of D115387.

These are the ones my first round of scripting couldn't handle that required a bit of manual messaging.  This should be the last batch in llvm-check.

2 years ago[SLP]Improve/fix reodering for gather nodes with extractelements/undefs.
Alexey Bataev [Wed, 8 Dec 2021 16:50:39 +0000 (08:50 -0800)]
[SLP]Improve/fix reodering for gather nodes with extractelements/undefs.

If the gather node is a mix of undefvalues and exractelement
instructions, need to take the ordering for such nodes into account too.
It allows to reorder some (sub)trees and remove some extra shuffles,
improving overall vectorization.
Also, outlined common functionality into a separate function.

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

2 years ago[MCA][X86] Add AVX512 subvector broadcast instruction test coverage
Simon Pilgrim [Mon, 13 Dec 2021 18:39:31 +0000 (18:39 +0000)]
[MCA][X86] Add AVX512 subvector broadcast instruction test coverage

2 years agoAutogen a bunch of instcombine and vectorizer tests
Philip Reames [Mon, 13 Dec 2021 18:07:28 +0000 (10:07 -0800)]
Autogen a bunch of instcombine and vectorizer tests

Done in advance of D115387.  These are all the ones which my local script could handle, there's a couple more which need manual updates.

2 years ago[libc] add basic strtold implementation
Michael Jones [Wed, 10 Nov 2021 23:58:42 +0000 (15:58 -0800)]
[libc] add basic strtold implementation

Due to the differences between the types of long double, this function
is effectively three functions in one. This patch adds basic support for
the types of long double, although it's just using the fast path and the
fallback for the moment. I still need to implement a version of
Eisel-Lemire for performance, but the existing algorithms should be
correct.

Reviewed By: sivachandra, lntue

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

2 years ago[NFC][regalloc] Move ExtraRegInfo and related to LiveRangeStageManager
Mircea Trofin [Wed, 1 Dec 2021 00:30:16 +0000 (16:30 -0800)]
[NFC][regalloc] Move ExtraRegInfo and related to LiveRangeStageManager

This would allow sharing the LiveRangeStageManager between different
RegAllocEvictionAdvisors. One scenario is for ML training, where we want
to capture what the default advisor would do, for bootstrapping (speeds
up training).

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

2 years ago[ThinLTO] Fix nondeterministic exit on error.
Mircea Trofin [Sat, 11 Dec 2021 04:59:24 +0000 (20:59 -0800)]
[ThinLTO] Fix nondeterministic exit on error.

In the multi-threaded case, if a thread hits an error, we mimick
LLVMContext's behavior of reporting the error and exit-ing. However,
this doesn't cleanly join the other threads, so depending on how fast
the process exits, other threads may report 'terminate called without an
active exception'.

To avoid this non-determinsim, and without introducing a more complicated
design, we just report the error, but not exit early. We do track whether
we hit errors and exit(1) after joining.

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

2 years ago[MCA][X86] Add AVX512 movddup/movshdup/movsldup instruction test coverage
Simon Pilgrim [Mon, 13 Dec 2021 18:01:19 +0000 (18:01 +0000)]
[MCA][X86] Add AVX512 movddup/movshdup/movsldup instruction test coverage

As noted on D115547

2 years ago[VP] [NFC] Fix vp_store signature and vp_gather examples
Fraser Cormack [Mon, 13 Dec 2021 17:52:47 +0000 (17:52 +0000)]
[VP] [NFC] Fix vp_store signature and vp_gather examples

Reviewed By: frasercrmck, simoll

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

2 years ago[ELF] Split scanRelocations into scanRelocations/postScanRelocations
Fangrui Song [Mon, 13 Dec 2021 17:56:51 +0000 (09:56 -0800)]
[ELF] Split scanRelocations into scanRelocations/postScanRelocations

The idea is to make scanRelocations mark some actions are needed (GOT/PLT/etc)
and postpone the real work to postScanRelocations. It gives some flexibility:

* Make it feasible to support .plt.got (PR32938): we need to know whether GLOB_DAT and JUMP_SLOT are both needed.
* Make non-preemptible IFUNC handling slightly cleaner: avoid setting/clearing sym.gotInIgot
* -z nocopyrel: report all copy relocation places for one symbol
* Make parallel relocation scanning possible (if we can avoid all stateful operations and make Symbol attributes atomic), but parallelism may not be the appealing choice
* Make GOT deduplication feasible

Since this patch moves a large chunk of code out of ELFT templates. My x86-64
executable is actually a few hundred bytes smaller.

For ppc32-ifunc-nonpreemptible-pic.s: I remove absolute relocation references to non-preemptible ifunc
because absolute relocation references are incorrect in -fpie mode.

Reviewed By: peter.smith, ikudrin

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

2 years ago[MCA][X86] Add AVX512 broadcast instruction test coverage
Simon Pilgrim [Mon, 13 Dec 2021 17:39:31 +0000 (17:39 +0000)]
[MCA][X86] Add AVX512 broadcast instruction test coverage

As noted on D115547

2 years ago[llvm] [Debuginfod] Disable CURL by default.
Noah Shutty [Mon, 13 Dec 2021 17:39:01 +0000 (17:39 +0000)]
[llvm] [Debuginfod] Disable CURL by default.

Sets LLVM_ENABLE_CURL to OFF by default to avoid accidental inclusion of libcurl in builds which do not override the default.

Reviewed By: thakis

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

2 years ago[LoopIdiom] Let LIR fold memset pointer / stride SCEV regarding loop guards
eopXD [Thu, 9 Dec 2021 16:15:43 +0000 (08:15 -0800)]
[LoopIdiom] Let LIR fold memset pointer / stride SCEV regarding loop guards

Expression guraded in loop entry can be folded prior to comparison. This patch
proceeds D107353 and makes LIR able to deal with nested for-loop.

Reviewed By: qianzhen, bmahjour

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

2 years agoQuote some more destination paths with variables
John Ericson [Sat, 11 Dec 2021 01:54:42 +0000 (01:54 +0000)]
Quote some more destination paths with variables

Just defensive CMake-ing. I pulled this from D115544 and D99484 which
are blocked on some lldb CI failures I don't yet understand. Hoping to land
something smaller in the meantime.

Reviewed By: #libc, ldionne

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

2 years agoAdd missing textual header to module map
Adrian Prantl [Mon, 13 Dec 2021 17:21:21 +0000 (09:21 -0800)]
Add missing textual header to module map

2 years agoAdd missing textual header to module map
Adrian Prantl [Mon, 13 Dec 2021 17:19:12 +0000 (09:19 -0800)]
Add missing textual header to module map

2 years ago[WebAssembly] Lower global syms representing tables with .tabletype
Paulo Matos [Mon, 13 Dec 2021 16:45:51 +0000 (17:45 +0100)]
[WebAssembly] Lower global syms representing tables with .tabletype

This patch implements a fix to recognize global symbols that represent
WebAssembly appropriately and generate the necessary .tabletype
directives.

Reviewed By: sbc100

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

2 years ago[RISCV] Don't use VLMAX for start value splat in reduction lowering.
Craig Topper [Mon, 13 Dec 2021 17:02:53 +0000 (09:02 -0800)]
[RISCV] Don't use VLMAX for start value splat in reduction lowering.

The reduction instructions only reads the first element. The
execution time for a splat may take longer with a larger VL.
We should use the smallest VL we can.

Reviewed By: frasercrmck, HsiangKai

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

2 years ago[DAGCombine][X86][ARM] EXTRACT_SUBVECTOR(VECTOR_SHUFFLE(?,?,Mask)) -> VECTOR_SHUFFLE...
Roman Lebedev [Mon, 13 Dec 2021 17:00:10 +0000 (20:00 +0300)]
[DAGCombine][X86][ARM] EXTRACT_SUBVECTOR(VECTOR_SHUFFLE(?,?,Mask)) -> VECTOR_SHUFFLE(EXTRACT_SUBVECTOR(?, ?), EXTRACT_SUBVECTOR(?, ?), Mask')

In most test changes this allows us to drop some broadcasts/shuffles.

Reviewed By: RKSimon

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

2 years agoFix build failure of HIPUtility.cpp on Windows
Yaxun (Sam) Liu [Mon, 13 Dec 2021 16:49:22 +0000 (11:49 -0500)]
Fix build failure of HIPUtility.cpp on Windows

2 years ago[ASan] Replace IR based callbacks with shared assembly code callbacks.
Kirill Stoimenov [Mon, 13 Dec 2021 16:10:58 +0000 (16:10 +0000)]
[ASan] Replace IR based callbacks with shared assembly code callbacks.

This change moves optimized callbacks from each .o file to compiler-rt.

Reviewed By: vitalybuka, morehouse

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

2 years agoFix warning about unused variable in HIPAMD.cpp
Yaxun (Sam) Liu [Mon, 13 Dec 2021 16:25:24 +0000 (11:25 -0500)]
Fix warning about unused variable in HIPAMD.cpp

2 years ago[Flang][Unit Test] Move the declaration of kindMap to the class
Kiran Chandramohan [Mon, 13 Dec 2021 16:11:32 +0000 (16:11 +0000)]
[Flang][Unit Test] Move the declaration of kindMap to the class

kindMap variable is declared in the Setup function but passed as
a reference to the firBuilder class. The firBuilder is declared in
the class and hence its lifetime exceeds that of kindMap. This can
lead to undefined behaviour. Move the kindMap variable into the class
to avoid this.

This is part of the upstreaming effort from the fir-dev branch in [1].
[1] https://github.com/flang-compiler/f18-llvm-project

Reviewed By: awarzynski

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

2 years ago[SystemZ][z/OS] Fix handling of dirs with filesystem tests
Muiez Ahmed [Mon, 13 Dec 2021 16:00:56 +0000 (11:00 -0500)]
[SystemZ][z/OS] Fix handling of dirs with filesystem tests

The aim of this patch is to fix the post processing that is happening on the temporary test directories upon scope exit. In particular, ~scoped_test_env aims to chmod and remove the temporary directories; however,

bad symlinks are followed and we get "No such file or directory". FIX: use find as alternative to chmod and avoid -follow option.
Attempting to remove read-only files on z/OS prompts a message asking for confirmation. FIX: use the -f option to delete read-only files immediately without asking for confirmation.
Some libcxx tests such as libcxx/test/std/input.output/filesystems/cl ass.directory_entry/directory_entry.cons/path.pass.cpp set the dir permissions to none. In turn, recursively doing chmod (-R) does not set the file permissions needed to be able to remove the dir on z/OS only. FIX: use find as alternative to chmod -R, which does not run into this issue on z/OS.

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

2 years ago[gn build] Port 78b0f3701d44
LLVM GN Syncbot [Mon, 13 Dec 2021 15:53:45 +0000 (15:53 +0000)]
[gn build] Port 78b0f3701d44

2 years ago[mlir][spirv] Use ScopedPrinter in deserialization debugging
Lei Zhang [Mon, 13 Dec 2021 15:43:54 +0000 (10:43 -0500)]
[mlir][spirv] Use ScopedPrinter in deserialization debugging

This gives us better debugging print as it supports indent
levels and other nice features.

Reviewed By: Hardcode84

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

2 years ago[HIPSPV][1/4] Refactor HIP tool chain
Yaxun (Sam) Liu [Fri, 10 Dec 2021 19:11:45 +0000 (14:11 -0500)]
[HIPSPV][1/4] Refactor HIP tool chain

This patch refactors the HIP tool chain for new HIP tool chain, HIPSPV
tool chain, which is added in the follow up patch part 2.

Rename HIPToolChain to HIPAMDToolChain and Renames HIP.* files to HIPAMD.*.
Introduce HIPUtility.* file where common HIP utilities, shared among HIP
tool chain implementations, are placed in.
Move constructHIPFatbinCommand() and
constructGenerateObjFileFromHIPFatBinary() to HIPUtility. HIPSPV tool
chain is going to use them.
Tweak bundle target ID in constructHIPFatbinCommand(): extra dashes are
dropped if the Target ID is empty and 'hip' offload kind is made default
for non-AMD targets.

Patch by: Henry Linjamäki

Reviewed by: Yaxun Liu, Artem Belevich, Eric Christopher

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

2 years ago[AMDGPUPerfHintAnalysis] Avoid getPointerElementType()
Nikita Popov [Mon, 13 Dec 2021 15:45:38 +0000 (16:45 +0100)]
[AMDGPUPerfHintAnalysis] Avoid getPointerElementType()

Extract the load/store type from the instruction rather than
fetching it from the pointer element type.

2 years ago[AMDGPU] Ignore special ABI registers for graphics
Neubauer, Sebastian [Mon, 13 Dec 2021 14:44:56 +0000 (15:44 +0100)]
[AMDGPU] Ignore special ABI registers for graphics

Fixed ABI arguments are compute specific and should not be added to
graphics shaders or functions, so do not try to add them.

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

2 years ago[mlir][spirv] Serialize selection with separate header block
Lei Zhang [Mon, 13 Dec 2021 15:36:04 +0000 (10:36 -0500)]
[mlir][spirv] Serialize selection with separate header block

The previous "optimization" that tries to reuse existing block for
selection header block can be problematic for deserialization
because it effectively pulls in previous ops in the selection op's
enclosing block into the selection op's header. When deserializing,
those ops will be placed in the selection op's region. If any of
the previous ops has usage after the section op, it will break. That
is, the following IR cannot round trip:

```mlir
^bb:
  %def = ...
  spv.mlir.selection { ... }
  %use = spv.SomeOp %def
```

This commit removes the "optimization" to always create new blocks
for the selection header.

Along the way, also made error reporting better in deserialization
by turning asserts into proper errors and add check of uses outside
of sinked structured control flow region blocks.

Reviewed By: Hardcode84

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

2 years ago[NFC] Format .cppm files in tests
Chuanqi Xu [Mon, 13 Dec 2021 15:12:17 +0000 (23:12 +0800)]
[NFC] Format .cppm files in tests

2 years ago[libc++abi][NFC] Fix comment
Louis Dionne [Mon, 13 Dec 2021 15:29:24 +0000 (10:29 -0500)]
[libc++abi][NFC] Fix comment

2 years ago[InstCombine] don't automatically drop poison-generating flags in SimplifyVectorDeman...
Sanjay Patel [Mon, 13 Dec 2021 15:02:38 +0000 (10:02 -0500)]
[InstCombine] don't automatically drop poison-generating flags in SimplifyVectorDemandedElts

I noticed this while reviewing the test diffs in D115460
(and so the diffs in that patch will be reduced if this one is applied first).

This is effectively a revert of 3436dc29239d ( https://reviews.llvm.org/rG3436dc29239d ) -
since that commit, we've made several enhancements, so the reasoning there is no longer
valid. Specifically, we added a poison value to IR, and we clarified the behavior of
undef/poison elements in a shuffle mask:
https://llvm.org/docs/LangRef.html#shufflevector-instruction

Alive2 seems to agree that the propagation of flags in the test diffs shown here are valid:
https://alive2.llvm.org/ce/z/UuY-jr
https://alive2.llvm.org/ce/z/GXoMD9
https://alive2.llvm.org/ce/z/nVCyVH

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

2 years ago[mlir][ods] Fix OpDefinitionsGen infer return types builder with regions
Mogball [Fri, 10 Dec 2021 15:51:02 +0000 (15:51 +0000)]
[mlir][ods] Fix OpDefinitionsGen infer return types builder with regions

Despite handling regions and inferred return types, the builder was never generated for ops with both InferReturnTypeOpInterface and regions.

Reviewed By: jpienaar

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

2 years ago[clangd][Dex] Fix crashes when building trigrams for empty identifier
Kadir Cetinkaya [Mon, 13 Dec 2021 14:57:51 +0000 (15:57 +0100)]
[clangd][Dex] Fix crashes when building trigrams for empty identifier

2 years ago[mlir][memref] Use current source type in getCanonicalSubViewResultType.
gysit [Mon, 13 Dec 2021 14:45:34 +0000 (14:45 +0000)]
[mlir][memref] Use current source type in getCanonicalSubViewResultType.

Use the current instead of the new source type to compute the rank-reduction map in getCanonicalSubViewResultType. Otherwise, the computation of the rank-reduction map fails when folding a cast into a subview since the strides of the new source type cannot be related to the strides of the current result type.

Depends On D115428

Reviewed By: nicolasvasilache

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

2 years ago[AMDGPU] SIShrinkInstructions: sink code to where it's used. NFC.
Jay Foad [Mon, 13 Dec 2021 14:45:50 +0000 (14:45 +0000)]
[AMDGPU] SIShrinkInstructions: sink code to where it's used. NFC.

2 years ago[AMDGPU] SIShrinkInstructions: remove redundant check
Jay Foad [Mon, 13 Dec 2021 14:44:13 +0000 (14:44 +0000)]
[AMDGPU] SIShrinkInstructions: remove redundant check

canShrink already calls hasVALU32BitEncoding, so there is no need
to call it again here.

2 years ago[AMDGPU] Remove a FIXME implemented in D11061
Jay Foad [Mon, 13 Dec 2021 14:43:00 +0000 (14:43 +0000)]
[AMDGPU] Remove a FIXME implemented in D11061

2 years ago[SLP] Avoid getPointerElementType() call
Nikita Popov [Mon, 13 Dec 2021 14:45:40 +0000 (15:45 +0100)]
[SLP] Avoid getPointerElementType() call

Use the load result type instead of the element type of the load
pointer operand.

2 years ago[lldb] Remove named function arguments from TestQemuLaunch
Pavel Labath [Mon, 13 Dec 2021 14:28:01 +0000 (15:28 +0100)]
[lldb] Remove named function arguments from TestQemuLaunch

This is a swig-4 feature.

2 years ago[ConstantsTest] Avoid crash with opaque pointers
Nikita Popov [Mon, 13 Dec 2021 14:21:30 +0000 (15:21 +0100)]
[ConstantsTest] Avoid crash with opaque pointers

With opaque pointers there will be no bitcast, so don't assume
that.

2 years ago[CostModel][AMDGPU] Fix intrinsics costs estimations.
Daniil Fukalov [Thu, 2 Dec 2021 23:56:25 +0000 (02:56 +0300)]
[CostModel][AMDGPU] Fix intrinsics costs estimations.

1. Fixed costs inconsistency for llvm.fma.vXf16 instinsiscs.
2. Added tests for llvm.sadd.sat, llvm.ssub.sat, llvm.uadd.sat, llvm.usub.sat
   intrisics since they have special processing in cost model.
3. Minor intrisics' costs tests updat and refinement.

Reviewed By: rampitec

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

2 years ago[mlir] Implement `DataLayoutTypeInterface` for `LLVMStructType`
Markus Böck [Mon, 13 Dec 2021 14:09:16 +0000 (15:09 +0100)]
[mlir] Implement `DataLayoutTypeInterface` for `LLVMStructType`

Using this implementation of the interface it is possible to query the size, ABI alignment as well as the preferred alignment of a struct. It should yield the same results as LLVMs `llvm::DataLayout` on an equivalent `llvm::StructType`, including for packed structs.

Additionally it is also possible to increase the ABI and preferred alignment using a data layout entry with the type `llvm.struct<()>, which serves the same functionality as the `a:` component in LLVMs data layout string.

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

2 years ago[amdgpu] Add regression test for LDS in metadata
Jon Chesterfield [Mon, 13 Dec 2021 13:33:12 +0000 (13:33 +0000)]
[amdgpu] Add regression test for LDS in metadata

2 years ago[VPlan] Add printing test with VPInstruction with debug locs.
Florian Hahn [Mon, 13 Dec 2021 13:08:41 +0000 (13:08 +0000)]
[VPlan] Add printing test with VPInstruction with debug locs.

Test case for D113223.

2 years ago[mlir][linalg] Only compose PadTensorOps if no ExtractSliceOp is rank-reducing.
gysit [Mon, 13 Dec 2021 13:01:09 +0000 (13:01 +0000)]
[mlir][linalg] Only compose PadTensorOps if no ExtractSliceOp is rank-reducing.

Do not compose pad tensor operations if the extract slice of the outer pad tensor operation is rank reducing. The inner extract slice op cannot be rank-reducing since it source type must match the desired type of the padding.

Depends On D115359

Reviewed By: nicolasvasilache

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

2 years ago[mlir][linalg] Adapt the PadTensorOpVectorizationWithInsertSlicePattern matching.
gysit [Mon, 13 Dec 2021 12:54:37 +0000 (12:54 +0000)]
[mlir][linalg] Adapt the PadTensorOpVectorizationWithInsertSlicePattern matching.

Tighten the matcher of the PadTensorOpVectorizationWithInsertSlicePattern pattern. Only match if the PadOp result is used by the InsertSliceOp source. Fail if the result is used by the InsertSliceOp dest.

Depends On D115336

Reviewed By: nicolasvasilache

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

2 years ago[mlir][linalg] Make padding work for rank-reducing slice ops.
gysit [Mon, 13 Dec 2021 12:33:54 +0000 (12:33 +0000)]
[mlir][linalg] Make padding work for rank-reducing slice ops.

Adapt the computation of a static bounding box to take rank-reducing slice operations into account by filtering out reduced size one dimensions. The revision is needed to make padding work for decomposed convolution operations. The decomposition introduces rank reducing extract slice operations that previously let padding fail.

Reviewed By: nicolasvasilache

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

2 years agoRevert "[NFC] format .cppm files in test"
Nico Weber [Mon, 13 Dec 2021 12:12:55 +0000 (07:12 -0500)]
Revert "[NFC] format .cppm files in test"

This reverts commit 7c51a128339184c64307f3862e4cd36bf996189b.
Breaks SemaCXX/modules-ts.cppm in check-clang.

2 years ago[LV] Add test with debug locations on branches that get scalarized.
Florian Hahn [Mon, 13 Dec 2021 12:06:35 +0000 (12:06 +0000)]
[LV] Add test with debug locations on branches that get scalarized.

2 years ago[gn build] Make arm_neon_sve_bridge.h header auto-syncable
Nico Weber [Mon, 13 Dec 2021 12:04:38 +0000 (07:04 -0500)]
[gn build] Make arm_neon_sve_bridge.h header auto-syncable

2 years ago[LV][NFC] Fix debug message to print out resulting clamped VF
Evgeniy Brevnov [Mon, 13 Dec 2021 11:52:13 +0000 (18:52 +0700)]
[LV][NFC] Fix debug message to print out resulting clamped VF

2 years ago[NFC] format .cppm files in test
Chuanqi Xu [Mon, 13 Dec 2021 11:52:18 +0000 (19:52 +0800)]
[NFC] format .cppm files in test

2 years agotsan: enable the new runtime
Dmitry Vyukov [Mon, 13 Dec 2021 11:45:53 +0000 (12:45 +0100)]
tsan: enable the new runtime

This enables the new runtime (D112603) by default.

Depends on D112603.

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

2 years agotsan: new runtime (v3)
Dmitry Vyukov [Thu, 2 Dec 2021 07:36:44 +0000 (08:36 +0100)]
tsan: new runtime (v3)

This change switches tsan to the new runtime which features:
 - 2x smaller shadow memory (2x of app memory)
 - faster fully vectorized race detection
 - small fixed-size vector clocks (512b)
 - fast vectorized vector clock operations
 - unlimited number of alive threads/goroutimes

Depends on D112602.

Reviewed By: melver

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

2 years ago[SVE] Only combine (fneg (fma)) => FNMLA with nsz
Peter Waller [Wed, 8 Dec 2021 15:54:06 +0000 (15:54 +0000)]
[SVE] Only combine (fneg (fma)) => FNMLA with nsz

-(Za + Zm * Zn) != (-Za + Zm * (-Zn))
when the FMA produces a zero output (e.g. all zero inputs can produce -0
output)

Add a PatFrag to check presence of nsz on the fneg, add tests which
ensure the combine does not fire in the absense of nsz.

See https://reviews.llvm.org/D90901 for a similar discussion on X86.

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

2 years ago[AArch64][SVE][NEON] Add NEON-SVE-Bridge intrinsics
Matt Devereau [Mon, 29 Nov 2021 15:48:38 +0000 (15:48 +0000)]
[AArch64][SVE][NEON] Add NEON-SVE-Bridge intrinsics

Adds svset_neonq, svget_neonq, svdup_neonq AArch64 intrinsics.

These are described in the ACLE specification:
https://github.com/ARM-software/acle/pull/72

https://reviews.llvm.org/D114713

2 years ago[VE] Support srel32 in symbol reference
Kazushi (Jam) Marukawa [Fri, 10 Dec 2021 18:06:02 +0000 (03:06 +0900)]
[VE] Support srel32 in symbol reference

Support R_VE_SREL32 in symbol references in MC layer.

Reviewed By: simoll

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

2 years ago[VE] Support R_VE_RELATIVE
Kazushi (Jam) Marukawa [Sun, 12 Dec 2021 03:51:44 +0000 (12:51 +0900)]
[VE] Support R_VE_RELATIVE

Change getELFRelativeRelocationType() to return R_VE_RELATIVE
as a preparation of lld for VE.

Reviewed By: simoll

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

2 years ago[AArch64][SVE] Lower vector.insert to predicated merged MOV
Matt Devereau [Tue, 7 Dec 2021 16:52:43 +0000 (16:52 +0000)]
[AArch64][SVE] Lower vector.insert to predicated merged MOV

Use predicated SEL for vector.insert instead of going through memory

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

2 years ago[VPlan] Remove unused createNaryOp (NFC).
Florian Hahn [Mon, 13 Dec 2021 11:11:00 +0000 (11:11 +0000)]
[VPlan] Remove unused createNaryOp (NFC).

2 years agotsan: deflake dlopen_static_tls.cpp
Dmitry Vyukov [Mon, 13 Dec 2021 08:28:42 +0000 (09:28 +0100)]
tsan: deflake dlopen_static_tls.cpp

Currently the test calls dlclose in the thread
concurrently with the main thread calling a function
from the dynamic library. This is not good.
Wait for the main thread to call the function
before calling dlclose.

Depends on D115612.

Reviewed By: melver

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

2 years agotsan: deflake flush_memory.cpp
Dmitry Vyukov [Mon, 13 Dec 2021 08:27:07 +0000 (09:27 +0100)]
tsan: deflake flush_memory.cpp

The test contains a race and checks that it's detected.
But the race may not be detected since we are doing aggressive flushes
and if the state flush happens between racing accesses, tsan won't
detect the race). So return 1 to make the test deterministic
regardless of the race.

Reviewed By: melver

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

2 years ago[PR52475] Ensure a correct chain in copies to/from hidden sret parameter
Fraser Cormack [Tue, 30 Nov 2021 12:28:45 +0000 (12:28 +0000)]
[PR52475] Ensure a correct chain in copies to/from hidden sret parameter

This patch fixes an issue during SelectionDAG construction. When the
target is unable to lower the function's return value, a hidden sret
parameter is created. It is initialized and copied to a stored variable
(DemoteRegister) with CopyToReg and is later fetched with
CopyFromReg. The bug is that the chains used for each copy are
inconsistent, and thus in rare cases the scheduler may issue them out of
order.

The fix is to ensure that the CopyFromReg uses the DAG root which is set
as the chain corresponding to the initial CopyToReg.

Fixes https://llvm.org/PR52475

Reviewed By: craig.topper

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

2 years ago[MemCpyOpt] Add additional call slot capture tests (NFC)
Nikita Popov [Mon, 13 Dec 2021 09:08:50 +0000 (10:08 +0100)]
[MemCpyOpt] Add additional call slot capture tests (NFC)

One test shows a miscompile when bitcasts are involved, the others
cases where we can perform the optimization despite a capture.

2 years ago[VE][NFC] Cleanup vector patterns
Simon Moll [Mon, 13 Dec 2021 09:12:12 +0000 (10:12 +0100)]
[VE][NFC] Cleanup vector patterns

Cleanup VE vector isel patterns and follow the downstream LLVM-VE
pattern naming convention.

Reviewed By: kaz7

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

2 years ago[libc][NFC] Add back NOLINT anntotations to PolyEval.
Siva Chandra Reddy [Mon, 13 Dec 2021 07:07:14 +0000 (07:07 +0000)]
[libc][NFC] Add back NOLINT anntotations to PolyEval.

They were accidentally removed in a previous change.

2 years ago[LV] Make sure VF doesn't exceed compile time known TC
Evgeniy Brevnov [Wed, 24 Nov 2021 11:30:52 +0000 (18:30 +0700)]
[LV] Make sure VF doesn't exceed compile time known TC

For the simple copy loop (see test case) vectorizer selects VF equal to 32 while the loop is known to have 17 iterations only. Such behavior makes no sense to me since such vector loop will never be executed. The only case we may want to select VF large than TC is masked vectoriztion. So I haven't touched that case.

Reviewed By: dmgreen

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

2 years ago[ELF] Use parallelSort for .rela.dyn
Fangrui Song [Mon, 13 Dec 2021 04:53:06 +0000 (20:53 -0800)]
[ELF] Use parallelSort for .rela.dyn

An unstable sort suffices. In a large link (11.06s), this decreases .rela.dyn
writeTo time from 1.52s to 0.81s, resulting in 6% total time speedup (the
benefit will greatly dilute if --pack-dyn-relocs=relr becomes prevailing).

Encoding the dynamic relocations then sorting raw Elf_Rel/Elf_Rela doesn't seem
to improve much (doing that would require code duplicate because of
Elf_Rel/Elf_Rela plus unfortunate mips64le), so don't do that.

2 years ago[ELF] initializeSections: move SHT_LLVM_CALL_GRAPH_PROFILE check into SHF_EXCLUDE...
Fangrui Song [Mon, 13 Dec 2021 04:05:21 +0000 (20:05 -0800)]
[ELF] initializeSections: move SHT_LLVM_CALL_GRAPH_PROFILE check into SHF_EXCLUDE && !relocatable. NFC

Avoid a comparison in the majority of cases.

2 years ago[ELF] relocateAlloc: remove variables type and expr. NFC
Fangrui Song [Mon, 13 Dec 2021 03:31:30 +0000 (19:31 -0800)]
[ELF] relocateAlloc: remove variables type and expr. NFC

2 years ago[ELF] Move adjustSplitStackFunctionPrologues's splitStack check to the caller. NFC
Fangrui Song [Mon, 13 Dec 2021 03:26:03 +0000 (19:26 -0800)]
[ELF] Move adjustSplitStackFunctionPrologues's splitStack check to the caller. NFC

Avoid a function call in the majority of cases and make the output smaller.

2 years ago[ELF] Avoid mutable addend parameter. NFC
Fangrui Song [Mon, 13 Dec 2021 03:12:01 +0000 (19:12 -0800)]
[ELF] Avoid mutable addend parameter. NFC

2 years ago[Driver][test] Make some tests work with CLANG_DEFAULT_PIE_ON_LINUX=on
Fangrui Song [Mon, 13 Dec 2021 00:28:33 +0000 (16:28 -0800)]
[Driver][test] Make some tests work with CLANG_DEFAULT_PIE_ON_LINUX=on

Also delete some cross-linux.c tests which are covered by linux-cross.cpp

2 years ago[llvm] Use llvm::reverse (NFC)
Kazu Hirata [Mon, 13 Dec 2021 00:13:49 +0000 (16:13 -0800)]
[llvm] Use llvm::reverse (NFC)

2 years ago[X86][Atom] Fix CVT uops + port usage
Simon Pilgrim [Sun, 12 Dec 2021 22:57:53 +0000 (22:57 +0000)]
[X86][Atom] Fix CVT uops + port usage

Fix overrides to use both ports. Update the uops counts + port usage based off the most recent llvm-exegesis captures (PR36895) and what Intel AoM / Agner reports as well.

2 years ago[MCA][X86] Fix duplicated cvtsi2ss/cvtsi2sd i32 + i64 folded tests
Simon Pilgrim [Sun, 12 Dec 2021 22:48:45 +0000 (22:48 +0000)]
[MCA][X86] Fix duplicated cvtsi2ss/cvtsi2sd i32 + i64 folded tests

Specify the integer width to ensure we're testing the correct instruction

2 years agoUse "new issue" label for tagging new issues
Anton Korobeynikov [Sun, 12 Dec 2021 21:38:26 +0000 (13:38 -0800)]
Use "new issue" label for tagging new issues

Apparently "help wanted" has some additional special meaning

2 years ago[LV] Use info from State in some helper functions (NFC).
Florian Hahn [Sun, 12 Dec 2021 20:48:38 +0000 (20:48 +0000)]
[LV] Use info from State in some helper functions (NFC).

This updates several helper functions to use information provided by
VPTransformState instead of ILV directly, to help with the transition
out of ILV.

2 years ago[amdgpu] Increase alignment of all LDS variables
Jon Chesterfield [Sun, 12 Dec 2021 19:30:32 +0000 (19:30 +0000)]
[amdgpu] Increase alignment of all LDS variables

Currently the superalign option only increases the alignment of
variables that are moved into the module.lds block. Change that to all LDS
variables. Also only increase the alignment once, instead of once per function.

Reviewed By: rampitec

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

2 years agoEnsure newlines at the end of files (NFC)
Kazu Hirata [Sun, 12 Dec 2021 19:04:44 +0000 (11:04 -0800)]
Ensure newlines at the end of files (NFC)

2 years ago[ELF][test] Remove unused/incorrect .got check line
Fangrui Song [Sun, 12 Dec 2021 18:51:05 +0000 (10:51 -0800)]
[ELF][test] Remove unused/incorrect .got check line

2 years ago[NFC][X86] Precommit tests for memset with minsize being present
Daniil Seredkin [Sun, 12 Dec 2021 17:52:19 +0000 (00:52 +0700)]
[NFC][X86] Precommit tests for memset with minsize being present

2 years ago[X86] Update MMX opname test changes that were lost
Simon Pilgrim [Sun, 12 Dec 2021 18:21:34 +0000 (18:21 +0000)]
[X86] Update MMX opname test changes that were lost

I stupidly lost these in a temp git stash :(

2 years ago[X86][MMX] Remove superfluous 'i' from MMX cvt opnames. NFCI.
Simon Pilgrim [Sun, 12 Dec 2021 17:58:42 +0000 (17:58 +0000)]
[X86][MMX] Remove superfluous 'i' from MMX cvt opnames. NFCI.

This is a very old copy+paste typo - none of these cvt ops have an immediate operand.

Noticed while trying to merge MMX instructions into some existing SSE instruction scheduler instregex patterns.

2 years ago[X86][MMX] Remove superfluous 'i' from MMX binop opnames. NFCI.
Simon Pilgrim [Sun, 12 Dec 2021 17:09:40 +0000 (17:09 +0000)]
[X86][MMX] Remove superfluous 'i' from MMX binop opnames. NFCI.

This is a very old copy+paste typo - none of these binops have an immediate operand.

Noticed while trying to merge MMX instructions into some existing SSE instruction scheduler instregex patterns.

2 years ago[gn build] Port abb5dd6e99df
Nico Weber [Sun, 12 Dec 2021 17:39:32 +0000 (12:39 -0500)]
[gn build] Port abb5dd6e99df

(This reverts commit 7d9f11be81850d6c0625fd97b38d0933ef5cb716,
to reland the Ryu code: ae53d02f557c relanded in abb5dd6e99df).

2 years ago[clang-format] [PR49298] Sort includes pass will sort inside raw strings
mydeveloperday [Sun, 12 Dec 2021 17:00:43 +0000 (17:00 +0000)]
[clang-format] [PR49298] Sort includes pass will sort inside raw strings

https://github.com/llvm/llvm-project/issues/48642

clang-format does not respect raw string literals when sorting includes

```
const char *RawStr = R"(
)";
```

Running clang-format over with SortIncludes enabled transforms this code to:

```
const char *RawStr = R"(
)";
```
The following code tries to minimize this impact during IncludeSorting, by treating R"( and )" as equivalent of // clang-format off/on

Reviewed By: HazardyKnusperkeks, curdeius

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

Fixes #48642

2 years ago[OpenMP] Add "not" to test dependencies.
Michael Kruse [Sun, 12 Dec 2021 16:29:35 +0000 (10:29 -0600)]
[OpenMP] Add "not" to test dependencies.

The `not` program is used to test executions prefixed with `%libomptarget-run-fail-`. Currently `not` is not used for libomp tests, but might be used in the future and its dependency does not add any additional burden over the already established `FileCheck` dependency.

Required to add libomptarget testing to the Phabricator pre-merge check (see https://github.com/google/llvm-premerge-checks/issues/368)

Reviewed By: jdenny, JonChesterfield

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

2 years ago[Target] Use llvm::reverse (NFC)
Kazu Hirata [Sun, 12 Dec 2021 16:34:23 +0000 (08:34 -0800)]
[Target] Use llvm::reverse (NFC)

2 years ago[X86][AVX512] Remove xmm->xmm vpmovsx/vpmovzx rm overrides
Simon Pilgrim [Sun, 12 Dec 2021 16:08:01 +0000 (16:08 +0000)]
[X86][AVX512] Remove xmm->xmm vpmovsx/vpmovzx rm overrides

The XMM evex cases have the same behaviour as the SSE41 versions, which already uses WriteShuffleX.Folded

2 years ago[mlir] Relax restriction on name location parsing
Jacques Pienaar [Sun, 12 Dec 2021 16:06:59 +0000 (08:06 -0800)]
[mlir] Relax restriction on name location parsing

We currently restrict parsing of location to not allow nameloc being
nested inside nameloc. This restriction may be historical as there
doesn't seem to be a reason for it anymore (locations like this can be
constructed in C++ and they print fine). Relax this restriction in the
parser to allow this nesting.

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

2 years ago[mlir] Flag near misses in file splitting
Jacques Pienaar [Sun, 12 Dec 2021 16:03:30 +0000 (08:03 -0800)]
[mlir] Flag near misses in file splitting

Flags some potential cases where splitting isn't happening and so could result
in confusing results. Also update some test files where there were near misses
in splitting that seemed unintentional.

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

2 years agoMicrosoft's floating-point to_chars powered by Ryu and Ryu Printf
Mark de Wever [Tue, 9 Feb 2021 16:52:41 +0000 (17:52 +0100)]
Microsoft's floating-point to_chars powered by Ryu and Ryu Printf

Microsoft would like to contribute its implementation of floating-point to_chars to libc++. This uses the impossibly fast Ryu and Ryu Printf algorithms invented by Ulf Adams at Google. Upstream repos: https://github.com/microsoft/STL and https://github.com/ulfjack/ryu .

Licensing notes: MSVC's STL is available under the Apache License v2.0 with LLVM Exception, intentionally chosen to match libc++. We've used Ryu under the Boost Software License.

This patch contains minor changes from Jorg Brown at Google, to adapt the code to libc++. He verified that it works in Google's Linux-based environment, but then I applied more changes on top of his, so any compiler errors are my fault. (I haven't tried to build and test libc++ yet.) Please tell me if we need to do anything else in order to follow https://llvm.org/docs/DeveloperPolicy.html#attribution-of-changes .

Notes:

* libc++'s integer charconv is unchanged (except for a small refactoring). MSVC's integer charconv hasn't been tuned for performance yet, so you're not missing anything.
* Floating-point from_chars isn't part of this patch because Jorg found that MSVC's implementation (derived from our CRT's strtod) was slower than Abseil's. If you're unable to use Abseil or another implementation due to licensing or technical considerations, Microsoft would be delighted if you used MSVC's from_chars (and you can just take it, or ask us to provide a patch like this). Ulf is also working on a novel algorithm for from_chars.
* This assumes that float is IEEE 32-bit, double is IEEE 64-bit, and long double is also IEEE 64-bit.
* I have added MSVC's charconv tests (the whole thing: integer/floating from_chars/to_chars), but haven't adapted them to libcxx's harness at all. (These tests will be available in the microsoft/STL repo soon.)
* Jorg added int128 codepaths. These were originally present in upstream Ryu, and I removed them from microsoft/STL purely for performance reasons (MSVC doesn't support int128; Clang on Windows does, but I found that x64 intrinsics were slightly faster).
* The implementation is split into 3 headers. In MSVC's STL, charconv contains only Microsoft-written code. xcharconv_ryu.h contains code derived from Ryu (with significant modifications and additions). xcharconv_ryu_tables.h contains Ryu's large lookup tables (they were sufficiently large to make editing inconvenient, hence the separate file). The xmeow.h convention is MSVC's for internal headers; you may wish to rename them.
* You should consider separately compiling the lookup tables (see https://github.com/microsoft/STL/issues/172 ) for compiler throughput and reduced object file size.
* See https://github.com/StephanTLavavej/llvm-project/commits/charconv for fine-grained history. (If necessary, I can perform some rebase surgery to show you what Jorg changed relative to the microsoft/STL repo; currently that's all fused into the first commit.)

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