platform/upstream/llvm.git
2 years ago[NFC] Fix spelling/newlines in comments/debug messages
David Penry [Tue, 29 Mar 2022 17:13:55 +0000 (10:13 -0700)]
[NFC] Fix spelling/newlines in comments/debug messages

Just a few spelling mistakes and missing newlines

Reviewed By: dmgreen

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

2 years ago[format] Fix an uninitialized variable
Benjamin Kramer [Tue, 7 Jun 2022 16:17:40 +0000 (18:17 +0200)]
[format] Fix an uninitialized variable

parseBlock may decide to leave it unchanged. Found by msan.

2 years ago[Libomptarget] Do not use retaining attributes for the static library
Joseph Huber [Tue, 31 May 2022 14:08:25 +0000 (10:08 -0400)]
[Libomptarget] Do not use retaining attributes for the static library

When we build the libomptarget device runtime library targeting bitcode,
we need special care to make sure that certain functions are not
optimized out. This is because we manually internalize and optimize
these definitions, ignoring their standard linkage semantics. When we
build with the static library, we can maintain these semantics and we do
not need these to be kept-alive. Furthermore, if they are kept-alive it
prevents them from being removed during LTO. This prevents us from
completely internalizing `IsSPMDMode` and removing several other
functions. This patch removes these for the static library target by
using a macro definition to enable them.

Reviewed By: JonChesterfield

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

2 years ago[DAG] combineShuffleOfSplatVal - fold shuffle(splat,undef) -> splat, iff the splat...
Simon Pilgrim [Tue, 7 Jun 2022 15:42:15 +0000 (16:42 +0100)]
[DAG] combineShuffleOfSplatVal - fold shuffle(splat,undef) -> splat, iff the splat contains no UNDEF elements

As noticed on D127115 - we were missing this fold, instead just having the shuffle(shuffle(x,undef,splatmask),undef) fold. We should be able to merge these into one using SelectionDAG::isSplatValue, but we'll need to match the shuffle's undef handling first.

