platform/upstream/llvm.git
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

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

2 years ago[RISCV] Autogen a test for ease of update
Philip Reames [Mon, 6 Jun 2022 19:44:05 +0000 (12:44 -0700)]
[RISCV] Autogen a test for ease of update

2 years ago[docs] Fix style and typo in HowToSetUpLLVMStyleRTTI.rst after D126943
Fangrui Song [Mon, 6 Jun 2022 19:41:21 +0000 (12:41 -0700)]
[docs] Fix style and typo in HowToSetUpLLVMStyleRTTI.rst after D126943

2 years ago[mlir][linalg] add conv_2d_nhwc_fhwc named op
Christopher Bate [Fri, 3 Jun 2022 02:06:24 +0000 (20:06 -0600)]
[mlir][linalg] add conv_2d_nhwc_fhwc named op

This operation should be supported as a named op because
when the operands are viewed as having canonical layouts
with decreasing strides, then the "reduction" dimensions
of the filter (h, w, and c) are contiguous relative to each
output channel. When lowered to a matrix multiplication,
this layout is the simplest to deal with, and thus future
transforms/vectorizations of `conv2d` may find using this
named op convenient.

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

2 years ago[lld-macho] Demangle symbol names in duplicate-symbol error when -demangle is specified
Vy Nguyen [Fri, 3 Jun 2022 20:30:06 +0000 (16:30 -0400)]
[lld-macho] Demangle symbol names in duplicate-symbol error when -demangle is specified

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

2 years ago[BPF] Add BTF 64bit enum value support
Yonghong Song [Wed, 20 Apr 2022 22:07:08 +0000 (15:07 -0700)]
[BPF] Add BTF 64bit enum value support

Current BTF only supports 32-bit value. For example,
  enum T { VAL = 0xffffFFFF00000008 };
the generated BTF looks like
        .long   16                              # BTF_KIND_ENUM(id = 4)
        .long   100663297                       # 0x6000001
        .long   8
        .long   18
        .long   8
The encoded value is 8 which equals to (uint32_t)0xffffFFFF00000008
and this is incorrect.

This patch introduced BTF_KIND_ENUM64 which permits to encode
64-bit value. The format for each enumerator looks like:
        .long   name_offset
        .long   (uint32_t)value # lower-32 bit value
        .long   value >> 32     # high-32 bit value

We use two 32-bit values to represent a 64-bit value as current
BTF type subsection has 4-byte alignment and gaps are not permitted
in the subsection.

This patch also added support for kflag (the bit 31 of CommonType.Info)
such that kflag = 1 implies the value is signed and kflag = 0
implies the value is unsigned. The kernel UAPI enumerator definition is
  struct btf_enum {
        __u32   name_off;
        __s32   val;
  };
so kflag = 0 with unsigned value provides backward compatability.

With this patch, for
  enum T { VAL = 0xffffFFFF00000008 };
the generated BTF looks like
        .long   16                              # BTF_KIND_ENUM64(id = 4)
        .long   3187671053                      # 0x13000001
        .long   8
        .long   18
        .long   8                               # 0x8
        .long   4294967295                      # 0xffffffff
and the enumerator value and signedness are encoded correctly.

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

2 years ago[gn build] Port 352c395fb685
LLVM GN Syncbot [Mon, 6 Jun 2022 18:25:14 +0000 (18:25 +0000)]
[gn build] Port 352c395fb685

2 years ago[ObjectYAML][DX] Add dxcontainer2yaml support
Chris Bieneman [Tue, 3 May 2022 18:17:15 +0000 (13:17 -0500)]
[ObjectYAML][DX] Add dxcontainer2yaml support

This change finishes fleshing out the ObjectYAML tools to support
converting DXContainer files into yaml representations.

Depends on D124944

Reviewed By: lhames

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

2 years ago[GISel] Add new combines for G_ADD
Michael Kitzan [Wed, 18 May 2022 21:41:48 +0000 (14:41 -0700)]
[GISel] Add new combines for G_ADD

Patch adds new GICombineRules for G_ADD:

G_ADD(x, G_SUB(y, x)) -> y
G_ADD(G_SUB(y, x), x) -> y

Patch additionally adds new combine tests for AArch64 target for
these new rules.

Reviewed by: paquette

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

2 years ago[mlir][linalg] fix crash when promoting rank-reducing memref.subviews
Christopher Bate [Mon, 6 Jun 2022 04:54:11 +0000 (22:54 -0600)]
[mlir][linalg] fix crash when promoting rank-reducing memref.subviews

This change adds support for promoting `linalg` operation operands that
are produced by rank-reducing `memref.subview` ops.

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

2 years ago[libc++][NFC] Move span tests under views.span
Louis Dionne [Mon, 6 Jun 2022 18:02:41 +0000 (14:02 -0400)]
[libc++][NFC] Move span tests under views.span

2 years ago[libc++][NFC] Fix outdated comment in span test
Louis Dionne [Mon, 6 Jun 2022 18:02:05 +0000 (14:02 -0400)]
[libc++][NFC] Fix outdated comment in span test

