platform/upstream/llvm.git
3 years agoFix duplicate checks in clangd comments
Elton [Mon, 19 Jul 2021 13:14:23 +0000 (15:14 +0200)]
Fix duplicate checks in clangd comments

This patch removes a duplicate checks in the top-level comments in `clang-tools-extra/clangd/ParsedAST.h`

Reviewed By: kadircet

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

3 years ago[AMDGPU] Fix typo in comments idexen -> idxen
Jay Foad [Mon, 19 Jul 2021 12:39:30 +0000 (13:39 +0100)]
[AMDGPU] Fix typo in comments idexen -> idxen

3 years ago[clang] Change set type used for SourceLocation.
Simon Tatham [Mon, 19 Jul 2021 10:45:46 +0000 (11:45 +0100)]
[clang] Change set type used for SourceLocation.

This is part of a patch series working towards the ability to make
SourceLocation into a 64-bit type to handle larger translation units.

If clang is built for a 32-bit platform and SourceLocation is 64 bits
wide, then a SourceLocation will be larger than a pointer, so it won't
be possible to keep them in a SmallPtrSet any more. Switch to
SmallDenseSet instead.

Patch originally by Mikhail Maltsev.

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

3 years agoRevert "[mlir] Introduce `linalg.tiled_yield` terminator for `linalg.tiled_loop`."
Alexander Belyaev [Mon, 19 Jul 2021 12:18:35 +0000 (14:18 +0200)]
Revert "[mlir] Introduce `linalg.tiled_yield` terminator for `linalg.tiled_loop`."

This reverts commit 3b03d9b874aa902f7f969e7ffdefde23c2758eeb.

3 years ago[clang-tidy] ensure run-clang-tidy reports children killed by signals
Ian Campbell [Mon, 19 Jul 2021 12:17:23 +0000 (14:17 +0200)]
[clang-tidy] ensure run-clang-tidy reports children killed by signals

If a clang-tidy child process exits with a signal then run-clang-tidy will exit
with an error but there is no hint why in the output, since the clang-tidy
doesn't log anything and may not even have had the opportunity to do so
depending on the signal used.

`subprocess.CompletedProcess.returncode` is the negative signal number in this
case.

I hit this in a CI system where the parallelism used exceeded the RAM assigned
to the container causing the OOM killer to SIGKILL clang-tidy processes.

Reviewed By: sylvestre.ledru

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

3 years ago[rt][nfc] Rewrite #ifndef as #if defined().
Alexander Belyaev [Mon, 19 Jul 2021 12:17:13 +0000 (14:17 +0200)]
[rt][nfc] Rewrite #ifndef as #if defined().

3 years ago[mlir] Introduce `linalg.tiled_yield` terminator for `linalg.tiled_loop`.
Alexander Belyaev [Mon, 19 Jul 2021 10:57:36 +0000 (12:57 +0200)]
[mlir] Introduce `linalg.tiled_yield` terminator for `linalg.tiled_loop`.

https://llvm.discourse.group/t/rfc-changes-to-linalg-tiledloopop-to-unblock-reductions/3890

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

3 years ago[ORC-RT] Introduce a weak-import macro.
Lang Hames [Mon, 19 Jul 2021 11:52:14 +0000 (21:52 +1000)]
[ORC-RT] Introduce a weak-import macro.

This should eliminate warnings about ignored weak_import attributes on some of
the bots, e.g. https://lab.llvm.org/buildbot/#/builders/165/builds/3770/.

3 years ago[ORC-RT] Separate jit-dispach tag decls from definitions.
Lang Hames [Mon, 19 Jul 2021 11:21:40 +0000 (21:21 +1000)]
[ORC-RT] Separate jit-dispach tag decls from definitions.

This should eliminate the "initialized and declared 'extern'" warnings produced
on some bots, e.g. https://lab.llvm.org/buildbot/#/builders/165/builds/3770

3 years ago[CostModel][X86] Add fast math tests for float reductions
Simon Pilgrim [Mon, 19 Jul 2021 12:01:12 +0000 (13:01 +0100)]
[CostModel][X86] Add fast math tests for float reductions

As noticed on D105432 we didn't have any coverage to distinguish between fast/exact float reductions

3 years ago[SLP]Fix possible crash on unreachable incoming values sorting.
Alexey Bataev [Mon, 19 Jul 2021 11:18:27 +0000 (04:18 -0700)]
[SLP]Fix possible crash on unreachable incoming values sorting.

The incoming values for PHI nodes may come from unreachable BasicBlocks,
need to handle this case.

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

3 years ago[LoopUtils] Fix incorrect RT check bounds of loop-invariant mem accesses
Mindong Chen [Mon, 19 Jul 2021 11:24:38 +0000 (19:24 +0800)]
[LoopUtils] Fix incorrect RT check bounds of loop-invariant mem accesses

This fixes the lower and upper bound calculation of a
RuntimeCheckingPtrGroup when it has more than one loop
invariant pointers. Resolves PR50686.

Reviewed By: fhahn

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

3 years ago[LV] Re-generate check lines of some fragile tests (NFC)
Mindong Chen [Mon, 19 Jul 2021 11:21:04 +0000 (19:21 +0800)]
[LV] Re-generate check lines of some fragile tests (NFC)

Reviewed By: fhahn

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

3 years ago[mlir][memref] Clarify the documentation for memref.clone [NFC]
Stephan Herhut [Mon, 19 Jul 2021 10:12:36 +0000 (12:12 +0200)]
[mlir][memref] Clarify the documentation for memref.clone [NFC]

The wording was wrong and suggested that operands to memref.clone may not be mutated.

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

3 years ago[LV] Add test with ptr induction used as scalar and vector.
Florian Hahn [Tue, 6 Jul 2021 16:35:40 +0000 (17:35 +0100)]
[LV] Add test with ptr induction used as scalar and vector.

Test case inspired by D105199.

3 years agoRevert "[hwasan] Use stack safety analysis."
Florian Mayer [Mon, 19 Jul 2021 11:08:02 +0000 (12:08 +0100)]
Revert "[hwasan] Use stack safety analysis."

This reverts commit 12268fe14a1a65d4b62f0b6e5beab46ba8501ae7.

3 years agotsan: make obtaining current PC faster
Dmitry Vyukov [Thu, 15 Jul 2021 08:51:32 +0000 (10:51 +0200)]
tsan: make obtaining current PC faster

We obtain the current PC is all interceptors and collectively
common interceptor code contributes to overall slowdown
(in particular cheaper str/mem* functions).

The current way to obtain the current PC involves:

  4493e1:       e8 3a f3 fe ff          callq  438720 <_ZN11__sanitizer10StackTrace12GetCurrentPcEv>
  4493e9:       48 89 c6                mov    %rax,%rsi

and the called function is:

uptr StackTrace::GetCurrentPc() {
  438720:       48 8b 04 24             mov    (%rsp),%rax
  438724:       c3                      retq

The new way uses address of a local label and involves just:

  44a888:       48 8d 35 fa ff ff ff    lea    -0x6(%rip),%rsi

I am not switching all uses of StackTrace::GetCurrentPc to GET_CURRENT_PC
because it may lead some differences in produced reports and break tests.
The difference comes from the fact that currently we have PC pointing
to the CALL instruction, but the new way does not yield any code on its own
so the PC points to a random instruction in the function and symbolizing
that instruction can produce additional inlined frames (if the random
instruction happen to relate to some inlined function).

Reviewed By: vitalybuka, melver

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

3 years ago[ORC] Drop 'const' for __orc_rt_CWrapperFunctionResultDataUnion::ValuePtr.
Lang Hames [Mon, 19 Jul 2021 11:01:14 +0000 (21:01 +1000)]
[ORC] Drop 'const' for __orc_rt_CWrapperFunctionResultDataUnion::ValuePtr.

This member is now only used when storage is heap-allocated so it does not
need to be const. Dropping 'const' eliminates cast warnings on many builders.

3 years ago[ORC-RT] Fix missing std::move.
Lang Hames [Mon, 19 Jul 2021 10:59:28 +0000 (20:59 +1000)]
[ORC-RT] Fix missing std::move.

This should fix the 'could-not-covert' error at wrapper_function_utils.h:128 in
https://lab.llvm.org/buildbot/#/builders/112/builds/7748.

3 years ago[VE] Set getExtendForAtomicOps to ISD::ANY_EXTEND
Kazushi (Jam) Marukawa [Tue, 13 Jul 2021 20:01:10 +0000 (05:01 +0900)]
[VE] Set getExtendForAtomicOps to ISD::ANY_EXTEND

The implementation of subword atomics does not actually
guarantee the result is zero-extended, which now caused
failures after https://reviews.llvm.org/D101342 was landed.

Reviewed By: simoll

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

3 years ago[hwasan] Use stack safety analysis.
Florian Mayer [Fri, 16 Jul 2021 08:48:08 +0000 (09:48 +0100)]
[hwasan] Use stack safety analysis.

This avoids unnecessary instrumentation.

Reviewed By: eugenis, vitalybuka

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

3 years ago[X86][SSE] Fix copy+paste typo in dot3_float4_as_float3 partial load test
Simon Pilgrim [Mon, 19 Jul 2021 10:47:20 +0000 (11:47 +0100)]
[X86][SSE] Fix copy+paste typo in dot3_float4_as_float3 partial load test

3 years ago[ORC] Explicitly convert to ArrayRefs to silence errors.
Lang Hames [Mon, 19 Jul 2021 10:44:17 +0000 (20:44 +1000)]
[ORC] Explicitly convert to ArrayRefs to silence errors.

This aims to fix build failures like
https://lab.llvm.org/buildbot#builders/165/builds/3761.

3 years ago[compiler-rt][GWP-ASAN] Disable 2 tests on Armv7 Linux
David Spickett [Mon, 19 Jul 2021 10:43:21 +0000 (10:43 +0000)]
[compiler-rt][GWP-ASAN] Disable 2 tests on Armv7 Linux

These have been failing on our bots for a while due to
incomplete backtraces. (you don't get the names of the
functions that did the access, just the reporter frames)

See:
https://lab.llvm.org/buildbot/#/builders/170/builds/180

3 years ago[Polly] Use isl::set::tuple_dim instead of isl::set::dim. NFC
Riccardo Mori [Mon, 19 Jul 2021 10:41:46 +0000 (12:41 +0200)]
[Polly] Use isl::set::tuple_dim instead of isl::set::dim. NFC

This is part of an effort to reduce the differences between the custom C++ bindings used right now by polly in `lib/External/isl/include/isl/isl-noxceptions.h` and the official isl C++ interface.

Note that not all the usages of `isl::set::dim` were replaced

3 years ago[ORC] Add missing std::move.
Lang Hames [Mon, 19 Jul 2021 10:36:22 +0000 (20:36 +1000)]
[ORC] Add missing std::move.

This should fix the build failure at
https://lab.llvm.org/buildbot/#/builders/58/builds/11428.

3 years ago[VE] Disable relative lookup table converter pass for VE
Kazushi (Jam) Marukawa [Sat, 17 Jul 2021 19:32:21 +0000 (04:32 +0900)]
[VE] Disable relative lookup table converter pass for VE

VE's linker, /opt/nec/ve/bin/nld, doesn't implement relative lookup table.
The relative lookup table is introduced by https://reviews.llvm.org/D94355,
but we need to disable it at the moment.

Reviewed By: simoll

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

3 years ago[ORC-RT] Handle missing __has_builtin operator.
Lang Hames [Mon, 19 Jul 2021 10:17:40 +0000 (20:17 +1000)]
[ORC-RT] Handle missing __has_builtin operator.

For compilers that do not support __has_builtin just return '0'. This should fix
the bot failure at https://lab.llvm.org/buildbot/#/builders/165/builds/3761.

3 years ago[Polly][Isl] Use isl::union_map::unite() instead of isl::union_map::add_map(). NFC
Riccardo Mori [Mon, 19 Jul 2021 10:10:34 +0000 (12:10 +0200)]
[Polly][Isl] Use isl::union_map::unite() instead of isl::union_map::add_map(). NFC

This is part of an effort to reduce the differences between the custom C++ bindings used right now by polly in `lib/External/isl/include/isl/isl-noxceptions.h` and the official isl C++ interface.

Changes made:
 - Use `isl::union_map::unite()` instead of `isl::union_map::add_map()`
 - `isl-noexceptions.h` has been generated by this https://github.com/patacca/isl/commit/3f43ae29fa2a22936a583b85b2fe8d439f805d8d

Depends on D106059

Reviewed By: Meinersbur

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

3 years ago[NFC] [MTE] helper for stack tagging lifetimes.
Florian Mayer [Fri, 16 Jul 2021 09:34:58 +0000 (10:34 +0100)]
[NFC] [MTE] helper for stack tagging lifetimes.

Reviewed By: eugenis, vitalybuka

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

3 years ago[ORC][ORC-RT] Introduce ORC-runtime based MachO-Platform.
Lang Hames [Wed, 14 Jul 2021 11:09:36 +0000 (21:09 +1000)]
[ORC][ORC-RT] Introduce ORC-runtime based MachO-Platform.

Adds support for MachO static initializers/deinitializers and eh-frame
registration via the ORC runtime.

This commit introduces cooperative support code into the ORC runtime and ORC
LLVM libraries (especially the MachOPlatform class) to support macho runtime
features for JIT'd code. This commit introduces support for static
initializers, static destructors (via cxa_atexit interposition), and eh-frame
registration. Near-future commits will add support for MachO native
thread-local variables, and language runtime registration (e.g. for Objective-C
and Swift).

The llvm-jitlink tool is updated to use the ORC runtime where available, and
regression tests for the new MachOPlatform support are added to compiler-rt.

Notable changes on the ORC runtime side:

1. The new macho_platform.h / macho_platform.cpp files contain the bulk of the
runtime-side support. This includes eh-frame registration; jit versions of
dlopen, dlsym, and dlclose; a cxa_atexit interpose to record static destructors,
and an '__orc_rt_macho_run_program' function that defines running a JIT'd MachO
program in terms of the jit- dlopen/dlsym/dlclose functions.

2. Replaces JITTargetAddress (and casting operations) with ExecutorAddress
(copied from LLVM) to improve type-safety of address management.

3. Adds serialization support for ExecutorAddress and unordered_map types to
the runtime-side Simple Packed Serialization code.

4. Adds orc-runtime regression tests to ensure that static initializers and
cxa-atexit interposes work as expected.

Notable changes on the LLVM side:

1. The MachOPlatform class is updated to:

  1.1. Load the ORC runtime into the ExecutionSession.
  1.2. Set up standard aliases for macho-specific runtime functions. E.g.
       ___cxa_atexit -> ___orc_rt_macho_cxa_atexit.
  1.3. Install the MachOPlatformPlugin to scrape LinkGraphs for information
       needed to support MachO features (e.g. eh-frames, mod-inits), and
       communicate this information to the runtime.
  1.4. Provide entry-points that the runtime can call to request initializers,
       perform symbol lookup, and request deinitialiers (the latter is
       implemented as an empty placeholder as macho object deinits are rarely
       used).
  1.5. Create a MachO header object for each JITDylib (defining the __mh_header
       and __dso_handle symbols).

2. The llvm-jitlink tool (and llvm-jitlink-executor) are updated to use the
runtime when available.

3. A `lookupInitSymbolsAsync` method is added to the Platform base class. This
can be used to issue an async lookup for initializer symbols. The existing
`lookupInitSymbols` method is retained (the GenericIRPlatform code is still
using it), but is deprecated and will be removed soon.

4. JIT-dispatch support code is added to ExecutorProcessControl.

The JIT-dispatch system allows handlers in the JIT process to be associated with
'tag' symbols in the executor, and allows the executor to make remote procedure
calls back to the JIT process (via __orc_rt_jit_dispatch) using those tags.

The primary use case is ORC runtime code that needs to call bakc to handlers in
orc::Platform subclasses. E.g. __orc_rt_macho_jit_dlopen calling back to
MachOPlatform::rt_getInitializers using __orc_rt_macho_get_initializers_tag.
(The system is generic however, and could be used by non-runtime code).

The new ExecutorProcessControl::JITDispatchInfo struct provides the address
(in the executor) of the jit-dispatch function and a jit-dispatch context
object, and implementations of the dispatch function are added to
SelfExecutorProcessControl and OrcRPCExecutorProcessControl.

5. OrcRPCTPCServer is updated to support JIT-dispatch calls over ORC-RPC.

6. Serialization support for StringMap is added to the LLVM-side Simple Packed
Serialization code.

7. A JITLink::allocateBuffer operation is introduced to allocate writable memory
attached to the graph. This is used by the MachO header synthesis code, and will
be generically useful for other clients who want to create new graph content
from scratch.

3 years ago[ORC-RT] Fix signedness warning in unit test.
Lang Hames [Sun, 18 Jul 2021 05:16:28 +0000 (15:16 +1000)]
[ORC-RT] Fix signedness warning in unit test.

3 years ago[X86][SSE] Add codegen tests dot2/3 dot product of 128-bit dereferenceable float...
Simon Pilgrim [Mon, 19 Jul 2021 09:44:06 +0000 (10:44 +0100)]
[X86][SSE] Add codegen tests dot2/3 dot product of 128-bit dereferenceable float data

Based off the codegen reports on PR51075 - hopefully we can handle some of this in SLP or VectorCombine, but we usually have to leave load combining until the backend so at least some of these patterns will still appear even then.

3 years ago[Polly][Isl] Stop generating isl::union_{set,map} from isl::space. NFC
Riccardo Mori [Mon, 19 Jul 2021 08:47:52 +0000 (10:47 +0200)]
[Polly][Isl] Stop generating isl::union_{set,map} from isl::space. NFC

This is part of an effort to reduce the differences between the custom C++ bindings used right now by polly in `lib/External/isl/include/isl/isl-noxceptions.h` and the official isl C++ interface.

Changes made:
 - Stop generating `isl::union_set` and isl::union_map` from `isl::space` and instead generate them from `isl::ctx`
 - Disable clang-format on `isl-noexceptions.h`
 - Removed `isl::union_{set,map}` generator from `isl::space` from `isl-noexceptions.h`
 - `isl-noexceptions.h` has been generated by this https://github.com/patacca/isl/commit/87c3413b6f1d62ca3dddf716352f90a0b8533353

Reviewed By: Meinersbur

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

3 years ago[mlir][linalg] Set explicit insertion point in pad_tensor patterns.
Tobias Gysi [Mon, 19 Jul 2021 08:16:28 +0000 (08:16 +0000)]
[mlir][linalg] Set explicit insertion point in pad_tensor patterns.

Insert ops replacing pad_tensor in front of the associated tansfer_write / insert_slice op. Otherwise we may end up with invalid ir if one of the remaining tansfer_write / insert_slice operands is defined after the pad_tensor op.

Reviewed By: nicolasvasilache

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

3 years ago[clang-tidy] Add 'readability-suspicious-call-argument' check
Whisperity [Tue, 5 Sep 2017 10:58:20 +0000 (12:58 +0200)]
[clang-tidy] Add 'readability-suspicious-call-argument' check

Finds function calls where the call arguments might be provided in an
incorrect order, based on the comparison (via string metrics) of the
parameter names and the argument names against each other.

A diagnostic is emitted if an argument name is similar to a *different*
parameter than the one currently passed to, and it is sufficiently
dissimilar to the one it **is** passed to currently.

False-positive warnings from this check are useful to indicate bad
naming convention issues, even if a swap isn't necessary.
This check does not generate FixIts.

Originally implemented by @varjujan as his Master's Thesis work.
The check was subsequently taken over by @barancsuk who added type
conformity checks to silence false positive matches.
The work by @whisperity involved driving the check's review and fixing
some more bugs in the process.

Reviewed By: aaron.ballman, alexfh

Differential Revision: http://reviews.llvm.org/D20689

Co-authored-by: János Varjú <varjujanos2@gmail.com>
Co-authored-by: Lilla Barancsuk <barancsuklilla@gmail.com>
3 years ago[LoopFlatten] Use Loop to identify loop induction phi. NFC
Rosie Sumpter [Thu, 15 Jul 2021 07:51:30 +0000 (08:51 +0100)]
[LoopFlatten] Use Loop to identify loop induction phi. NFC

Replace code which identifies induction phi with helper function
getInductionVariable to improve robustness.

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

3 years ago[AArch64][SME] Add SVE2 instructions added in SME
Cullen Rhodes [Mon, 19 Jul 2021 07:40:04 +0000 (07:40 +0000)]
[AArch64][SME] Add SVE2 instructions added in SME

This patch adds support for the following instructions:

    SCLAMP, UCLAMP, REV, DUP (predicate)

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2021-06

Reviewed By: kmclaughlin

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

3 years ago[ARM] Extend more reductions during lowering
David Green [Mon, 19 Jul 2021 07:58:03 +0000 (08:58 +0100)]
[ARM] Extend more reductions during lowering

This relaxes the VMLAV and VADDV reduction recognition code to handle
smaller than legal types, extending them as needed. That was already
handled for some reductions, this extends it to more types in a more
generic way. If a smaller than legal value is found it is extended to
the legal type as needed.

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

3 years ago[AArch64][SVE] Optimize bitcasts between unpacked half/i16 vectors.
Sander de Smalen [Mon, 19 Jul 2021 06:13:14 +0000 (07:13 +0100)]
[AArch64][SVE] Optimize bitcasts between unpacked half/i16 vectors.

The case for nxv2f32/nxv2i32 was already covered by D104573.
This patch builds on top of that by making the mechanism work for
nxv2[b]f16/nxv2i16, nxv4[b]f16/nxv4i16 as well.

Reviewed By: efriedma

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

3 years ago[llvm-objdump][WebAssembly] Fix llvm-objdump on files without symbols
Andy Wingo [Wed, 7 Jul 2021 09:13:13 +0000 (11:13 +0200)]
[llvm-objdump][WebAssembly] Fix llvm-objdump on files without symbols

If a file has no symbols, perhaps because it is a linked executable,
synthesize some symbols by walking the code section.  Otherwise the
disassembler will try to treat the whole code section as a function,
which won't parse.  Fixes https://bugs.llvm.org/show_bug.cgi?id=50957.

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

3 years ago[OpenMP][CMake] Fix an issue when there is space in the argument LIBOMPTARGET_LIT_ARGS
Shilei Tian [Mon, 19 Jul 2021 01:54:05 +0000 (21:54 -0400)]
[OpenMP][CMake] Fix an issue when there is space in the argument LIBOMPTARGET_LIT_ARGS

D106236 added a new CMake argument for `libomptarget` test, but when user's
input contains white spaces, CMake will add escape char to the final lit command,
which leads to an error. This patch converts the user's input `LIBOMPTARGET_LIT_ARGS`
into a local array, and then passes the array to the function.

Reviewed By: JonChesterfield

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

3 years ago[polly] Fix uses of deprecated overload of IRBuilder::CreateGEP.
Eli Friedman [Mon, 19 Jul 2021 01:41:48 +0000 (18:41 -0700)]
[polly] Fix uses of deprecated overload of IRBuilder::CreateGEP.

3 years ago[polly] Fix regression tests with POLLY_ENABLE_GPGPU_CODEGEN
Eli Friedman [Mon, 19 Jul 2021 01:37:05 +0000 (18:37 -0700)]
[polly] Fix regression tests with POLLY_ENABLE_GPGPU_CODEGEN

Apparently there was a latent bug here.

3 years agoOpaque pointer GEP fixes for BrainF example
David Blaikie [Mon, 19 Jul 2021 01:24:42 +0000 (18:24 -0700)]
Opaque pointer GEP fixes for BrainF example

3 years ago[mlir-tblgen] Slightly improve the diagnostic message in pattern match
Chia-hung Duan [Mon, 19 Jul 2021 01:00:40 +0000 (09:00 +0800)]
[mlir-tblgen] Slightly improve the diagnostic message in pattern match

Reviewed By: jpienaar

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

3 years ago[X86] Remove incorrect use of known bits in shuffle simplification.
Eli Friedman [Sat, 17 Jul 2021 18:11:41 +0000 (11:11 -0700)]
[X86] Remove incorrect use of known bits in shuffle simplification.

This reverts commit 2a419a0b9957ebac9e11e4b43bc9fbe42a9207df.

The result of a shufflevector must not propagate poison from any element
other than the one noted in the shuffle mask.

The regressions outside of fptoui-may-overflow.ll can probably be
recovered some other way; for example, using isGuaranteedNotToBePoison.

See discussion on https://reviews.llvm.org/D106053 for more background.

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

3 years ago[openmp][nfc] Simplify macros guarding math complex headers
Jon Chesterfield [Sun, 18 Jul 2021 22:30:33 +0000 (23:30 +0100)]
[openmp][nfc] Simplify macros guarding math complex headers

The `__CUDA__` macro is already defined for openmp/nvptx and is not used by
`__clang_cuda_complex_builtins.h`, so dropping that macro slightly simplifies
nvptx and avoids defining it on amdgcn (where it is likely to be harmful).

Also dropped a cplusplus test from a C++ header as compilation will have
failed on cmath earlier if it was included from C.

Reviewed By: jdoerfert, fodinabor

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

3 years ago[InstCombine] Fold IntToPtr/PtrToInt to bitcast
Krishna Kariya [Sun, 18 Jul 2021 21:13:25 +0000 (23:13 +0200)]
[InstCombine] Fold IntToPtr/PtrToInt to bitcast

The inttoptr/ptrtoint roundtrip optimization is not always correct.
We are working towards removing this optimization and adding support
to specific cases where this optimization works. This patch is the
first one on this line.

Consider the example:

    %i = ptrtoint i8* %X to i64
    %p = inttoptr i64 %i to i16*
    %cmp = icmp eq i8* %load, %p

In this specific case, the inttoptr/ptrtoint optimization is correct
as it only compares the pointer values. In this patch, we fold
inttoptr/ptrtoint to a bitcast (if src and dest types are different).

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

3 years ago[SCEV] Fix unused variable warning (NFC)
Nikita Popov [Sun, 18 Jul 2021 21:12:22 +0000 (23:12 +0200)]
[SCEV] Fix unused variable warning (NFC)

3 years ago[polly] Get rid of a couple uses of PointerType::getElementType().
Eli Friedman [Sun, 18 Jul 2021 20:50:07 +0000 (13:50 -0700)]
[polly] Get rid of a couple uses of PointerType::getElementType().

3 years ago[CSSPGO][NFC] Allow cl::ZeroOrMore for use-iterative-bfi-inference
Wenlei He [Sun, 18 Jul 2021 19:13:30 +0000 (12:13 -0700)]
[CSSPGO][NFC] Allow cl::ZeroOrMore for use-iterative-bfi-inference

3 years ago[ScalarEvolution] Remove uses of PointerType::getElementType.
Eli Friedman [Sun, 18 Jul 2021 20:12:25 +0000 (13:12 -0700)]
[ScalarEvolution] Remove uses of PointerType::getElementType.

3 years agoReland [Orc] Add verylazy example for C-bindings
Valentin Churavy [Sun, 18 Jul 2021 14:22:34 +0000 (16:22 +0200)]
Reland [Orc] Add verylazy example for C-bindings

This patch relands https://reviews.llvm.org/D104799, but fixes the
memory handling causing leak sanitizer failures.

This reverts commit a56fe117e04f7d4b953a4226af412dad59425fb5.

3 years ago[SimplifyCFG] add test to show miscompile from FoldBranchToCommonDest (PR51125); NFC
Sanjay Patel [Sun, 18 Jul 2021 17:34:43 +0000 (13:34 -0400)]
[SimplifyCFG] add test to show miscompile from FoldBranchToCommonDest (PR51125); NFC

3 years ago[SimplifyCFG] remove unnecessary state variable; NFC
Sanjay Patel [Sun, 18 Jul 2021 15:49:02 +0000 (11:49 -0400)]
[SimplifyCFG] remove unnecessary state variable; NFC

Keeping a marker for Changed might have made sense before
this code was refactored, but we never touch that variable
after initialization now.

3 years ago[DAG] DAGCombiner::foldSelectOfBinops - propagate the common flags to the merged...
Simon Pilgrim [Sun, 18 Jul 2021 17:38:48 +0000 (18:38 +0100)]
[DAG] DAGCombiner::foldSelectOfBinops - propagate the common flags to the merged binop

As discussed on D106058 - we were failing to keep the common flags. This matches the behaviour in InstCombinerImpl::foldSelectOpOp.

3 years ago[DAG] Enable foldSelectOfBinops on select(setcc(),binop(),binop()) calls
Simon Pilgrim [Sun, 18 Jul 2021 16:59:56 +0000 (17:59 +0100)]
[DAG] Enable foldSelectOfBinops on select(setcc(),binop(),binop()) calls

3 years ago[OpenMP][Offloading] Add a CMake argument LIBOMPTARGET_LIT_ARGS to control behavior...
Shilei Tian [Sun, 18 Jul 2021 17:16:03 +0000 (13:16 -0400)]
[OpenMP][Offloading] Add a CMake argument LIBOMPTARGET_LIT_ARGS to control behavior of libomptarget lit test

By default, `lit` uses all threads to invoke tests, which  can easily cause out
of memory on GPUs because most of OpenMP offloading test usually take about 1GB
GPU memory, but a typical GPU only has 4-8GB memory. This patch introduce a
CMake argument `LIBOMPTARGET_LIT_ARGS` to allow users to control the behavior of
`libomptarget` tests, similar to `LLVM_LIT_ARGS`.

Reviewed By: JonChesterfield

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

3 years ago[Inline] Add test for PR50589 (NFC)
Nikita Popov [Sun, 18 Jul 2021 16:37:40 +0000 (18:37 +0200)]
[Inline] Add test for PR50589 (NFC)

3 years ago[Cloning] Remove unused parameter from CloneAndPruneFunctionInto() (NFC)
Nikita Popov [Sun, 18 Jul 2021 15:45:00 +0000 (17:45 +0200)]
[Cloning] Remove unused parameter from CloneAndPruneFunctionInto() (NFC)

3 years ago[X86] Add i32 (shl (sr[la] exact sel(X,Y), C1), C2) test
Simon Pilgrim [Sun, 18 Jul 2021 15:48:40 +0000 (16:48 +0100)]
[X86] Add i32 (shl (sr[la] exact sel(X,Y),  C1), C2) test

Shows failure to fold sel(sra(X,C1),sra(Y,C1)) -> sra(sel(X,Y),C1) (and to retain the flags)

3 years ago[Analysis] Remove getLoopPackage (NFC)
Kazu Hirata [Sun, 18 Jul 2021 15:16:29 +0000 (08:16 -0700)]
[Analysis] Remove getLoopPackage (NFC)

The last use was removed on Apr 28, 2014 in commit
c5a3139ebd0d60617629da83c6c66261b66c75e5.

3 years ago[NVPTX] Add select(cc,binop(),binop()) fast-math tests
Simon Pilgrim [Sun, 18 Jul 2021 14:30:11 +0000 (15:30 +0100)]
[NVPTX] Add select(cc,binop(),binop()) fast-math tests

As discussed on D106058 - we're not propagating the common flags to the merged binop

3 years ago[analyzer] Handle std::make_unique
Deep Majumder [Sun, 18 Jul 2021 14:24:41 +0000 (19:54 +0530)]
[analyzer] Handle std::make_unique

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

3 years agoRevert "[Orc] Add verylazy example for C-bindings"
Valentin Churavy [Sun, 18 Jul 2021 14:21:37 +0000 (16:21 +0200)]
Revert "[Orc] Add verylazy example for C-bindings"

Broke ASAN buildbot, will reland with fixes

This reverts commit b5a6ad8c893a642bcb08ab81b251952c545405d9.

3 years ago[DAG] Move select(cc, binop(), binop()) folds into DAGCombiner::foldSelectOfBinops...
Simon Pilgrim [Sun, 18 Jul 2021 13:54:25 +0000 (14:54 +0100)]
[DAG] Move select(cc, binop(), binop()) folds into DAGCombiner::foldSelectOfBinops. NFCI.

I'm going to extend the functionality started in D106058 so move the folds into their own method to reduce the amount of code in DAGCombiner::visitSELECT

3 years ago[OpenMP][Offloading] Add -g when compiling deviceRTLs in debug mode
Shilei Tian [Sun, 18 Jul 2021 13:34:35 +0000 (09:34 -0400)]
[OpenMP][Offloading] Add -g when compiling deviceRTLs in debug mode

Currently when we compile the project in debug mode, `-g` will not be added to
compilation flag. The bc files generated in different mode are of different size.
When using GPU debuggers like `cuda-gdb`, it is expected to provide more info
with a debug version of bc lib.

Reviewed By: JonChesterfield

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

3 years ago[X86][SSE] matchShuffleWithPACK - avoid poison pollution from bitcasting multiple...
Simon Pilgrim [Sun, 18 Jul 2021 13:25:28 +0000 (14:25 +0100)]
[X86][SSE] matchShuffleWithPACK - avoid poison pollution from bitcasting multiple elements together.

D106053 exposed that we've not been taking into account that by bitcasting smaller elements together and then performing a ComputeKnownBits on the result we'd be allowing a poison element to influence other neighbouring elements being used in the pack. Instead we now peek through any existing bitcast to ensure that the source type already matches the width source of the pack node we're trying to match.

This has also been a chance to stop matchShuffleWithPACK creating unused nodes on the fly which could affect oneuse tests during shuffle lowering/combining.

The only regression we're seeing is due to being unable to peek through a bitcast as its on the other side of a extract_subvector - which should go away once we finally allow shuffle combining across different vector widths (by making matchShuffleWithPACK using const SelectionDAG& we've gotten closer to this - see PR45974).

3 years ago[Orc] Remove unnecessary <string> include dependency from Orc headers. NFC.
Simon Pilgrim [Sat, 17 Jul 2021 19:27:57 +0000 (20:27 +0100)]
[Orc] Remove unnecessary <string> include dependency from Orc headers. NFC.

At most these use the StringRef/Twine wrappers and don't have any implicit uses of std::string.

Move the include down to any cpp implementation where std::string is actually used.

3 years ago[InstCombine] fold reassociative FP add into start value of fadd reduction
Sanjay Patel [Sat, 17 Jul 2021 22:36:36 +0000 (18:36 -0400)]
[InstCombine] fold reassociative FP add into start value of fadd reduction

This pattern is visible in unrolled and vectorized loops.
Although the backend seems to be able to reassociate to
ideal form in the examples I looked at, we might as well
do that in IR for efficiency.

3 years ago[InstCombine][test] add tests for fadd reductions; NFC
Sanjay Patel [Fri, 16 Jul 2021 20:29:56 +0000 (16:29 -0400)]
[InstCombine][test] add tests for fadd reductions; NFC

3 years ago[Orc] Add verylazy example for C-bindings
Valentin Churavy [Sun, 18 Jul 2021 10:07:05 +0000 (12:07 +0200)]
[Orc] Add verylazy example for C-bindings

Still WIP, based on the Kaleidoscope/BuildingAJIT/Chapter4.

Reviewed By: lhames

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

3 years ago[MLIR][CAPI] On MINGW don't link against libMLIR
Valentin Churavy [Sun, 18 Jul 2021 10:05:46 +0000 (12:05 +0200)]
[MLIR][CAPI] On MINGW don't link against libMLIR

Cross-compiling MLIR with MINGW failed because adding libMLIR to the libraries to link against would lead to duplicated symbols.

```
[09:28:14] ninja: job failed: : && /opt/bin/i686-w64-mingw32-libgfortran4-cxx03/i686-w64-mingw32-g++ --sysroot=/opt/i686-w64-mingw32/i686-w64-mingw32/sys-root/  -remap -D__USING_SJLJ_EXCEPTIONS__ -D__CRT__NO_INLINE -fno-gnu-unique -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment  -O2 -DNDEBUG   -shared -o bin/libMLIRPublicAPI.dll -Wl,--out-implib,lib/libMLIRPublicAPI.dll.a -Wl,--major-image-version,0,--minor-image-version,0 tools/mlir/lib/CAPI/IR/CMakeFiles/obj.MLIRCAPIIR.dir/AffineExpr.cpp.obj tools/mlir/lib/CAPI/IR/CMakeFiles/obj.MLIRCAPIIR.dir/AffineMap.cpp.obj tools/mlir/lib/CAPI/IR/CMakeFiles/obj.MLIRCAPIIR.dir/BuiltinAttributes.cpp.obj tools/mlir/lib/CAPI/IR/CMakeFiles/obj.MLIRCAPIIR.dir/BuiltinTypes.cpp.obj tools/mlir/lib/CAPI/IR/CMakeFiles/obj.MLIRCAPIIR.dir/Diagnostics.cpp.obj tools/mlir/lib/CAPI/IR/CMakeFiles/obj.MLIRCAPIIR.dir/IntegerSet.cpp.obj tools/mlir/lib/CAPI/IR/CMakeFiles/obj.MLIRCAPIIR.dir/IR.cpp.obj tools/mlir/lib/CAPI/IR/CMakeFiles/obj.MLIRCAPIIR.dir/Pass.cpp.obj tools/mlir/lib/CAPI/IR/CMakeFiles/obj.MLIRCAPIIR.dir/Support.cpp.obj tools/mlir/lib/CAPI/Registration/CMakeFiles/obj.MLIRCAPIRegistration.dir/Registration.cpp.obj tools/mlir/lib/CAPI/Dialect/CMakeFiles/obj.MLIRCAPILinalg.dir/Linalg.cpp.obj tools/mlir/lib/CAPI/Dialect/CMakeFiles/obj.MLIRCAPISCF.dir/SCF.cpp.obj tools/mlir/lib/CAPI/Dialect/CMakeFiles/obj.MLIRCAPIShape.dir/Shape.cpp.obj tools/mlir/lib/CAPI/Dialect/CMakeFiles/obj.MLIRCAPIStandard.dir/Standard.cpp.obj tools/mlir/lib/CAPI/Dialect/CMakeFiles/obj.MLIRCAPITensor.dir/Tensor.cpp.obj tools/mlir/lib/CAPI/Transforms/CMakeFiles/obj.MLIRCAPITransforms.dir/Passes.cpp.obj  lib/libMLIR.dll.a  lib/libMLIRIR.a  lib/libMLIRParser.a  lib/libMLIRSupport.a  lib/libMLIRPass.a  lib/libMLIRCAPIIR.a  lib/libMLIRAffine.a  lib/libMLIRAffineEDSC.a  lib/libMLIRAffineTransforms.a  lib/libMLIRAffineUtils.a  lib/libMLIRArmNeon.a  lib/libMLIRArmSVE.a  lib/libMLIRAsync.a  lib/libMLIRAsyncTransforms.a  lib/libMLIRAVX512.a  lib/libMLIRComplex.a  lib/libMLIRGPU.a  lib/libMLIRLinalgAnalysis.a  lib/libMLIRLinalgEDSC.a  lib/libMLIRLinalg.a  lib/libMLIRLinalgTransforms.a  lib/libMLIRLinalgUtils.a  lib/libMLIRLLVMIRTransforms.a  lib/libMLIRLLVMIR.a  lib/libMLIRLLVMAVX512.a  lib/libMLIRLLVMArmNeon.a  lib/libMLIRLLVMArmSVE.a  lib/libMLIRNVVMIR.a  lib/libMLIRROCDLIR.a  lib/libMLIROpenACC.a  lib/libMLIROpenMP.a  lib/libMLIRPDL.a  lib/libMLIRPDLInterp.a  lib/libMLIRQuant.a  lib/libMLIRSCF.a  lib/libMLIRSCFTransforms.a  lib/libMLIRSDBM.a  lib/libMLIRShape.a  lib/libMLIRShapeOpsTransforms.a  lib/libMLIRSPIRV.a  lib/libMLIRSPIRVModuleCombiner.a  lib/libMLIRSPIRVConversion.a  lib/libMLIRSPIRVTransforms.a  lib/libMLIRSPIRVUtils.a  lib/libMLIRStandard.a  lib/libMLIRStandardOpsTransforms.a  lib/libMLIRTensor.a  lib/libMLIRTensorTransforms.a  lib/libMLIRTosa.a  lib/libMLIRTosaTransforms.a  lib/libMLIRVector.a  lib/libMLIRCAPIIR.a  lib/libMLIRLinalg.a  lib/libMLIRCAPIIR.a  lib/libMLIRSCF.a  lib/libMLIRCAPIIR.a  lib/libMLIRShape.a  lib/libMLIRCAPIIR.a  lib/libMLIRStandard.a  lib/libMLIRCAPIIR.a  lib/libMLIRTensor.a  lib/libMLIRTransforms.a  lib/libMLIRAsync.a  lib/libMLIRAffineUtils.a  lib/libMLIRLinalgAnalysis.a  lib/libMLIRLinalgEDSC.a  lib/libMLIRVectorToSCF.a  lib/libMLIRVectorToLLVM.a  lib/libMLIRArmNeonToLLVM.a  lib/libMLIRArmNeon.a  lib/libMLIRLLVMArmNeon.a  lib/libMLIRAVX512ToLLVM.a  lib/libMLIRAVX512.a  lib/libMLIRLLVMAVX512.a  lib/libMLIRArmSVEToLLVM.a  lib/libMLIRArmSVE.a  lib/libMLIRLLVMArmSVE.a  lib/libMLIRStandardToLLVM.a  lib/libMLIRTargetLLVMIRModuleTranslation.a  lib/libMLIRLLVMIRTransforms.a  lib/libMLIRLLVMIR.a  lib/libMLIROpenMP.a  lib/libMLIRTranslation.a  lib/libMLIRSPIRVConversion.a  lib/libMLIRSPIRV.a  lib/libMLIRParser.a  lib/libMLIRTransforms.a  lib/libMLIRVector.a  lib/libMLIRAffineEDSC.a  lib/libMLIRLinalg.a  lib/libMLIRCopyOpInterface.a  lib/libMLIRTosa.a  lib/libMLIRQuant.a  lib/libMLIRTransformUtils.a  lib/libMLIRLoopAnalysis.a  lib/libMLIRPresburger.a  lib/libMLIRRewrite.a  lib/libMLIRPDLToPDLInterp.a  lib/libMLIRPass.a  lib/libMLIRAnalysis.a  lib/libMLIRAffine.a  lib/libMLIRSCF.a  lib/libMLIRLoopLikeInterface.a  lib/libMLIRPDLInterp.a  lib/libMLIRPDL.a  lib/libMLIRInferTypeOpInterface.a  lib/libMLIRStandard.a  lib/libMLIRTensor.a  lib/libMLIREDSC.a  lib/libMLIRCastInterfaces.a  lib/libMLIRVectorInterfaces.a  lib/libMLIRSideEffectInterfaces.a  lib/libMLIRDialect.a  lib/libMLIRViewLikeInterface.a  lib/libMLIRCallInterfaces.a  lib/libMLIRControlFlowInterfaces.a  lib/libMLIRIR.a  lib/libMLIRSupport.a  lib/libLLVM.dll.a  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && :
[09:28:14] lib/libMLIRAffine.a(AffineOps.cpp.obj):AffineOps.cpp:(.text+0x1d600): multiple definition of `mlir::AffineDialect::initialize()'
[09:28:14] lib/libMLIR.dll.a(d008729.o):(.text+0x0): first defined here
[09:28:14] lib/libMLIRArmSVE.a(ArmSVEDialect.cpp.obj):ArmSVEDialect.cpp:(.text+0x5be0): multiple definition of `mlir::arm_sve::ArmSVEDialect::initialize()'
[09:28:14] lib/libMLIR.dll.a(d039020.o):(.text+0x0): first defined here
[09:28:14] lib/libMLIRAsync.a(Async.cpp.obj):Async.cpp:(.text+0xc0d0): multiple definition of `mlir::async::AsyncDialect::initialize()'
[09:28:14] lib/libMLIR.dll.a(d023173.o):(.text+0x0): first defined here
...
```

Reviewed By: stellaraccident

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

3 years ago[analyzer] Handle std::swap for std::unique_ptr
Deep Majumder [Sun, 18 Jul 2021 09:10:31 +0000 (14:40 +0530)]
[analyzer] Handle std::swap for std::unique_ptr

This patch handles the `std::swap` function specialization
for `std::unique_ptr`. Implemented to be very similar to
how `swap` method is handled

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

3 years ago[RISCV] Add more i32 srem/sdiv with power of 2 constant tests. NFC
Craig Topper [Sun, 18 Jul 2021 06:48:35 +0000 (23:48 -0700)]
[RISCV] Add more i32 srem/sdiv with power of 2 constant tests. NFC

Add a small power 2 srem test to match existing sdiv test. Add
larger power of 2 test to both.

The larger constant test shows materialization of a constant
for an AND in the RV64 code. We should be using W shift instructions
to match the RV32 code.

3 years agoDebugInfo: Name class templates with default arguments consistently (both direct...
David Blaikie [Sun, 18 Jul 2021 06:38:33 +0000 (23:38 -0700)]
DebugInfo: Name class templates with default arguments consistently (both direct naming, and as a template argument for a function template)

It's noteworthy that GCC has the same bug here, which is a bit
surprising. Both Clang and GCC's bug is only for function template
arguments that are themselves templates with default template arguments
(f1<t1<int[, missing_default_here]>>). Probably because function name
matching isn't generally necessary - whereas type matching is necessary
for DWARF consumers to associate declarations and definitions across
translation units, so the bug's been addressed there already - but
continued to exist for function templates since it's fairly benign
there.

I came across this while working on a change that could reconstitute
these pretty printed names based on the rest of the DWARF, reducing the
size of the DWARF by not having to encode all the template parameters in
the name string. That reconstitution code can't tell the difference
between a defaulted argument or not, so couldn't create the current
buggy-ish output.

Making the names more consistent between direct and indirect references,
and between function and class templates seems all to the good.

(I fixed the function template version of this a few years back in
9fdd09a4ccd01feb8e00be22b17e944e46807746 - clearly I should've looked
more closely and generalized the code better so it only had to be fixed
once - well, doing that here now)

3 years ago[GlobalISel] Fix known bits for G_BSWAP and B_BITREVERSE not doing anything.
Amara Emerson [Sun, 18 Jul 2021 06:03:52 +0000 (23:03 -0700)]
[GlobalISel] Fix known bits for G_BSWAP and B_BITREVERSE not doing anything.

llvm::KnownBits::byteSwap() and reverse() don't modify in-place, so
we weren't actually computing anything. This was causing a miscompile on an
arm64 stage2 bootstrap clang build.

3 years ago[Sanitizers] FutexWake fix typo for FreeBSD code path.
David Carlier [Sun, 18 Jul 2021 06:02:21 +0000 (07:02 +0100)]
[Sanitizers] FutexWake fix typo for FreeBSD code path.

3 years ago[AArch64][GlobalISel] Legalize bswap <2 x i16>
Jon Roelofs [Fri, 9 Jul 2021 16:46:57 +0000 (09:46 -0700)]
[AArch64][GlobalISel] Legalize bswap <2 x i16>

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

3 years ago[ExecutionEngine] Fix GEP type
Nikita Popov [Sat, 17 Jul 2021 21:43:36 +0000 (23:43 +0200)]
[ExecutionEngine] Fix GEP type

Fix bug introduced in 2c68ecccc9ee1fb37eca318a9b3572813a137cd5,
the GEP type was off-by-ptr. Apparently I didn't run the MLIR
tests.

3 years ago[ARM] Lower non-extended small gathers via truncated gathers.
David Green [Sat, 17 Jul 2021 21:38:31 +0000 (22:38 +0100)]
[ARM] Lower non-extended small gathers via truncated gathers.

Corollary to 1113e06821e6baffc84b8caf96a28bf62e6d28dc this allows us to
match gather that dont produce a full vector width results. They use an
extended gather which is truncated back to the original type.

3 years ago[AArch64] Prepare for changes to STEP_VECTOR.
Eli Friedman [Mon, 12 Jul 2021 21:39:45 +0000 (14:39 -0700)]
[AArch64] Prepare for changes to STEP_VECTOR.

Rewrite patterns to assume that the operand of STEP_VECTOR is a
constant. The old patterns will stop working when the operand is changed
from a Constant to a TargetConstant. (See D105673.)

Add test coverage for certain patterns that weren't exercised by
existing regression tests.

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

3 years ago[IRBuilder] Deprecate CreateGEP() without element type
Nikita Popov [Sat, 17 Jul 2021 19:29:05 +0000 (21:29 +0200)]
[IRBuilder] Deprecate CreateGEP() without element type

This API is incompatible with opaque pointers and deprecated in
favor of the version that accepts an explicit element type.

Also remove the separate overload for a single index, as this is
already covered by the ArrayRef overload.

3 years ago[OpaquePtr] Remove uses of CreateGEP() without element type
Nikita Popov [Sat, 17 Jul 2021 20:03:11 +0000 (22:03 +0200)]
[OpaquePtr] Remove uses of CreateGEP() without element type

Remove uses of to-be-deprecated API. In cases where the correct
element type was not immediately obvious to me, fall back to
explicit getPointerElementType().

3 years ago[IRBuilder] Deprecate CreateInBoundsGEP() without element type
Nikita Popov [Sat, 17 Jul 2021 16:50:34 +0000 (18:50 +0200)]
[IRBuilder] Deprecate CreateInBoundsGEP() without element type

This API is incompatible with opaque pointers and deprecated in
favor of the version that accepts an explicit element type.

3 years ago[OpaquePtr] Remove uses of CreateInBoundsGEP() without element type
Nikita Popov [Sat, 17 Jul 2021 16:59:11 +0000 (18:59 +0200)]
[OpaquePtr] Remove uses of CreateInBoundsGEP() without element type

Remove uses of to-be-deprecated API.

Unfortunately this one mostly just makes the use of
getPointerElementType() explicit, as the correct type to use
wasn't immediately available (deriving it from QualType is left
as an excercise to the reader).

3 years ago[RISCV] Teach computeKnownBitsForTargetNode that VLENB will never be more than 65536/8.
Craig Topper [Sat, 17 Jul 2021 18:24:20 +0000 (11:24 -0700)]
[RISCV] Teach computeKnownBitsForTargetNode that VLENB will never be more than 65536/8.

3 years ago[libcxx] Updated test and seemingly incorrect comment from it.
Vy Nguyen [Thu, 15 Jul 2021 19:51:34 +0000 (15:51 -0400)]
[libcxx] Updated test and seemingly incorrect comment from it.

Background: https://reviews.llvm.org/D82490#inline-1007741

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

3 years ago[lld-macho] Have ICF operate on all sections at once
Jez Ng [Sat, 17 Jul 2021 17:42:26 +0000 (13:42 -0400)]
[lld-macho] Have ICF operate on all sections at once

ICF previously operated only within a given OutputSection. We would
merge all CFStrings first, then merge all regular code sections in a
second phase. This worked fine since CFStrings would never reference
regular `__text` sections. However, I would like to expand ICF to merge
functions that reference unwind info. Unwind info references the LSDA
section, which can in turn reference the `__text` section, so we cannot
perform ICF in phases.

In order to have ICF operate on InputSections spanning multiple
OutputSections, we need a way to distinguish InputSections that are
destined for different OutputSections, so that we don't fold across
section boundaries. We achieve this by creating OutputSections early,
and setting `InputSection::parent` to point to them. This is what
LLD-ELF does. (This change should also make it easier to implement the
`section$start$` symbols.)

This diff also folds InputSections w/o checking their flags, which I
think is the right behavior -- if they are destined for the same
OutputSection, they will have the same flags in the output (even if
their input flags differ). I.e. the `parent` pointer check subsumes the
`flags` check. In practice this has nearly no effect (ICF did not become
any more effective on chromium_framework).

I've also updated ICF.cpp's block comment to better reflect its current
status.

Reviewed By: #lld-macho, smeenai

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

3 years ago[libcxx][ranges] makes `ranges::subrange` a borrowed range
Christopher Di Bella [Sat, 17 Jul 2021 01:35:42 +0000 (01:35 +0000)]
[libcxx][ranges] makes `ranges::subrange` a borrowed range

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

3 years ago[AbstractAttributor] Fix two issues in folding __kmpc_is_spmd_exec_mode
Shilei Tian [Sat, 17 Jul 2021 17:13:30 +0000 (13:13 -0400)]
[AbstractAttributor] Fix two issues in folding __kmpc_is_spmd_exec_mode

This patch fixed two issues found when folding `__kmpc_is_spmd_exec_mode`:
1. When the reaching kernels are empty, it should not fold to generic mode.
2. When creating AA for the caller when updating information, the dependency
   should be required.

Reviewed By: ye-luo

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

3 years ago[IRBuilder] Deprecate CreateStructGEP() without element type
Nikita Popov [Sat, 17 Jul 2021 16:33:19 +0000 (18:33 +0200)]
[IRBuilder] Deprecate CreateStructGEP() without element type

This API is incompatible with opaque pointers and deprecated in
favor of the version that accepts an explicit element type.

3 years ago[OpaquePtr] Remove uses of CreateStructGEP() without element type
Nikita Popov [Sat, 17 Jul 2021 16:44:56 +0000 (18:44 +0200)]
[OpaquePtr] Remove uses of CreateStructGEP() without element type

Remove uses of to-be-deprecated API.

3 years ago[RISCV][RVV] Precommit a test case for D105684
ShihPo Hung [Fri, 9 Jul 2021 08:44:15 +0000 (16:44 +0800)]
[RISCV][RVV] Precommit a test case for D105684

Reviewed By: frasercrmck

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

3 years ago[IRBuilder] Deprecate CreateConstGEP1_32() without element type
Nikita Popov [Sat, 17 Jul 2021 15:09:43 +0000 (17:09 +0200)]
[IRBuilder] Deprecate CreateConstGEP1_32() without element type

This API is incompatible with opaque pointers and deprecated in
favor of the version that accepts an explicit element type.

3 years ago[OpaquePtr] Remove uses of CreateConstGEP1_32() without element type
Nikita Popov [Sat, 17 Jul 2021 16:25:31 +0000 (18:25 +0200)]
[OpaquePtr] Remove uses of CreateConstGEP1_32() without element type

Remove uses of to-be-deprecated API. I've fallen back to calling
getPointerElementType() in some cases where the correct type wasn't
immediately obvious to me.

3 years ago[DebugInfo] Remove unnecessary <string> include dependency from DebugInfo headers...
Simon Pilgrim [Sat, 17 Jul 2021 15:55:51 +0000 (16:55 +0100)]
[DebugInfo] Remove unnecessary <string> include dependency from DebugInfo headers. NFC.

At most these use the StringRef/Twine wrappers and don't have any implicit uses of std::string.

Move the include down to any cpp implementation where std::string is actually used.

3 years ago[IRBuilder] Deprecate CreateConstInBoundsGEP1_64() without element type
Nikita Popov [Sat, 17 Jul 2021 14:46:29 +0000 (16:46 +0200)]
[IRBuilder] Deprecate CreateConstInBoundsGEP1_64() without element type

This API is incompatible with opaque pointers and deprecated in
favor of the version that accepts an explicit element type.

3 years ago[OpaquePtr] Remove uses of CGF.Builder.CreateConstInBoundsGEP1_64() without type
Nikita Popov [Sat, 17 Jul 2021 15:00:00 +0000 (17:00 +0200)]
[OpaquePtr] Remove uses of CGF.Builder.CreateConstInBoundsGEP1_64() without type

Remove uses of to-be-deprecated API.