This also exposed an issue in SelectionDAG::isSplatValue which was incorrectly propagating the undef mask across a bitcast (it was trying to just bail with a APInt::isSubsetOf if it found any undefs but that was actually the wrong way around so didn't fire for partial undef cases).

2 years ago[LLDB] Remove decorator from XPASSes AArch64/Windows
Muhammad Omair Javaid [Tue, 7 Jun 2022 15:30:24 +0000 (19:30 +0400)]
[LLDB] Remove decorator from XPASSes AArch64/Windows

This patch remove XFAIL decorator from tests which as passing on AArch64
Windows. This is tested on surface pro x using tot llvm and clang 14.0.3
as compiler with visual studio 2019 x86_arm64 environment.

2 years ago[LLDB] Fix TestBase.generateSource for AArch64/Windows
Muhammad Omair Javaid [Tue, 7 Jun 2022 13:47:50 +0000 (17:47 +0400)]
[LLDB] Fix TestBase.generateSource for AArch64/Windows

This patch adds a minor fix in lldbtest.py TestBase.generateSource
function. Generated Python source with directory paths was not being
escaped properly. This fix makes sure we treat dir path as raw string.

2 years ago[LoopFlatten] Fix crash if the inner loop trip count comes from a sext instruction.
Craig Topper [Tue, 7 Jun 2022 15:21:20 +0000 (08:21 -0700)]
[LoopFlatten] Fix crash if the inner loop trip count comes from a sext instruction.

If we look through a truncate in matchLinearIVUser, it's possible
we find a sext/zext instruction that didn't come from widening.
This will fail the MatchedItCount->getType() == InnerInductionPHI->getType()
assertion.

Fix this by checking that we did not look through a truncate already.

Reviewed By: SjoerdMeijer

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

2 years ago[LoopFlatten] Replace unchecked dyn_cast with cast.
Craig Topper [Tue, 7 Jun 2022 15:20:59 +0000 (08:20 -0700)]
[LoopFlatten] Replace unchecked dyn_cast with cast.

Spotted while reading through the code.

Reviewed By: SjoerdMeijer

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

2 years ago[RISCV] Scalarize gather/scatter on RV64 with Zve32* extension.
Craig Topper [Tue, 7 Jun 2022 15:07:49 +0000 (08:07 -0700)]
[RISCV] Scalarize gather/scatter on RV64 with Zve32* extension.

i64 indices aren't supported on Zve32*. Scalarize gathers to prevent
generating illegal instructions.

Since InstCombine will aggressively canonicalize GEP indices to
pointer size, we're pretty much always going to have an i64 index.

Trying to predict when SelectionDAG will find a smaller index from
the TTI hook used by the ScalarizeMaskedMemIntrinPass seems fragile.
To optimize this we probably need an IR pass to rewrite it earlier.

Test RUN lines have also been added to make sure the strided load/store
optimization still works.

Reviewed By: reames

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

2 years ago[SLP]Add a test for geps with non-const indeces in scatter vectorize
Alexey Bataev [Tue, 7 Jun 2022 15:02:14 +0000 (08:02 -0700)]
[SLP]Add a test for geps with non-const indeces in scatter vectorize
nodes, NFC.

2 years ago[gn build] Port 47c8ec811f78
LLVM GN Syncbot [Tue, 7 Jun 2022 14:38:58 +0000 (14:38 +0000)]
[gn build] Port 47c8ec811f78

2 years ago[clang][AArch64][SVE] Improve diagnostics for SVE operators
David Truby [Mon, 6 Jun 2022 11:15:38 +0000 (12:15 +0100)]
[clang][AArch64][SVE] Improve diagnostics for SVE operators

This patch corrects some diagnostics for the SVE sizeless vector
operators, including correctly diagnosing when the vectors are
different sizes.

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

2 years ago[DX][ObjYAML] Zero out unused fields that get written to the output file
Benjamin Kramer [Tue, 7 Jun 2022 14:29:06 +0000 (16:29 +0200)]
[DX][ObjYAML] Zero out unused fields that get written to the output file

Found by msan

2 years agollvm-reduce: Add -abort-on-invalid-reduction to MIR tests
Matt Arsenault [Mon, 6 Jun 2022 13:17:55 +0000 (09:17 -0400)]
llvm-reduce: Add -abort-on-invalid-reduction to MIR tests

Ideally reductions would never produce invalid IR, and we shouldn't
regress on cases that already avoid doing so.

2 years agollvm-reduce: Don't set generic instruction operands to undef
Matt Arsenault [Mon, 6 Jun 2022 13:21:02 +0000 (09:21 -0400)]
llvm-reduce: Don't set generic instruction operands to undef

The intention is that these should never have undef operands. It turns
out the restriction the verifier enforces is too lax. The verifier
enforces that registers without a register class cannot be undef, but
it's valid to use a register with a register class and type. The
verifier needs to change to be based on the opcode.

2 years agollvm-reduce: Add pass to remove register uses
Matt Arsenault [Fri, 22 Apr 2022 15:44:37 +0000 (11:44 -0400)]
llvm-reduce: Add pass to remove register uses

Try to delete implicit uses, and add undef flags to explicit ones.

2 years ago[AMDGPU] Add support for the .reloc directive
Jay Foad [Mon, 6 Jun 2022 14:51:18 +0000 (15:51 +0100)]
[AMDGPU] Add support for the .reloc directive

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

2 years agollvm-reduce: Add cloning of target MachineFunctionInfo
Matt Arsenault [Sat, 16 Apr 2022 02:35:53 +0000 (22:35 -0400)]
llvm-reduce: Add cloning of target MachineFunctionInfo

MIR support is totally unusable for AMDGPU without this, since the set
of reserved registers is set from fields here.

Add a clone method to MachineFunctionInfo. This is a subtle variant of
the copy constructor that is required if there are any MIR constructs
that use pointers. Specifically, at minimum fields that reference
MachineBasicBlocks or the MachineFunction need to be adjusted to the
values in the new function.

2 years agoAMDGPU: Make PSV instances static members
Matt Arsenault [Mon, 18 Apr 2022 15:01:19 +0000 (11:01 -0400)]
AMDGPU: Make PSV instances static members

2 years ago[libc++] Forgot to bump the CI timeout everywhere
Louis Dionne [Tue, 7 Jun 2022 14:01:01 +0000 (10:01 -0400)]
[libc++] Forgot to bump the CI timeout everywhere

2 years ago[libc++] Bump timeout to avoid spurious failures on AIX
Louis Dionne [Tue, 7 Jun 2022 14:00:25 +0000 (10:00 -0400)]
[libc++] Bump timeout to avoid spurious failures on AIX

2 years agollvm-reduce: Fix crashes on unreachable blocks for MIR instructions
Matt Arsenault [Sat, 4 Jun 2022 22:31:18 +0000 (18:31 -0400)]
llvm-reduce: Fix crashes on unreachable blocks for MIR instructions

2 years agollvm-reduce: Don't assert on functions which don't track liveness
Matt Arsenault [Wed, 13 Apr 2022 21:26:42 +0000 (17:26 -0400)]
llvm-reduce: Don't assert on functions which don't track liveness

Use the query that doesn't assert if TracksLiveness isn't set, which
needs to always be available. We also need to start printing liveins
regardless of TracksLiveness.

2 years agoAMDGPU: Fix not checking liveness in test
Matt Arsenault [Mon, 6 Jun 2022 22:27:11 +0000 (18:27 -0400)]
AMDGPU: Fix not checking liveness in test

2 years ago[Alignment][NFC] Remove usage of MemSDNode::getAlignment
Guillaume Chatelet [Fri, 3 Jun 2022 16:37:45 +0000 (16:37 +0000)]
[Alignment][NFC] Remove usage of MemSDNode::getAlignment

I can't remove the function just yet as it is used in the generated .inc files.
I would also like to provide a way to compare alignment with TypeSize since it came up a few times.

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

2 years ago[X86] getFauxShuffleMask - add VSELECT/BLENDV handling
Simon Pilgrim [Tue, 7 Jun 2022 13:27:06 +0000 (14:27 +0100)]
[X86] getFauxShuffleMask - add VSELECT/BLENDV handling

First step towards enabling shuffle combining starting from VSELECT/BLENDV nodes - this should eventually help improve the codegen reported at Issue #54819

2 years ago[X86] x86-interleaved-access.ll - use nounwind to remove cfi noise from tests
Simon Pilgrim [Tue, 7 Jun 2022 13:17:23 +0000 (14:17 +0100)]
[X86] x86-interleaved-access.ll - use nounwind to remove cfi noise from tests

2 years ago[clang-cl] Add support for /kernel
Pengxuan Zheng [Tue, 7 Jun 2022 13:42:22 +0000 (06:42 -0700)]
[clang-cl] Add support for /kernel

MSVC defines _KERNEL_MODE when /kernel is passed.
Also, /kernel disables RTTI and C++ exception handling.

https://docs.microsoft.com/en-us/cpp/build/reference/kernel-create-kernel-mode-binary?view=msvc-170

Reviewed By: thakis

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

2 years ago[ARM] Fix MVE getShuffleCost legalized type check
David Green [Tue, 7 Jun 2022 13:36:04 +0000 (14:36 +0100)]
[ARM] Fix MVE getShuffleCost legalized type check

The MVE shuffle costing for VREV instructions was making incorrect
assumptions as to legalized vector types remaining as vectors. Add a
quick check to ensure they are indeed vectors before attempting to get
the number of elements.

2 years ago[AArch64] Regenerate arm64-shifted-sext.ll and add a test from #55833. NFC
David Green [Tue, 7 Jun 2022 12:55:53 +0000 (13:55 +0100)]
[AArch64] Regenerate arm64-shifted-sext.ll and add a test from #55833. NFC

2 years ago[X86] X86SpeculativeLoadHardening.cpp - pass DebugLoc by const reference not value.
Simon Pilgrim [Tue, 7 Jun 2022 11:38:05 +0000 (12:38 +0100)]
[X86] X86SpeculativeLoadHardening.cpp - pass DebugLoc by const reference not value.

2 years ago[X86] foldMaskedMergeImpl - pass SDLoc by const reference not value.
Simon Pilgrim [Tue, 7 Jun 2022 11:36:30 +0000 (12:36 +0100)]
[X86] foldMaskedMergeImpl - pass SDLoc by const reference not value.

2 years agoFix change of variable name in test
Guillaume Chatelet [Tue, 7 Jun 2022 11:20:44 +0000 (11:20 +0000)]
Fix change of variable name in test

2 years ago[DebugInfo][Docs] Improve code formatting in instruction referencing doc
J. Ryan Stinnett [Wed, 1 Jun 2022 10:04:46 +0000 (11:04 +0100)]
[DebugInfo][Docs] Improve code formatting in instruction referencing doc

This adds code blocks and inline code formatting to improve the readability of
the instruction referencing doc.

Reviewed By: Orlando

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

2 years ago[clang-tidy] Fix syntax error in release notes.
Martin Boehme [Tue, 7 Jun 2022 11:03:56 +0000 (13:03 +0200)]
[clang-tidy] Fix syntax error in release notes.

Introduced by
https://github.com/llvm/llvm-project/commit/1b664460fa4cb507e2af87c48cd269964f3ad747

Sorry for the breakage.

2 years ago[analyzer] Remove NotifyAssumeClients
Gabor Marton [Thu, 2 Jun 2022 13:05:45 +0000 (15:05 +0200)]
[analyzer] Remove NotifyAssumeClients

Depends on D126560.

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

2 years ago[clang-tidy] `bugprone-use-after-move`: Don't warn on self-moves.
Martin Boehme [Tue, 7 Jun 2022 09:00:24 +0000 (11:00 +0200)]
[clang-tidy] `bugprone-use-after-move`: Don't warn on self-moves.

Reviewed By: sammccall, njames93

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

2 years ago[analyzer][NFC] Add LLVM_UNLIKELY to assumeDualImpl
Gabor Marton [Tue, 7 Jun 2022 08:29:54 +0000 (10:29 +0200)]
[analyzer][NFC] Add LLVM_UNLIKELY to assumeDualImpl

Aligned with the measures we had in D124674, this condition seems to be
unlikely.

Nevertheless, I've made some new measurments with stats just for this,
and data confirms this is indeed unlikely.

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

2 years ago[clang] Remove some `U+C2AD`s in `__cpp_multidimensional_subscript`
Yuki Okushi [Sun, 5 Jun 2022 03:30:50 +0000 (12:30 +0900)]
[clang] Remove some `U+C2AD`s in `__cpp_multidimensional_subscript`

The `Builder.defineMacro("__cpp_multidimensional_subscript", "202110L");` line has
some `U+C2AD`s that shouldn't necessary here. So removed them.

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

2 years ago[NFC][InstCombine] Add two more tests to select-binop-foldable-floating-point.ll
David Sherwood [Tue, 7 Jun 2022 10:00:33 +0000 (11:00 +0100)]
[NFC][InstCombine] Add two more tests to select-binop-foldable-floating-point.ll

Pre-commit some tests as part of https://reviews.llvm.org/D126774

2 years ago[Flang] Add flag dependent code to execute the loop-body atleast once
Kiran Chandramohan [Tue, 7 Jun 2022 09:57:38 +0000 (09:57 +0000)]
[Flang] Add flag dependent code to execute the loop-body atleast once

Given the flag `--always-execute-loop-body` the compiler emits code
to execute the body of the loop atleast once.

Note: This is part of upstreaming from the fir-dev branch of
https://github.com/flang-compiler/f18-llvm-project.

Reviewed By: awarzynski, schweitz

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
Co-authored-by: Sameeran Joshi <sameeranjayant.joshi@amd.com>
2 years ago[clang-format][NFC] Clean up the unwrapped line parser
owenca [Fri, 3 Jun 2022 21:19:00 +0000 (14:19 -0700)]
[clang-format][NFC] Clean up the unwrapped line parser

Change the signatures of parseBlock(), parseLevel(), and
parseStructuralElement() to support combining else and if when
removing braces. See #55663.

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

2 years ago[X86] LowerGC_TRANSITION - remove redundant SDLoc().
Simon Pilgrim [Tue, 7 Jun 2022 09:50:21 +0000 (10:50 +0100)]
[X86] LowerGC_TRANSITION - remove redundant SDLoc().

2 years ago[Flang,MLIR,OpenMP] Fix a few tests that were not converting to LLVM
Kiran Chandramohan [Tue, 7 Jun 2022 09:44:20 +0000 (09:44 +0000)]
[Flang,MLIR,OpenMP] Fix a few tests that were not converting to LLVM

A few OpenMP tests were retaining the FIR operands even after running
the LLVM conversion pass. To fix these tests the legality checkes for
OpenMP conversion are made stricter to include operands and results.
The Flush, Single and Sections operations are added to conversions or
legality checks. The RegionLessOpConversion is appropriately renamed
to clarify that it works only for operations with Variable operands.
The operands of the flush operation are changed to match those of
Variable Operands.

Fix for an OpenMP issue mentioned in
https://github.com/llvm/llvm-project/issues/55210.

Reviewed By: shraiysh, peixin, awarzynski

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

2 years ago[mlir] fix documentation format in SCF
Alex Zinenko [Tue, 7 Jun 2022 09:51:24 +0000 (11:51 +0200)]
[mlir] fix documentation format in SCF

Four leading spaces are interpreted as a code block in markdown. Unless
used consistently in ODS op description, they cannot be stripped away by
the tablegen backend, which results in malformed markdown being
generated.

2 years agoCleanup sema checking for buitlin_memcpy_inline
Guillaume Chatelet [Tue, 7 Jun 2022 09:49:36 +0000 (09:49 +0000)]
Cleanup sema checking for buitlin_memcpy_inline

2 years ago[LoopVectorize] Add FastMathFlags to the select used for reductions with tail-folding
David Sherwood [Wed, 1 Jun 2022 13:01:37 +0000 (14:01 +0100)]
[LoopVectorize] Add FastMathFlags to the select used for reductions with tail-folding

Based on reviewer comments on https://reviews.llvm.org/D126692 I've
added FastMathFlags to the select instruction used when tail-folding
with reductions. These flags can then be used by InstCombine to
decide upon the most optimal floating point identity value for
fadd/fsub. Doing so unlocks further optimisations, such as folding
selects into masked loads.

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

2 years ago[mlir][spirv] Correctly deduce PhysicalStorageBuffer64 addressing model
Alexander Batashev [Tue, 7 Jun 2022 09:13:59 +0000 (12:13 +0300)]
[mlir][spirv] Correctly deduce PhysicalStorageBuffer64 addressing model

According to the SPIR-V specification[1], PhysicalStorageBuffer storage
class can only be used iff addressing model is PhysicalStorageBuffer64.

[1]: https://www.khronos.org/registry/SPIR-V/specs/unified1/SPIRV.html#_addressing_model

Reviewed By: antiagainst

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

2 years ago[APInt] Remove truncOrSelf, zextOrSelf and sextOrSelf
Jay Foad [Wed, 6 Oct 2021 11:14:55 +0000 (12:14 +0100)]
[APInt] Remove truncOrSelf, zextOrSelf and sextOrSelf

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

2 years ago[pseudo]Pull out the operator< test, NFC
Haojian Wu [Tue, 7 Jun 2022 08:51:45 +0000 (10:51 +0200)]
[pseudo]Pull out the operator< test, NFC

Fix the review comment in https://reviews.llvm.org/D125479.

2 years ago[pseudo] Fix the incorrect parameters-and-qualifiers rule.
Haojian Wu [Tue, 7 Jun 2022 08:44:30 +0000 (10:44 +0200)]
[pseudo] Fix the incorrect parameters-and-qualifiers rule.

The parenthese body should be parameter-declaration-clause, rather
than parameter-declaration-list.

Reviewed By: sammccall

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

2 years ago[LLDB] Avoid using -fno-builtin for building API tests
Muhammad Omair Javaid [Tue, 7 Jun 2022 08:09:13 +0000 (12:09 +0400)]
[LLDB] Avoid using -fno-builtin for building API tests

This patch removes use of -fno-builtin flag for building LLDB API
tests.

LLDB API tests are built using Makefile.rules where we were using
-fno-builtin flag to avoid gcc intrinsic optimization conflicting
with Android runtime in past.

Now that we no longer use gcc for building testsuite and compiling
LLDB API tests on AArch64/Windows require clang to optimize certain
calls like _setjmp to setjmpex as former is not implemented by
AArch64 windows runtime.

2 years ago[pseudo] Fix the type-parameter rule.
Haojian Wu [Fri, 3 Jun 2022 20:01:36 +0000 (22:01 +0200)]
[pseudo] Fix the type-parameter rule.

The IDENTIFIER should be optional.

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

2 years ago[pseudo] Handle the language predefined identifier __func__
Haojian Wu [Fri, 3 Jun 2022 19:47:11 +0000 (21:47 +0200)]
[pseudo] Handle the language predefined identifier __func__

The clang lexer lexes it as a dedicated token kind (rather than
identifier), we extend the grammar to handle it.

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

2 years ago[MLIR][LLVMIR] Add round intrinsic
lorenzo chelini [Thu, 2 Jun 2022 13:56:01 +0000 (15:56 +0200)]
[MLIR][LLVMIR] Add round intrinsic

Reviewed By: ftynse

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

2 years ago[pseudo] Fix noptr-abstract-declarator rule.
Haojian Wu [Fri, 3 Jun 2022 19:13:26 +0000 (21:13 +0200)]
[pseudo] Fix noptr-abstract-declarator rule.

The const-expression in the [] can be empty.

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

2 years ago[SCCP] Don't mark ranges from branch conditions as potentially undef
Nikita Popov [Mon, 30 May 2022 13:05:04 +0000 (15:05 +0200)]
[SCCP] Don't mark ranges from branch conditions as potentially undef

Now that transforms introducing branch on poison have been removed,
we can stop marking ranges that have been derived from branch
conditions as containing undef. The existing comment explains why
this is legal. I've checked that alive2 is happy with SCCP tests
after this change.

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

2 years ago[pseudo] Fix the member-specification grammar rule.
Haojian Wu [Fri, 3 Jun 2022 19:02:25 +0000 (21:02 +0200)]
[pseudo] Fix the member-specification grammar rule.

The grammar rule is not right, doesn't match the standard one.

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

2 years ago[flang][docs] Remove the out-dated note on Windows support
Andrzej Warzynski [Tue, 7 Jun 2022 08:09:26 +0000 (08:09 +0000)]
[flang][docs] Remove the out-dated note on Windows support

Building Flang on Windows *is supported*. It's been tested there for
quite a while now:
  * https://lab.llvm.org/buildbot/#/builders/172

Submitting this without a review as the current note in the readme file
is clearly incorrect.

2 years ago[DAGCombiner] Remove overzealous assertion when folding assert+trunc+assert (PR55846)
Nikita Popov [Fri, 3 Jun 2022 09:11:03 +0000 (11:11 +0200)]
[DAGCombiner] Remove overzealous assertion when folding assert+trunc+assert (PR55846)

These assert that there are no "useless" assertzext/assertsext nodes
(that assert a wider width than a following trunc), but I don't think
there is anything preventing such nodes from reaching this code.
I don't think the assertion is relevant for correctness of this
transform either -- if such an assert is present, then the other
one will always be to a smaller width, and we'll pick that one.
The assertion dates back to D37017.

Fixes https://github.com/llvm/llvm-project/issues/55846.

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

2 years ago[mlir][complex] Add complex.conj op
lewuathe [Tue, 7 Jun 2022 07:37:20 +0000 (09:37 +0200)]
[mlir][complex] Add complex.conj op

Add complex.conj op to calculate the complex conjugate which is widely used for the mathematical operation on the complex space.

Reviewed By: pifon2a

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

2 years ago[MC] De-capitalize MCStreamer functions
Fangrui Song [Tue, 7 Jun 2022 07:31:02 +0000 (00:31 -0700)]
[MC] De-capitalize MCStreamer functions

Follow-up to c031378ce01b8485ba0ef486654bc9393c4ac024 .
The class is mostly consistent now.

2 years ago[flang][OpenMP] Support lowering parse-tree to MLIR for threadprivate directive
Peixin-Qiao [Tue, 7 Jun 2022 07:08:17 +0000 (15:08 +0800)]
[flang][OpenMP] Support lowering parse-tree to MLIR for threadprivate directive

This supports lowering parse-tree to MLIR for threadprivate directive
following the OpenMP 5.1 [2.21.2] standard. Take the following as an
example:

```
program m
  integer, save :: i
  !$omp threadprivate(i)
  call sub(i)
  !$omp parallel
    call sub(i)
  !$omp end parallel
end
```
```
func.func @_QQmain() {
  %0 = fir.address_of(@_QFEi) : !fir.ref<i32>
  %1 = omp.threadprivate %0 : !fir.ref<i32> -> !fir.ref<i32>
  fir.call @_QPsub(%1) : (!fir.ref<i32>) -> ()
  omp.parallel   {
    %2 = omp.threadprivate %0 : !fir.ref<i32> -> !fir.ref<i32>
    fir.call @_QPsub(%2) : (!fir.ref<i32>) -> ()
    omp.terminator
  }
  return
}
```

A threadprivate operation (omp.threadprivate) is created for all
references to a threadprivate variable. The runtime will appropriately
return a threadprivate var (%1 as above) or its copy (%2 as above)
depending on whether it is outside or inside a parallel region. For
threadprivate access outside the parallel region, the threadprivate
operation is created in instantiateVar. Inside the parallel region, it
is created in createBodyOfOp.

One new utility function collectSymbolSet is created for collecting
all the variables with a property within a evaluation, which may be one
Fortran, or OpenMP, or OpenACC construct.

Reviewed By: kiranchandramohan

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

2 years ago[flang] Fix XArrayCoorOp conversion for index type slices
Peixin-Qiao [Tue, 7 Jun 2022 06:58:44 +0000 (14:58 +0800)]
[flang] Fix XArrayCoorOp conversion for index type slices

The previous XArrayCoorOp conversion forgot to change getting the
operands from OpAdaptor for upper bound and step of slice. This leads to
the fail of incompatible of types of codegen when slices are index type.

Reviewed By: kiranchandramohan, schweitz

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

2 years ago[flang] Fix semantic checks for C919
Peixin-Qiao [Tue, 7 Jun 2022 06:55:31 +0000 (14:55 +0800)]
[flang] Fix semantic checks for C919

The previous semantic analysis does not consider when the last part-ref
is scalar or complex part. Refactor the previous code and bring all the
checks into one place. The check starts from the designator by
extracting the dataref wrapped including the substring and complex part
and recursively check the base objects.

Co-authored-by: Peter Klausler <pklausler@nvidia.com>
Reviewed By: klausler

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

2 years agoReplace Goals and Why section with Introduction
Jeff Bailey [Tue, 7 Jun 2022 06:52:02 +0000 (06:52 +0000)]
Replace Goals and Why section with Introduction

Rewrite the introduction of the page to state clearly the goals of
LLVM's libc project.

Reviewed By: sivachandra

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

2 years ago[MLIR][SCF] Fix top-level comment (NFC)
lorenzo chelini [Sat, 4 Jun 2022 16:30:03 +0000 (18:30 +0200)]
[MLIR][SCF] Fix top-level comment (NFC)

2 years ago[analyzer] Track assume call stack to detect fixpoint
Gabor Marton [Fri, 27 May 2022 18:44:43 +0000 (20:44 +0200)]
[analyzer] Track assume call stack to detect fixpoint

Assume functions might recurse (see `reAssume` or `tryRearrange`).
During the recursion, the State might not change anymore, that means we
reached a fixpoint. In this patch, we avoid infinite recursion of assume
calls by checking already visited States on the stack of assume function
calls. This patch renders the previous "workaround" solution (D47155)
unnecessary. Note that this is not an NFC patch. If we were to limit the
maximum stack depth of the assume calls to 1 then would it be equivalent
with the previous solution in D47155.

Additionally, in D113753, we simplify the symbols right at the beginning
of evalBinOpNN. So, a call to `simplifySVal` in `getKnownValue` (added
in D51252) is no longer needed.

Fixes https://github.com/llvm/llvm-project/issues/55851

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

2 years ago[MC][ARM] Reuse symbol value in constant pool
luxufan [Mon, 6 Jun 2022 13:35:33 +0000 (21:35 +0800)]
[MC][ARM] Reuse symbol value in constant pool

Fix https://github.com/llvm/llvm-project/issues/55816

Before this patch, MCConstantExpr were reused, but MCSymbolExpr were
not. To reuse symbol value, this patch added a DenseMap to record the
symbol value.

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

2 years ago[vscode-mlir] Bump to version 0.9
River Riddle [Tue, 7 Jun 2022 03:19:59 +0000 (20:19 -0700)]
[vscode-mlir] Bump to version 0.9

Since version 0.8 we've added:

* Switched PDLL and TableGen to use incremental doc updates
* Added support to PDLL for inlay hints

2 years ago[mlir:PDLL] Add support for inlay hints
River Riddle [Wed, 18 May 2022 00:56:17 +0000 (17:56 -0700)]
[mlir:PDLL] Add support for inlay hints

These allow for displaying additional inline information,
such as the types of variables, names operands/results,
constraint/rewrite arguments, etc. This requires a bump in the
vscode extension to a newer version, as inlay hints are a new LSP feature.

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

2 years ago[mlir:LSP] Switch document sync mode to Incremental
River Riddle [Tue, 17 May 2022 22:16:24 +0000 (15:16 -0700)]
[mlir:LSP] Switch document sync mode to Incremental

This is much more efficient over the full mode, as it only requires sending
smalls chunks of files. It also works around a weird command ordering
issue (full document updates are being sent after other commands like
code completion) in newer versions of vscode.

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

2 years ago[ASan] Skip any instruction inserted by another instrumentation.
Enna1 [Tue, 7 Jun 2022 03:15:12 +0000 (11:15 +0800)]
[ASan] Skip any instruction inserted by another instrumentation.

Currently, we only check !nosanitize metadata for instruction passed to function `getInterestingMemoryOperands()` or instruction which is a cannot return callable instruction.
This patch add this check to any instruction.

E.g. ASan shouldn't instrument the instruction inserted by UBSan/pointer-overflow.

Reviewed By: vitalybuka

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

2 years ago[clang] Allow consteval functions in default arguments
Evgeny Shulgin [Tue, 7 Jun 2022 02:51:59 +0000 (10:51 +0800)]
[clang] Allow consteval functions in default arguments

We should not mark a function as "referenced" if we call it within a
ConstantExpr, because the expression will be folded to a value in LLVM
IR. To prevent emitting consteval function declarations, we should not "jump
over" a ConstantExpr when it is a top-level ParmVarDecl's subexpression.

Fixes https://github.com/llvm/llvm-project/issues/48230

Reviewed By: erichkeane, aaron.ballman, ChuanqiXu

Differenitial Revision: https://reviews.llvm.org/D119646

2 years ago[NFC] Properly suppress unused argument warning in __isOSVersionAtLeast()
Arthur Eubanks [Tue, 7 Jun 2022 02:38:50 +0000 (19:38 -0700)]
[NFC] Properly suppress unused argument warning in __isOSVersionAtLeast()

Casting to non-void causes
  expression result unused [-Wunused-value]

2 years ago[NFC] Use predecessors to replace make_range.
jacquesguan [Mon, 6 Jun 2022 04:32:35 +0000 (04:32 +0000)]
[NFC] Use predecessors to replace make_range.

Reviewed By: rriddle

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

2 years ago[gmodules] Skip CXXDeductionGuideDecls when visiting FunctionDecls in
Akira Hatanaka [Tue, 17 May 2022 16:37:29 +0000 (09:37 -0700)]
[gmodules] Skip CXXDeductionGuideDecls when visiting FunctionDecls in
DebugTypeVisitor

This recommits d1346e2. I've added a line to the test case to enable it
only on assert builds.

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

2 years agoRevert "[gmodules] Skip CXXDeductionGuideDecls when visiting FunctionDecls in"
Akira Hatanaka [Tue, 7 Jun 2022 01:48:24 +0000 (18:48 -0700)]
Revert "[gmodules] Skip CXXDeductionGuideDecls when visiting FunctionDecls in"

This reverts commit d1346e2ee2741919a8cc1b1ffe400001e76a6d06.

The commit broke a few bots.

2 years ago[mlir] Add documentation for TableGen LSP features and setup
River Riddle [Tue, 7 Jun 2022 01:29:20 +0000 (18:29 -0700)]
[mlir] Add documentation for TableGen LSP features and setup

This commit beefs up the documentation for MLIR language servers by
adding proper documentations/examples/etc for the provided TableGen
language server capabilities. Given that this documentation is also used
for the vscode extension, this commit also updates the user facing vscode
extension documentation.

Note that the images referenced in the new documentation are hosted on
the website, and will be commited to mlir-www shortly after this commit
lands.

2 years ago[WebAssembly][NFC] RelaxedBinary tablegen multiclass for relaxed SIMD
Thomas Lively [Tue, 7 Jun 2022 00:56:39 +0000 (17:56 -0700)]
[WebAssembly][NFC] RelaxedBinary tablegen multiclass for relaxed SIMD

Refactor the tablegen definitions for relaxed SIMD min/max instructions to use a
shared RelaxedBinary multiclass modeled on the existing SIMDBinary multiclass. A
future commit will add further instruction definitions that use RelaxedBinary.

Also rename the SIMD_RELAXED_CONVERT multiclass to RelaxedConvert to better fit
existing naming conventions.

Reviewed By: aheejin

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

2 years ago[NFC] Fix spelling error M->L
Chris Bieneman [Tue, 7 Jun 2022 00:38:15 +0000 (19:38 -0500)]
[NFC] Fix spelling error M->L

Clearly I cannot spell...

2 years agoFix big endian build bots
Chris Bieneman [Tue, 7 Jun 2022 00:25:25 +0000 (19:25 -0500)]
Fix big endian build bots

Another case of reading a value from a struct that has been byte
swapped to write out. This should address the failure on the ppcbe bot.

2 years ago[Object][Archive] Support a new archive member /<ECSYMBOLS>/
Pengxuan Zheng [Sat, 4 Jun 2022 19:22:38 +0000 (12:22 -0700)]
[Object][Archive] Support a new archive member /<ECSYMBOLS>/

Some libraries (e.g., arm64rt.lib) from the Windows WDK (version 10.0.22000.0)
contain an undocumented special member '/<ECSYMBOLS>/'. This causes llvm-lib to
fail with the following error:

"truncated or malformed archive (long name offset characters after the '/' are
not all decimal numbers: '<ECSYMBOLS>/' for archive member header at offset 162)"