2 years ago[libc] Fix cmake compatibility issue with list(POP_FRONT).
Tue Ly [Mon, 6 Jun 2022 17:30:13 +0000 (13:30 -0400)]
[libc] Fix cmake compatibility issue with list(POP_FRONT).

list(POP_FRONT) is only added to cmake in 3.15, while our base line
version is 3.13

Reviewed By: sivachandra

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

2 years ago[RISCV] Reorganize getShuffleCost to make it more clear what's going on [nfc]
Philip Reames [Mon, 6 Jun 2022 17:11:23 +0000 (10:11 -0700)]
[RISCV] Reorganize getShuffleCost to make it more clear what's going on [nfc]

2 years ago[SLP][NFC] Precommit test for followup patch that fixes vector phi poison input.
Vasileios Porpodas [Fri, 3 Jun 2022 02:01:57 +0000 (19:01 -0700)]
[SLP][NFC] Precommit test for followup patch that fixes vector phi poison input.

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

2 years ago[SelectionDAG] Further improve computeKnownBits for (smax X, C) where C is non-negative.
Craig Topper [Mon, 6 Jun 2022 16:45:52 +0000 (09:45 -0700)]
[SelectionDAG] Further improve computeKnownBits for (smax X, C) where C is non-negative.

Move the code that was added for D126896 after the normal recursive calls
to computeKnownBits. This allows us to calculate trailing zeros.
Previously we would break out of the switch before the recursive calls.

2 years ago[libc++][NFC] Add missing includes
Louis Dionne [Mon, 6 Jun 2022 16:57:42 +0000 (12:57 -0400)]
[libc++][NFC] Add missing includes

2 years ago[libc++] Avoid creating temporaries in unary expressions involving valarray
Louis Dionne [Thu, 5 May 2022 16:24:43 +0000 (12:24 -0400)]
[libc++] Avoid creating temporaries in unary expressions involving valarray

Currently, unary expressions involving valarray will create a temporary.
This leads to dangling references in expressions like `-a * b`, because
`-a` is a temporary and the resulting expression will refer to it. This
patch fixes the problem by creating a lazy expression to perform the unary
operation instead of eagerly creating a temporary valarray. This is
permitted by the Standard, which does not specify the exact type of
most expressions involving valarrays.

This is technically an ABI break, however I believe the actual potential
for breakage is very low.

rdar://90152242

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

2 years agoSupport converting pointers from opaque to typed
Chris Bieneman [Tue, 24 May 2022 16:56:12 +0000 (11:56 -0500)]
Support converting pointers from opaque to typed

Using the pointer type analysis we can re-constitute typed pointers and
populate the correct types in the bitcasts throughout the IR.

This doesn't yet handle all cases, but this should be illustrative as
to the dirction and feasability of
the solution.

Reviewed By: pete

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

2 years agoFix overflow bug impacting 32-bit testing
Chris Bieneman [Mon, 6 Jun 2022 16:16:16 +0000 (11:16 -0500)]
Fix overflow bug impacting 32-bit testing

This test was failing on 32-bit arm builders due to an interger
overflow. This changes the math to avoid overflow and should resolve
the test failure.

2 years ago[AMDGPU][GFX9+] Support base+soffset+offset s_atc_probe's.
Ivan Kosarev [Mon, 6 Jun 2022 15:46:22 +0000 (16:46 +0100)]
[AMDGPU][GFX9+] Support base+soffset+offset s_atc_probe's.

Resolves part of
https://github.com/llvm/llvm-project/issues/38652

Reviewed By: dp

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

2 years ago[InstCombine] add/move tests for opposite direction shifts; NFC
Sanjay Patel [Mon, 6 Jun 2022 15:13:17 +0000 (11:13 -0400)]
[InstCombine] add/move tests for opposite direction shifts; NFC

2 years ago[AMDGPU][GFX9][GFX10] Support base+soffset+offset s_dcache_discard's.
Ivan Kosarev [Mon, 6 Jun 2022 15:32:16 +0000 (16:32 +0100)]
[AMDGPU][GFX9][GFX10] Support base+soffset+offset s_dcache_discard's.

Resolves part of
https://github.com/llvm/llvm-project/issues/38652

Reviewed By: dp

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

2 years ago[AMDGPU][GFX8][DOC][NFC] Update assembler syntax description
Dmitry Preobrazhensky [Mon, 6 Jun 2022 13:08:16 +0000 (16:08 +0300)]
[AMDGPU][GFX8][DOC][NFC] Update assembler syntax description