The '/<ECSYMBOLS>/' member does not seem to be documented anywhere, but might be
related to the ARM64EC ABI Microsoft announced last year.

https://blogs.windows.com/windowsdeveloper/2021/06/28/announcing-arm64ec-building-native-and-interoperable-apps-for-windows-11-on-arm/

Reviewed By: thieta, thakis

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

2 years ago[DX][ObjYAML] Support for parsing DXIL part
Chris Bieneman [Thu, 19 May 2022 18:13:56 +0000 (13:13 -0500)]
[DX][ObjYAML] Support for parsing DXIL part

This patch adds support for parsing the DXIL part data into the
ObjectYAML tooling.

The DXIL part has additional headers describing the shader and bitcode
data and stores serialized bitcode after the headers.

Depends on D124945

Reviewed By: kuhar

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

2 years ago[NFC] Remove trailing whitespace
Shilei Tian [Mon, 6 Jun 2022 22:59:13 +0000 (18:59 -0400)]
[NFC] Remove trailing whitespace

2 years agoFix typo in wasm objcopy's only-keep-debug.test
Derek Schuff [Mon, 6 Jun 2022 22:48:12 +0000 (15:48 -0700)]
Fix typo in wasm objcopy's only-keep-debug.test

Lefover from review for https://reviews.llvm.org/D126509#inline-1218795

2 years ago[Driver] add -lresolv for all but Android.
Kevin Athey [Mon, 6 Jun 2022 22:43:00 +0000 (15:43 -0700)]
[Driver] add -lresolv for all but Android.

As there 3 intercepts that depend on libresolv, link tests in ./configure scripts may be confuse by the presence of resolv symbols (i.e. dn_expand) even with -lresolv and get a runtime error.

Android provides the functionality in libc.

https://reviews.llvm.org/D122849
https://reviews.llvm.org/D126851

Reviewed By: eugenis, MaskRay

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

2 years ago[mlir][tosa] Moves constant folding operations out of the Canonicalizer
Georgios Pinitas [Mon, 6 Jun 2022 22:10:08 +0000 (22:10 +0000)]
[mlir][tosa] Moves constant folding operations out of the Canonicalizer

Transpose operations on constant data were getting folded during the
canonicalization process. This has compile time cost proportional to
the constant size. Moving this to a separate pass to enable optionality
and flexibility of how such scenarios can be handled.

Reviewed By: rsuderman, jpienaar, stellaraccident

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

2 years ago[mlir][vector] fix typo in vector unroll transform
Christopher Bate [Mon, 6 Jun 2022 22:08:23 +0000 (16:08 -0600)]
[mlir][vector] fix typo in vector unroll transform