Summary of changes:
- Updated MUBUF lds syntax (see https://reviews.llvm.org/D124485).
- Enabled literals with src0 for v_madak*, v_madmk* (see https://reviews.llvm.org/D111067).
- Minor bug fixing.

2 years agoDon't warn when 'llvm' isn't found
Alex Brachet [Mon, 6 Jun 2022 14:29:14 +0000 (14:29 +0000)]
Don't warn when 'llvm' isn't found

2 years ago[AMDGPU] gfx11 VOP1+VOP2 Instruction MC support
Joe Nash [Mon, 23 May 2022 14:26:02 +0000 (10:26 -0400)]
[AMDGPU] gfx11 VOP1+VOP2 Instruction MC support

Includes dpp instructions and vop1/vop2 promoted to vop3

Patch 17/N for upstreaming of AMDGPU gfx11 architecture

Depends on D126483

Reviewed By: rampitec, #amdgpu

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

2 years ago[AMDGPU] gfx11 vop3dpp instructions
Joe Nash [Wed, 18 May 2022 19:01:20 +0000 (15:01 -0400)]
[AMDGPU] gfx11 vop3dpp instructions

gfx11 adds the ability to use dpp modifiers on vop3 instructions.
This patch adds machine code layer support for that. The MCCodeEmitter
is changed to use APInt instead of uint64_t to support these wider
instructions.

Patch 16/N for upstreaming of AMDGPU gfx11 architecture

Depends on D126475

Reviewed By: rampitec, #amdgpu

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

2 years ago[libc++] Remove a bunch of conditionals on _LIBCPP_DEBUG_LEVEL
Louis Dionne [Fri, 3 Jun 2022 19:17:03 +0000 (15:17 -0400)]
[libc++] Remove a bunch of conditionals on _LIBCPP_DEBUG_LEVEL

Instead of providing two different constructors for iterators that
support the debug mode, provide a single constructor but leave the
container parameter unused when the debug mode is not enabled.

This allows simplifying all the call sites to unconditionally pass
the container, which removes a bunch of duplication in the container's
implementation.

Note that this patch does add some complexity to std::span, however
that is only because std::span has the ability to use raw pointers
as iterators instead of __wrap_iter. In retrospect, I believe it was
a mistake to provide that capability, and so it will be removed in a
future patch, along with the complexity added by this patch.

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

2 years ago[IPSCCP] Switch away from Instruction::isSafeToRemove()
Kevin P. Neal [Fri, 3 Jun 2022 18:28:02 +0000 (14:28 -0400)]
[IPSCCP] Switch away from Instruction::isSafeToRemove()

In D115737 I found that I needed to teach Instruction::isSafeToRemove()
about strictfp/constrained intrinsics. It was pointed out that this is
probably the wrong function to use isInstructionTriviallyDead(). It doesn't
make sense to have a "second, worse implementation".

I also believe that the Instruction class is the wrong place for this
functionality. The information about whether or not an instruction can be
removed is in the transform passes and should stay there.

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

2 years ago[flang][driver] Remove references to the `flang` bash script
Andrzej Warzynski [Mon, 6 Jun 2022 10:03:21 +0000 (10:03 +0000)]
[flang][driver] Remove references to the `flang` bash script

This is a follow-up of https://reviews.llvm.org/D125832
(see also https://reviews.llvm.org/D125788 for more context). It simply
removes any remaining references to the `flang` bash script. Note that
that `flang-to-external-fc` remains intact.

This felt worthwhile mentioning in the release notes, which have not
been updated since LLVM 12 (we are approaching LLVM 15 now). I took the
liberty of removing all of the out-dated content and added a note about
the renaming.

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

2 years ago[AMDGPU][GFX7][DOC][NFC] Update assembler syntax description
Dmitry Preobrazhensky [Mon, 6 Jun 2022 12:50:10 +0000 (15:50 +0300)]
[AMDGPU][GFX7][DOC][NFC] Update assembler syntax description

Summary of changes:
- Updated MUBUF lds syntax (see https://reviews.llvm.org/D124485).
- Enabled literals with src0 of v_madak_f32, v_madmk_f32 (see https://reviews.llvm.org/D111067).
- Corrected LGKM_CNT description.
- Minor bug fixing.

2 years agoFix a -Wlogical-op-parentheses warning; NFC
Aaron Ballman [Mon, 6 Jun 2022 11:51:24 +0000 (07:51 -0400)]
Fix a -Wlogical-op-parentheses warning; NFC

This should address bot failures like:
https://lab.llvm.org/buildbot/#/builders/77/builds/18317

2 years ago[gn build] Port 8171586176ee
LLVM GN Syncbot [Mon, 6 Jun 2022 11:33:45 +0000 (11:33 +0000)]
[gn build] Port 8171586176ee

2 years ago[libc++][ranges] Implement ranges::binary_search and ranges::{lower, upper}_bound
Nikolas Klauser [Sun, 5 Jun 2022 19:15:16 +0000 (21:15 +0200)]
[libc++][ranges] Implement ranges::binary_search and ranges::{lower, upper}_bound

Reviewed By: Mordante, var-const, ldionne, #libc

Spies: sstefan1, libcxx-commits, mgorny

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

2 years agoAllow use of an elaborated type specifier in a _Generic association in C++
Aaron Ballman [Mon, 6 Jun 2022 11:17:35 +0000 (07:17 -0400)]
Allow use of an elaborated type specifier in a _Generic association in C++

Currently, Clang accepts this code in C mode (where the tag is required
to be used) but rejects it in C++ mode thinking that the association is
defining a new type.

void foo(void) {
  struct S { int a; };
  _Generic(something, struct S : 1);
}
Clang thinks this in C++ because it sees struct S : when parsing the
class specifier and decides that must be a type definition (because the
colon signifies the presence of a base class type). This patch adds a
new declarator context to represent a _Generic association so that we
can distinguish these situations properly.

Fixes #55562

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

2 years ago[AArch64] Generate ADDP from shuffled add
David Green [Mon, 6 Jun 2022 10:39:51 +0000 (11:39 +0100)]
[AArch64] Generate ADDP from shuffled add

This adds a fold of add(x, shuffle(x, <1,0,3,2,5,4,...>), into
shuffle(addp(x), <0,0,1,1,2,2,..>. The ADDP instruction takes two
vectors and returns one, adding adjacent pairs. So we match x in a
custom combine as it is lowered from a v8i32. The original code
would be 2 rev64 and 2 add, with the new code being a single addp
with a zip1;zip2 shuffle, producing smaller code.

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

2 years agoFix "not all control paths return a value" MSVC warning. NFC.
Simon Pilgrim [Mon, 6 Jun 2022 10:31:46 +0000 (11:31 +0100)]
Fix "not all control paths return a value" MSVC warning. NFC.

2 years ago[gn build] port f06abbb39380 a bit (create main() functions for GENERATE_DRIVER targets)
Nico Weber [Mon, 6 Jun 2022 10:18:13 +0000 (06:18 -0400)]
[gn build] port f06abbb39380 a bit (create main() functions for GENERATE_DRIVER targets)

2 years ago[gn build] set LLVM_TOOL_LLVM_DRIVER_BUILD to 0 for now
Nico Weber [Mon, 6 Jun 2022 09:52:37 +0000 (05:52 -0400)]
[gn build] set LLVM_TOOL_LLVM_DRIVER_BUILD to 0 for now

2 years ago[flang][OpenMP] Added parser support for in_reduction clause
Nimish Mishra [Mon, 6 Jun 2022 14:47:32 +0000 (20:17 +0530)]
[flang][OpenMP] Added parser support for in_reduction clause

OpenMP 5.0 adds a new clause `in_reduction` on OpenMP directives.
This patch adds parser support for the same.

Reviewed By: kiranchandramohan

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

2 years ago[PowerPC] Support huge frame size for PPC64
Kai Luo [Mon, 6 Jun 2022 09:08:02 +0000 (09:08 +0000)]
[PowerPC] Support huge frame size for PPC64

Support allocation of huge stack frame(>2g) on PPC64.

For ELFv2 ABI on Linux, quoted from the spec 2.2.3.1 General Stack Frame Requirements
> There is no maximum stack frame size defined.

On AIX, XL allows such huge frame.

Reviewed By: #powerpc, nemanjai

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

2 years ago[VPlan] Replace BranchOnCount with BranchOnCond if TC <= UF * VF.
Florian Hahn [Mon, 6 Jun 2022 08:38:53 +0000 (09:38 +0100)]
[VPlan] Replace BranchOnCount with BranchOnCond if TC <= UF * VF.

Try to simplify BranchOnCount to `BranchOnCond true` if TC <= UF * VF.

This is an alternative to D121899 which simplifies the VPlan directly
instead of doing so late in code-gen.

The potential benefit of doing this in VPlan is that this may help
cost-modeling in the future. The reason this is done in prepareToExecute
at the moment is that a single plan may be used for multiple VFs/UFs.

There are further simplifications that can be applied as follow ups:

1. Replace inductions with constants
2. Replace vector region with regular block.

Fixes #55354.

Depends on D126679.

Reviewed By: Ayal

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

2 years agoRevert "[libcxx] Temporarily skip Arm configs"
David Spickett [Mon, 6 Jun 2022 08:25:51 +0000 (08:25 +0000)]
Revert "[libcxx] Temporarily skip Arm configs"

This reverts commit d4220af52723e76973723d3089c6fe2527fd704d.

Linaro bots are back online.

2 years ago[RISCV] Use check-prefixes to reduce check lines
Shao-Ce SUN [Fri, 3 Jun 2022 17:27:15 +0000 (01:27 +0800)]
[RISCV] Use check-prefixes to reduce check lines

Reviewed By: frasercrmck

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

2 years ago[NFC][RISCV][format] Blank line between functions, remove unnecessary semicolon.
yanming [Mon, 6 Jun 2022 07:32:12 +0000 (15:32 +0800)]
[NFC][RISCV][format] Blank line between functions, remove unnecessary semicolon.

2 years ago[Scalar] Use llvm::make_early_inc_range (NFC)
Kazu Hirata [Mon, 6 Jun 2022 06:53:18 +0000 (23:53 -0700)]
[Scalar] Use llvm::make_early_inc_range (NFC)

2 years ago[RISCV] Define risc-v's own register class to model FP Register.
yanming [Thu, 2 Jun 2022 04:52:50 +0000 (12:52 +0800)]
[RISCV] Define risc-v's own register class to model FP Register.

The default RegisterClass is not enough to model RISCV Register.
We define risc-v's own register class to model FP Register.
This helps to better estimate the register pressure in the loop-vectorize.

Reviewed By: kito-cheng

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

2 years ago[AST] Fix clang RecursiveASTVisitor for definition of XXXTemplateSpecializationDecl
Qingyuan Zheng [Mon, 6 Jun 2022 05:58:00 +0000 (01:58 -0400)]
[AST] Fix clang RecursiveASTVisitor for definition of XXXTemplateSpecializationDecl

Fixes https://github.com/clangd/clangd/issues/1132
where clangd's semantic highlighting is missing for symbols of a template
specialization definition. It turns out the visitor didn't traverse the
base classes of Class/Var##TemplateSpecializationDecl, i.e.
CXXRecordDecl/VarDecl. This patch adds them back as what is done in
DEF_TRAVERSE_TMPL_PART_SPEC_DECL.

Reviewed By: rsmith

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

2 years ago[PDB] Remove truncate* (NFC)
Kazu Hirata [Mon, 6 Jun 2022 06:33:50 +0000 (23:33 -0700)]
[PDB] Remove truncate* (NFC)

- truncateQuotedNameFront: The last use was removed on Jul 10, 2017 in
  commit a9d944fd6fd19ac377b5ebea9272676642b7ceaa.

- truncateQuotedNameBack: The last use was removed on Mar 26, 2018 in
  commit 7b84b678a993c8a8236868f65d1d4c2b3e29fb3d.

- truncateStringMiddle: The last use was removed on Mar 26, 2018 in
  commit 7b84b678a993c8a8236868f65d1d4c2b3e29fb3d.

- truncateStringBack: The last use is in truncateQuotedNameBack being
  removed above.

- truncateStringFront: The last use is in truncateQuotedNameFront
  being removed above.

2 years ago[NFC] [Coroutines] Add test for ambiguous allocation functions in
Chuanqi Xu [Mon, 6 Jun 2022 06:11:59 +0000 (14:11 +0800)]
[NFC] [Coroutines] Add test for ambiguous allocation functions in
promise_type

Address the post-commit comment in
https://reviews.llvm.org/D125517#inline-1217244

2 years agoLLVM Driver Multicall tool
Chris Bieneman [Mon, 6 Jun 2022 04:25:55 +0000 (04:25 +0000)]
LLVM Driver Multicall tool

This patch adds an llvm-driver multicall tool that can combine multiple
LLVM-based tools. The build infrastructure is enabled for a tool by
adding the GENERATE_DRIVER option to the add_llvm_executable CMake
call, and changing the tool's main function to a canonicalized
tool_name_main format (i.e. llvm_ar_main, clang_main, etc...).

As currently implemented llvm-driver contains dsymutil, llvm-ar,
llvm-cxxfilt, llvm-objcopy, and clang (if clang is included in the
build).

llvm-driver can be enabled from builds by setting
LLVM_TOOL_LLVM_DRIVER_BUILD=On.

There are several limitations in the current implementation, which can
be addressed in subsequent patches:

(1) the multicall binary cannot currently properly handle
multi-dispatch tools. This means symlinking llvm-ranlib to llvm-driver
will not properly result in llvm-ar's main being called.
(2) the multicall binary cannot be comprised of tools containing
conflicting cl::opt options as the global cl::opt option list cannot
contain duplicates.

These limitations can be addressed in subsequent patches.

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

2 years ago[BPF] Enable IAS in backend
Brad Smith [Mon, 6 Jun 2022 03:28:53 +0000 (23:28 -0400)]
[BPF] Enable IAS in backend

Reviewed By: MaskRay

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

2 years ago[CodeGen] Remove splitCanCauseEvictionChain and its helpers (NFC)
Kazu Hirata [Mon, 6 Jun 2022 03:22:47 +0000 (20:22 -0700)]
[CodeGen] Remove splitCanCauseEvictionChain and its helpers (NFC)

The last use was removed on Mar 7, 2022 in commit
294eca35a00f89dff474044ebd478a7f83ccc310.

2 years ago[mlir][NFC] Replace some llvm::find with llvm::is_contained.
jacquesguan [Mon, 6 Jun 2022 02:31:12 +0000 (02:31 +0000)]
[mlir][NFC] Replace some llvm::find with llvm::is_contained.

This patch replaces some llvm::find with llvm::is_contained, it should be more clear.

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

2 years ago[GlobalISel] Remove widenWithUnmerge (NFC)
Kazu Hirata [Mon, 6 Jun 2022 02:58:18 +0000 (19:58 -0700)]
[GlobalISel] Remove widenWithUnmerge (NFC)

The last use was removed on Dec 23, 2021 in commit
29f88b93fdbe3e20c35842ca3a6c2a3f1a81cfce.

2 years ago[GlobalISel] Remove valueIsSplit (NFC)
Kazu Hirata [Mon, 6 Jun 2022 02:51:02 +0000 (19:51 -0700)]
[GlobalISel] Remove valueIsSplit (NFC)

The last use was removed on Jun 27, 2019 in commit
8138996128cd17d78d9d3e6ef7b49987565cb310.

2 years ago[LegalizeTypes][VP] Add widen and split support for vp.fptrunc and vp.fpext
Lian Wang [Thu, 26 May 2022 02:50:42 +0000 (02:50 +0000)]
[LegalizeTypes][VP] Add widen and split support for vp.fptrunc and vp.fpext

Reviewed By: frasercrmck

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

2 years ago[InstCombine] Add more tests for shl+lshr transforms; NFC
chenglin.bi [Mon, 6 Jun 2022 02:15:48 +0000 (10:15 +0800)]
[InstCombine] Add more tests for shl+lshr transforms; NFC

2 years ago[InstCombine] Fix tests const value for shl+lshr transforms; NFC
chenglin.bi [Mon, 6 Jun 2022 02:08:56 +0000 (10:08 +0800)]
[InstCombine] Fix tests const value for shl+lshr transforms; NFC

2 years ago[InstCombine] Add more tests for shl+lshr transforms; NFC
chenglin.bi [Mon, 6 Jun 2022 01:59:41 +0000 (09:59 +0800)]
[InstCombine] Add more tests for shl+lshr transforms; NFC

2 years ago[Clang][FP16] Add 4 builtins for _Float16
Phoebe Wang [Mon, 6 Jun 2022 00:31:44 +0000 (08:31 +0800)]
[Clang][FP16] Add 4 builtins for _Float16

We are lacking builtins support for `_Float16`. In most cases, we can use other floating-type builtins and truncate them to `_Float16`.
But it's a problem to SNaN, e.g., https://gcc.godbolt.org/z/cqr5nG1jh
This patch adds `__builtin_nansf16` support as well as other 3 ones since they are usually used together.

Reviewed By: LuoYuanke

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

2 years ago[clang] Use llvm::is_contained (NFC)
Kazu Hirata [Mon, 6 Jun 2022 00:56:40 +0000 (17:56 -0700)]
[clang] Use llvm::is_contained (NFC)

2 years ago[InstCombine] fold mul with masked low bit operand to trunc+select
Sanjay Patel [Sun, 5 Jun 2022 21:55:09 +0000 (17:55 -0400)]
[InstCombine] fold mul with masked low bit operand to trunc+select

https://alive2.llvm.org/ce/z/o7rQ5q

This shows an extra instruction in some cases, but that is
caused by an existing canonicalization of trunc -> and+icmp.

Codegen should be better for any target where a multiply is
more costly than the most simple ALU op.

This ends up producing the requested x86 asm from issue #55618,
but it's not the same IR. We are missing a canonicalization
from the negate+mask pattern to the trunc+select created here.

2 years ago[ConstProp] add tests for APFloat truncate miscompile; NFC
Sanjay Patel [Fri, 3 Jun 2022 19:47:14 +0000 (15:47 -0400)]
[ConstProp] add tests for APFloat truncate miscompile; NFC

issue #55838

2 years ago[Driver][test] Remove unneeded -no-canonical-prefixes and -o %t.o
Fangrui Song [Sun, 5 Jun 2022 23:06:09 +0000 (16:06 -0700)]
[Driver][test] Remove unneeded -no-canonical-prefixes and -o %t.o

Similar to 980679981fbc311bc07f8cd23e3739fd56c22d2a

2 years ago[clang-format] Handle attributes for for/while loops
owenca [Sat, 4 Jun 2022 19:26:07 +0000 (12:26 -0700)]
[clang-format] Handle attributes for for/while loops

Fixes #55853.

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

2 years ago[MC] Change EndOfStatement "unexpected tokens in .xxx directive " to "expected newline"
Fangrui Song [Sun, 5 Jun 2022 22:11:01 +0000 (15:11 -0700)]
[MC] Change EndOfStatement "unexpected tokens in .xxx directive " to "expected newline"

2 years ago[ARM][MC] Change EndOfStatement "unexpected tokens in .xxx directive " to "expected...
Fangrui Song [Sun, 5 Jun 2022 21:53:59 +0000 (14:53 -0700)]
[ARM][MC] Change EndOfStatement "unexpected tokens in .xxx directive " to "expected newline"

The directive name is not useful because the next line replicates the error line
which includes the directive. The prevailing style uses "expected newline".

2 years ago[NFC] Make comment consistent with allow|ignore list renamings
Aditya Kumar [Sun, 5 Jun 2022 21:48:00 +0000 (14:48 -0700)]
[NFC] Make comment consistent with allow|ignore list renamings

Reviewed By: thakis
Differential Revision: https://reviews.llvm.org/D123640

2 years ago[AArch64][MC] Change "unexpected tokens in .xxx directive " to "expected newline"
Fangrui Song [Sun, 5 Jun 2022 21:32:31 +0000 (14:32 -0700)]
[AArch64][MC] Change "unexpected tokens in .xxx directive " to "expected newline"

The directive name is not useful because the next line replicates the error line
which includes the directive. The prevailing style uses "expected newline".

2 years agogn build: Fix build when not building the native target.
Peter Collingbourne [Sun, 5 Jun 2022 06:42:00 +0000 (23:42 -0700)]
gn build: Fix build when not building the native target.

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

2 years ago[bolt] Remove unneeded cl::ZeroOrMore for cl::opt options
Fangrui Song [Sun, 5 Jun 2022 20:29:49 +0000 (13:29 -0700)]
[bolt] Remove unneeded cl::ZeroOrMore for cl::opt options

2 years ago[libc++][test] Mark ranges.transform.pass.cpp UNSUPPORTED for AIX
Joe Loser [Sat, 4 Jun 2022 16:28:17 +0000 (10:28 -0600)]
[libc++][test] Mark ranges.transform.pass.cpp UNSUPPORTED for AIX

The `ranges.transform.pass.cpp` often times out on CI for AIX (32-bit and 64-bit)
only. Mark the test as `UNSUPPORTED` for `AIX` for now. It should be looked into in
the future.

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

2 years ago[mlir] Tunnel LLVM_USE_LINKER through to the standalone example build.
Stella Laurenzo [Sun, 5 Jun 2022 19:30:28 +0000 (12:30 -0700)]
[mlir] Tunnel LLVM_USE_LINKER through to the standalone example build.

When building in debug mode, the link time of the standalone sample is excessive, taking upwards of a minute if using BFD. This at least allows lld to be used if the main invocation was configured that way. On my machine, this gets a standalone test that requires a relink to run in ~13s for Debug mode. This is still a lot, but better than it was. I think we may want to do something about this test: it adds a lot of latency to a normal compile/test cycle and requires a bunch of arg fiddling to exclude.

I think we may end up wanting a `check-mlir-heavy` target that can be used just prior to submit, and then make `check-mlir` just run unit/lite tests. More just thoughts for the future (none of that is done here).

Reviewed By: bondhugula, mehdi_amini

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

2 years ago[llvm] Convert for_each to range-based for loops (NFC)
Kazu Hirata [Sun, 5 Jun 2022 19:07:14 +0000 (12:07 -0700)]
[llvm] Convert for_each to range-based for loops (NFC)

2 years ago[Sparc] Fix a warning
Kazu Hirata [Sun, 5 Jun 2022 18:49:13 +0000 (11:49 -0700)]
[Sparc] Fix a warning

This patch fixes:

  llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp:910:5: error:
  default label in switch which covers all enumeration values
  [-Werror,-Wcovered-switch-default]

2 years ago[NFC] Add test cases reported in PR54341
Matheus Izvekov [Sun, 5 Jun 2022 17:00:57 +0000 (19:00 +0200)]
[NFC] Add test cases reported in PR54341

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Differential Revision: https://reviews.llvm.org/D127074

2 years ago[Debuginfo][DWARF][NFC] Refactor DwarfStringPoolEntryRef - remove isIndexed().
Alexey Lapshin [Fri, 3 Jun 2022 11:11:43 +0000 (14:11 +0300)]
[Debuginfo][DWARF][NFC] Refactor DwarfStringPoolEntryRef - remove isIndexed().

This patch is extraction from the https://reviews.llvm.org/D126883.
It removes DwarfStringPoolEntryRef::isIndexed() and isIndexed bit
since they are not used.

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

2 years ago[SPARC][MC] Support more relocation types
LemonBoy [Sun, 5 Jun 2022 18:06:50 +0000 (14:06 -0400)]
[SPARC][MC] Support more relocation types

This patch introduces support for %hix, %lox, %gdop_hix22, %gdop_lox10 and %gdop.

An extra test is introduced to make sure the fixups are correctly applied.

Reviewed By: dcederman

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

2 years ago[flang][runtime] Use __float128 where possible & needed in runtime
Peter Klausler [Tue, 31 May 2022 21:06:11 +0000 (14:06 -0700)]
[flang][runtime] Use __float128 where possible & needed in runtime

On targets with __float128 available and distinct from long double,
use it to support more kind=16 entry points.  This affects mostly
x86-64 targets.  This means that more runtime entry points are
defined for lowering to call.

Delete Common/long-double.h and its LONG_DOUBLE macro in favor of
testing the standard macro LDBL_MANT_DIG.

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

2 years ago[Scalar] Remove isValidSingle (NFC)
Kazu Hirata [Sun, 5 Jun 2022 15:45:11 +0000 (08:45 -0700)]
[Scalar] Remove isValidSingle (NFC)

The last use was removed on Feb 18, 2022 in commit
00ab91b70d21f72af59e4e198c6dc819452405af.

2 years ago[ADT] Add edit_distance_insensitive to StringRef
Nathan James [Sun, 5 Jun 2022 11:03:08 +0000 (12:03 +0100)]
[ADT] Add edit_distance_insensitive to StringRef

In some instances its advantageous to calculate edit distances without worrying about casing.
Currently to achieve this both strings need to be converted to the same case first, then edit distance can be calculated.

Reviewed By: dblaikie

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

2 years agoRemove unneeded cl::ZeroOrMore for cl::opt/cl::list options
Fangrui Song [Sun, 5 Jun 2022 08:07:50 +0000 (01:07 -0700)]
Remove unneeded cl::ZeroOrMore for cl::opt/cl::list options

2 years agoRemove unneeded cl::ZeroOrMore for cl::opt/cl::list options
Fangrui Song [Sun, 5 Jun 2022 07:31:44 +0000 (00:31 -0700)]
Remove unneeded cl::ZeroOrMore for cl::opt/cl::list options

2 years ago[Transforms/Utils] Use predecessors (NFC)
Kazu Hirata [Sun, 5 Jun 2022 07:16:14 +0000 (00:16 -0700)]
[Transforms/Utils] Use predecessors (NFC)

2 years agoRecommit: "[MLIR][NVVM] Replace fdiv on fp16 with promoted (fp32) multiplication...
Christian Sigg [Sat, 4 Jun 2022 10:33:42 +0000 (12:33 +0200)]
Recommit: "[MLIR][NVVM] Replace fdiv on fp16 with promoted (fp32) multiplication with reciprocal plus one (conditional) Newton iteration."

This change rolls bcfc0a9051014437b55ab932d9aca5ecdca6776b forward (i.e., reverting 369ce54bb302f209239b8ebc77ad824add9df089) with fixed CMakeLists.txt.

2 years agoRemove unneeded cl::ZeroOrMore for cl::list options
Fangrui Song [Sun, 5 Jun 2022 06:51:12 +0000 (23:51 -0700)]
Remove unneeded cl::ZeroOrMore for cl::list options

2 years agoUse llvm::less_second (NFC)
Kazu Hirata [Sun, 5 Jun 2022 05:48:32 +0000 (22:48 -0700)]
Use llvm::less_second (NFC)

2 years ago[Target] Use MachineBasicBlock::erase (NFC)
Kazu Hirata [Sun, 5 Jun 2022 05:41:24 +0000 (22:41 -0700)]
[Target] Use MachineBasicBlock::erase (NFC)

2 years ago[CodeGen] Use a range-based for loop (NFC)
Kazu Hirata [Sun, 5 Jun 2022 05:26:55 +0000 (22:26 -0700)]
[CodeGen] Use a range-based for loop (NFC)

2 years agoUse static_cast from SmallString to std::string (NFC)
Kazu Hirata [Sun, 5 Jun 2022 05:09:27 +0000 (22:09 -0700)]
Use static_cast from SmallString to std::string (NFC)

2 years agoUse llvm::less_first (NFC)
Kazu Hirata [Sun, 5 Jun 2022 04:23:18 +0000 (21:23 -0700)]
Use llvm::less_first (NFC)

2 years ago[CodeGen] Use StringRef::contains (NFC)
Kazu Hirata [Sun, 5 Jun 2022 03:58:58 +0000 (20:58 -0700)]
[CodeGen] Use StringRef::contains (NFC)

2 years ago[Transforms] Use llvm::is_contained (NFC)
Kazu Hirata [Sun, 5 Jun 2022 03:48:26 +0000 (20:48 -0700)]
[Transforms] Use llvm::is_contained (NFC)

2 years ago[SPARC] Fix type for i64 inline asm operands
LemonBoy [Sat, 4 Jun 2022 22:26:33 +0000 (18:26 -0400)]
[SPARC] Fix type for i64 inline asm operands

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

2 years ago[VPlan] Update vector latch terminator edge to exit block after execution.
Florian Hahn [Sat, 4 Jun 2022 20:22:32 +0000 (21:22 +0100)]
[VPlan] Update vector latch terminator edge to exit block after execution.

Instead of setting the successor to the exit using CFG.ExitBB, set it to
nullptr initially. The successor to the exit block is later set either
through createEmptyBasicBlock or after VPlan execution (because at the
moment, no block is created by VPlan for the exit block, the existing
one is reused).

This also enables BranchOnCond to be used as terminator for the exiting
block of the topmost vector region.

Depends on D126618.

Reviewed By: Ayal

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

2 years ago[mlir] Use context provided rather than getContext
Jacques Pienaar [Sat, 4 Jun 2022 19:18:51 +0000 (12:18 -0700)]
[mlir] Use context provided rather than getContext

Avoids "pass state was never initialized" assertion failure.

2 years ago[flang][runtime] Catch OPEN of connected file
Peter Klausler [Fri, 3 Jun 2022 20:44:13 +0000 (13:44 -0700)]
[flang][runtime] Catch OPEN of connected file

Diagnose OPEN(FILE=f) when f is already connected by the same name to
a distinct external I/O unit.

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

2 years ago[flang][runtime] Emit error message rather than crashing for MOD(ULO)(x,P=0)
Peter Klausler [Thu, 2 Jun 2022 21:06:57 +0000 (14:06 -0700)]
[flang][runtime] Emit error message rather than crashing for MOD(ULO)(x,P=0)

Add extra arguments and checks to the runtime support library so that
a call to the intrinsic functions MOD and MODULO with "denominator"
argument P of zero will cause a crash with a source location rather
than an uninformative floating-point error or integer division by
zero signal.

Additional work is required in lowering to (1) pass source file path and
source line number arguments and (2) actually call these runtime
library APIs instead of emitting inline code for MOD &/or MODULO.

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

2 years ago[flang][runtime] Fix deadlock in error recovery
Peter Klausler [Thu, 2 Jun 2022 20:33:10 +0000 (13:33 -0700)]
[flang][runtime] Fix deadlock in error recovery

When an external I/O statement is in a recoverable error
state before any data transfers take place (for example,
an unformatted transfer with ERR=/IOSTAT=/IOMSG= attempted on
a formatted unit), ensure that the unit's mutex is still
released at the end of the statement.

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