2 years ago[clang] P2266: apply move elision rules on throw expr nested in function prototypes
Matheus Izvekov [Sun, 5 Jun 2022 19:50:00 +0000 (21:50 +0200)]
[clang] P2266: apply move elision rules on throw expr nested in function prototypes

Our rules to determine if the throw expression are within the variable
scope were giving a false negative result in case the throw expression
would appear within a decltype in a nested function declaration.

Per P2266R3, the relevant rule is: [expr.prim.id.unqual]/2
```
    if the id-expression (possibly parenthesized) is the operand of a throw-expression, and names an implicitly movable entity that belongs to a scope that does not contain the compound-statement of the innermost lambda-expression, try-block , or function-try-block (if any) whose compound-statement or ctor-initializer encloses the throw-expression.
```

This fixes PR54341.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Reviewed By: rsmith

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

2 years ago[mlir][bazel] fix bazel build on VectorTransforms
Mogball [Mon, 6 Jun 2022 21:51:11 +0000 (21:51 +0000)]
[mlir][bazel] fix bazel build on VectorTransforms

2 years ago[libc] Align the new thread stack as required by the target ABI.
Siva Chandra [Mon, 6 Jun 2022 21:44:35 +0000 (14:44 -0700)]
[libc] Align the new thread stack as required by the target ABI.

2 years agoRevert "[AMDGPU] gfx11 vop3dpp instructions"
Joe Nash [Mon, 6 Jun 2022 21:12:09 +0000 (17:12 -0400)]
Revert "[AMDGPU] gfx11 vop3dpp instructions"

This reverts commit 99a83b1286748501e0ccf199a582dc3ec5451ef5.

2 years agoRevert "[AMDGPU] gfx11 VOP1+VOP2 Instruction MC support"
Joe Nash [Mon, 6 Jun 2022 21:05:11 +0000 (17:05 -0400)]
Revert "[AMDGPU] gfx11 VOP1+VOP2 Instruction MC support"

This reverts commit 6079804498be497f52f97d1e3ef398d680b37f79.

2 years ago[RISCV] Add cost model test coverage of scalable reductions
Philip Reames [Mon, 6 Jun 2022 21:32:30 +0000 (14:32 -0700)]
[RISCV] Add cost model test coverage of scalable reductions

2 years ago[BasicTTI] Add missing scalable vector handling
Philip Reames [Mon, 6 Jun 2022 21:20:27 +0000 (14:20 -0700)]
[BasicTTI] Add missing scalable vector handling

BasicTTI needs to return an invalid cost for scalable vectors instead of crash.  Without this, it is impossible to write tests for missing functionality in a target.

2 years ago[WebAssembly] Remove restriction on main name mangling
Sam Clegg [Wed, 10 Jun 2020 22:48:35 +0000 (15:48 -0700)]
[WebAssembly] Remove restriction on main name mangling

Summary: Emscripten now handles/supports this new mode.

Subscribers: dschuff, jgravelle-google, aheejin, sunfish, cfe-commits

Tags: #clang

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

2 years ago[Objcopy][Wasm] Allow selecting known sections by name
Derek Schuff [Mon, 6 Jun 2022 20:40:43 +0000 (13:40 -0700)]
[Objcopy][Wasm] Allow selecting known sections by name

Currently, only custom sections can be selected by operations that use section
names, because only custom sections have explicit names (whereas known sections
have names defined by the spec and only use their indices in the binary format).
This CL makes objdopy use the spec-defined names for these sections, allowing
them to be used in operations such as dumping and removal.

This is a prerequisite for fixing
https://github.com/emscripten-core/emscripten/issues/13084

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

2 years ago[ARM] Use llvm::dbgs() to print debug info (NFC)
ksyx [Mon, 6 Jun 2022 20:39:28 +0000 (16:39 -0400)]
[ARM] Use llvm::dbgs() to print debug info (NFC)

For consistency with other parts of code.

Approved by efriedma in differential revision
https://reviews.llvm.org/D127055

2 years ago[gn build] Port b79b2b677256
LLVM GN Syncbot [Mon, 6 Jun 2022 20:32:38 +0000 (20:32 +0000)]
[gn build] Port b79b2b677256