platform/upstream/llvm.git
18 months ago[DAG] Match select(icmp(x,y),sub(x,y),sub(y,x)) -> abd(x,y) patterns
Simon Pilgrim [Tue, 14 Mar 2023 15:10:24 +0000 (15:10 +0000)]
[DAG] Match select(icmp(x,y),sub(x,y),sub(y,x)) -> abd(x,y) patterns

Pulled out of PowerPC, and added ABDS support as well (hence the additional v4i32 PPC matches)

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

18 months agoFix false positive with unreachable C++ catch handlers
Aaron Ballman [Tue, 14 Mar 2023 15:07:14 +0000 (11:07 -0400)]
Fix false positive with unreachable C++ catch handlers

This addresses an issue found by WG21 and tracked by CWG2699 (which is
not yet publicly published). The basic problem is that Clang issues a
diagnostic about not being able to reach a handler, but that handler
*is* reached at runtime. Clang's diagnostic behavior was matching the
standard wording, and our runtime behavior was matching the standard's
intent.

This fixes the diagnostic so that it matches the runtime behavior more
closely, and reduces the number of false positives. This is the
direction of choice taken by Core for CWG2699 and it seems unlikely
that WG21 will change direction here.

Fixes https://github.com/llvm/llvm-project/issues/61177
Differential Revision: https://reviews.llvm.org/D145408

18 months ago[CodeGen] Use *{Set,Map}::contains (NFC)
Kazu Hirata [Tue, 14 Mar 2023 15:07:42 +0000 (08:07 -0700)]
[CodeGen] Use *{Set,Map}::contains (NFC)

18 months ago[mlir][vector] Clarify OOB semantics of remaining load/store ops
Jakub Kuderski [Tue, 14 Mar 2023 15:01:13 +0000 (11:01 -0400)]
[mlir][vector] Clarify OOB semantics of remaining load/store ops

This is a follow up for https://reviews.llvm.org/D145824 that clarifies
the out-of-bounds behavior for other masked load/store ops. It uses the
same wording and informal semantics syntax as `gather` and `scatter`.

Issue: https://github.com/llvm/llvm-project/issues/60905

Reviewed By: aartbik

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

18 months ago[flang] Handle parent component on the LHS of intrinsic assignment
Valentin Clement [Tue, 14 Mar 2023 15:01:36 +0000 (16:01 +0100)]
[flang] Handle parent component on the LHS of intrinsic assignment

When the LHS is referring to a parent component the box need to be
reboxed to the parent component type so the runtime can handle the
assignment correctly.

Reviewed By: PeteSteinfeld

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

18 months ago[OpenMP][libomptarget][NFC] Add documentation regarding NextGen plugins
Kevin Sala [Tue, 28 Feb 2023 16:20:21 +0000 (17:20 +0100)]
[OpenMP][libomptarget][NFC] Add documentation regarding NextGen plugins

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

18 months ago[mlir][vector] Add gather lowering patterns
Jakub Kuderski [Tue, 14 Mar 2023 14:48:13 +0000 (10:48 -0400)]
[mlir][vector] Add gather lowering patterns

This is for targets that do not support gather-like ops, e.g., SPIR-V.

Gather is expanded into lower-level vector ops with memory accesses
guarded with `scf.if`.

I also considered generating `vector.maskedload`s, but decided against
it to keep the `memref` and `tensor` codepath closer together. There's a
good chance that if a target doesn't support gather it does not support
masked loads either.

Issue: https://github.com/llvm/llvm-project/issues/60905

Reviewed By: ThomasRaoux

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

18 months agollvm/test/TableGen/intrinsic-pointer-to-any.td: Rework D125247.
NAKAMURA Takumi [Tue, 14 Mar 2023 13:25:31 +0000 (22:25 +0900)]
llvm/test/TableGen/intrinsic-pointer-to-any.td: Rework D125247.

It should've updated the number of `def i8 : ValueType<8, 3>;` to `5`,
since it renumbered ValueTypes.

FYI, the number 3 is `i2` and `IIT_I2(57)` was chosen in IntrinsicEmitter.

18 months ago[DAG] Fold (bitcast (logicop (bitcast x), (c))) -> (logicop x, (bitcast c)) iff the...
Simon Pilgrim [Tue, 14 Mar 2023 14:41:11 +0000 (14:41 +0000)]
[DAG] Fold (bitcast (logicop (bitcast x), (c))) -> (logicop x, (bitcast c)) iff the current logicop type is illegal

Try to remove extra bitcasts around logicops if we're dealing with illegal types

Fixes the regressions in D145939

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

18 months ago[X86] Fix typo in vXi64 ABDS/ABDU test cases
Simon Pilgrim [Tue, 14 Mar 2023 14:32:05 +0000 (14:32 +0000)]
[X86] Fix typo in vXi64 ABDS/ABDU test cases

The select operands were commuted preventing D144789 from folding

18 months ago[libc] Remove dummy archive and file from integration test
Joseph Huber [Tue, 14 Mar 2023 13:15:20 +0000 (08:15 -0500)]
[libc] Remove dummy archive and file from integration test

This doesn't seem to be used anymore after recent changes that removed
the `--sysroot` method for the integration tests.

Reviewed By: sivachandra, lntue

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

18 months ago[lldb] Fix -Wswitch in TypeSystemClang.cpp ('SveBoolx2' and 'SveBoolx4' not handled...
Jie Fu [Tue, 14 Mar 2023 14:24:37 +0000 (22:24 +0800)]
[lldb] Fix -Wswitch in TypeSystemClang.cpp ('SveBoolx2' and 'SveBoolx4' not handled in switch) (NFC)

/data/llvm-project/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp:4859:13: error: enumeration values 'SveBoolx2' and 'SveBoolx4' not handled in switch [-Werror,-Wswitch]
    switch (llvm::cast<clang::BuiltinType>(qual_type)->getKind()) {
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

18 months ago[PhaseOrdering] Add test for DAE/GlobalDCE interaction (NFC)
Nikita Popov [Tue, 14 Mar 2023 14:19:02 +0000 (15:19 +0100)]
[PhaseOrdering] Add test for DAE/GlobalDCE interaction (NFC)

18 months ago[libclang] No longer attempt to get a dependent bit-width
Collin Baker [Tue, 14 Mar 2023 13:57:44 +0000 (09:57 -0400)]
[libclang] No longer attempt to get a dependent bit-width

Handle template parameter-dependent bit field widths in libclang

In a class template, a bit field's width may depend on a template
parameter. In this case the width expression cannot be evaluated.

Previously clang_getFieldDeclBitWidth() would assert, or cause memory
unsafety and return an invalid result if assertions are disabled.

This adds a check for this case which returns an error code.

This work was largely taken from an earlier patch which was reverted
due to an accidental API duplication
(https://reviews.llvm.org/D130303).

Fixes: https://github.com/llvm/llvm-project/issues/56644
Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
Differential Revision: https://reviews.llvm.org/D146039

18 months ago[TTI] Treat AND/OR with widenable conditions as free of cost
Max Kazantsev [Tue, 14 Mar 2023 13:26:29 +0000 (20:26 +0700)]
[TTI] Treat AND/OR with widenable conditions as free of cost

Because widenable conditions with eventually lower into a constant, such instructions
as `and`, `or` etc. will also be optimized away. Treat them as free.

This is an important thing to have if we want that guards represented as experimental.guard
calls and in their explicit form (branch by `and` with widenable condition) have the same cost
for unroller and other passes like this.

Differential Revision: https://reviews.llvm.org/D146034
Reviewed By: nikic

18 months agoReland: [DAG/AMDGPU] Use UniformityAnalysis in DAGISel
pvanhout [Mon, 13 Mar 2023 10:33:15 +0000 (11:33 +0100)]
Reland: [DAG/AMDGPU] Use UniformityAnalysis in DAGISel

Switch DAGISel over to UniformityAnalysis, which was one of the last remaining users of the DivergenceAnalysis.
No explosions seen during internal testing so this looks like a smooth transition.

Reviewed By: sameerds

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

18 months ago[SLP]Fix PR61395: need to adjust vector factor after emitting shuffle
Alexey Bataev [Tue, 14 Mar 2023 12:29:01 +0000 (05:29 -0700)]
[SLP]Fix PR61395: need to adjust vector factor after emitting shuffle
operation for combined entries.

The vector factor after combining of the shuffle entries is defined by
the size of the mask, not by the vector factors  of the original
entries. So, need to adjust it to emit correct code.

18 months ago[libc] Correctly pass the compile options to the internal GPU compilation
Joseph Huber [Tue, 14 Mar 2023 13:18:22 +0000 (08:18 -0500)]
[libc] Correctly pass the compile options to the internal GPU compilation

Summary:
We use an internal option to create the GPU binary used for testing.
This wasn't getting the proper flags passed to it due to a missing
variable name.

18 months ago[NFC][OHOS] Temporarily switch off tests for windows
Pavel Kosov [Tue, 14 Mar 2023 13:14:47 +0000 (16:14 +0300)]
[NFC][OHOS] Temporarily switch off tests for windows

18 months ago[AMDGPU] Don't run `llc-pipeline.ll` when expensive_checks are enabled
pvanhout [Tue, 14 Mar 2023 12:49:29 +0000 (13:49 +0100)]
[AMDGPU] Don't run `llc-pipeline.ll` when expensive_checks are enabled

AMDGPU ISel can add extra passes when expensive checks are enabled. This means the pipeline can be reordered and the checks may fail.

Reviewed By: arsenm

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

18 months ago[reland][libc][NFC] Move memcmp implementations in subfolders
Guillaume Chatelet [Tue, 14 Mar 2023 12:46:21 +0000 (12:46 +0000)]
[reland][libc][NFC] Move memcmp implementations in subfolders

18 months agoRevert "[libc][NFC] Move memcmp implementations in subfolders"
Guillaume Chatelet [Tue, 14 Mar 2023 13:00:07 +0000 (13:00 +0000)]
Revert "[libc][NFC] Move memcmp implementations in subfolders"

this broke arm32 build bots
This reverts commit 7f20e2a8d2ba73a8b05742903f4ae42afec82bff.

18 months agoRevert "Fix include order in CXType.cpp"
Aaron Ballman [Tue, 14 Mar 2023 12:57:25 +0000 (08:57 -0400)]
Revert "Fix include order in CXType.cpp"

This reverts commit 4d55a0b512a17dfaa2461b8803d37b79f6c9691d.

The addition of clang_isBitFieldDecl is not needed because
clang_Cursor_isBitField already exists.

18 months ago[mlir][Bazel] Adjust build after aafb52d7c9226cd9925bd5135309bd02b6e3b59d
Adrian Kuegel [Tue, 14 Mar 2023 12:54:01 +0000 (13:54 +0100)]
[mlir][Bazel] Adjust build after aafb52d7c9226cd9925bd5135309bd02b6e3b59d

18 months ago[flang] Handle mismatches of procedure type args
Leandro Lupori [Fri, 3 Mar 2023 12:49:23 +0000 (12:49 +0000)]
[flang] Handle mismatches of procedure type args

Fortran allows type mismatch when passing actual arguments to
procedures and most cases were already being handled correctly by
Flang. However, conversion of data types to and from procedures and
conversion between procedures and char procedures were not always
handled properly. The missing cases were added and these
conversions are supported now.

Fixes #60550

Reviewed By: jeanPerier

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

18 months ago[clang][sema][NFC] Make a few functions const
Timm Bäder [Thu, 9 Mar 2023 17:55:25 +0000 (18:55 +0100)]
[clang][sema][NFC] Make a few functions const

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

18 months ago[mlir][Bazel] Adjust build after 0fa20ecafe0c3c7ffde413800eb4b1551b432273
Adrian Kuegel [Tue, 14 Mar 2023 12:45:53 +0000 (13:45 +0100)]
[mlir][Bazel] Adjust build after 0fa20ecafe0c3c7ffde413800eb4b1551b432273

18 months ago[libc][NFC] Move memcmp implementations in subfolders
Guillaume Chatelet [Tue, 14 Mar 2023 12:46:21 +0000 (12:46 +0000)]
[libc][NFC] Move memcmp implementations in subfolders

18 months ago[RISCV] Reject 'g' with explicit version in parseArchString
Alex Bradbury [Tue, 14 Mar 2023 12:46:13 +0000 (12:46 +0000)]
[RISCV] Reject 'g' with explicit version in parseArchString

There is no versioning scheme for the 'g' shorthand for imafd (or in
current ISA specs, imafd_zifencei_zicsr). As such, the only sensible
behaviour to me seems to be to reject a version for it.

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

18 months ago[clang][Sema] Avoid duplicate diagnostics for unreachable fallthrough attribute
Takuya Shimizu [Tue, 14 Mar 2023 12:43:35 +0000 (08:43 -0400)]
[clang][Sema] Avoid duplicate diagnostics for unreachable fallthrough attribute

This patch checks whether -Wunreachable-code-fallthrough is enabled
when clang encounters unreachable fallthrough attributes and, if so,
suppresses code will never be executed warning to avoid duplicate
warnings.

Fixes https://github.com/llvm/llvm-project/issues/60416
Differential Revision: https://reviews.llvm.org/D145842

18 months ago[RISCV] Return false from shouldFormOverflowOp when type is i8 and i16
LiaoChunyu [Tue, 14 Mar 2023 11:44:26 +0000 (19:44 +0800)]
[RISCV] Return false from shouldFormOverflowOp when type is i8 and i16

i8 and i16 are not using overflow.
Reduce the number of zero extension instructions.

To reduce the uncertainty of the unknown,
most of the checks of the virtual function are kept

Reviewed By: craig.topper

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

18 months ago[clangd] Drop stale macro and mark ranges
Kadir Cetinkaya [Tue, 14 Mar 2023 09:13:28 +0000 (10:13 +0100)]
[clangd] Drop stale macro and mark ranges

I'll follow up with patching of those ranges, this is to stop bleeding
mentioned in https://github.com/clangd/clangd/issues/1537.

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

18 months agoRemove an extra `//` in the IWYU pragma for gtest-matchers.h
Haojian Wu [Tue, 14 Mar 2023 08:37:18 +0000 (09:37 +0100)]
Remove an extra `//` in the IWYU pragma for gtest-matchers.h

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

18 months ago[Codegen][ARM][AArch64] Support symmetric operations on complex numbers
Nicholas Guy [Mon, 13 Mar 2023 14:46:30 +0000 (14:46 +0000)]
[Codegen][ARM][AArch64] Support symmetric operations on complex numbers

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

18 months agoCleanup of Complex Deinterleaving pass (NFCI)
Nicholas Guy [Mon, 13 Mar 2023 14:44:57 +0000 (14:44 +0000)]
Cleanup of Complex Deinterleaving pass (NFCI)

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

18 months ago[Tooling/Inclusion] Index more sub std namespace symbols.
Haojian Wu [Tue, 14 Mar 2023 08:34:39 +0000 (09:34 +0100)]
[Tooling/Inclusion] Index more sub std namespace symbols.

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

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

18 months ago[mlir][GPUTransforms] NFC - Refactor GPUTransforms.cpp in preparation for improvements.
Nicolas Vasilache [Mon, 13 Mar 2023 20:33:15 +0000 (13:33 -0700)]
[mlir][GPUTransforms] NFC - Refactor GPUTransforms.cpp in preparation for improvements.

Depends on: D145977

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

18 months ago[Support][MemBuffer] Prevent UB on empty StringRefs
Kadir Cetinkaya [Fri, 24 Feb 2023 08:36:07 +0000 (09:36 +0100)]
[Support][MemBuffer] Prevent UB on empty StringRefs

Empty StringRefs are usually identified by their length being zero, and
sometimes they'll have Data==nullptr (e.g. default constructed, or derived from
an operation like split/copy and result turned out to be empty).

If such StringRef objects are passed to llvm::MemoryBuffer::getMemBufferCopy,
it'll result in UB as neither src nor dst can be null, even if size is zero.

This patch prevents that UB by not issuing a copy whenever StringRef is empty.

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

18 months ago[X86] Fix encoding for ATOMIC_LOGIC_OP
Nabeel Omer [Mon, 13 Mar 2023 16:17:03 +0000 (16:17 +0000)]
[X86] Fix encoding for ATOMIC_LOGIC_OP

Fixes PR#61384.

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

18 months ago[X86] Add negative test for D145930
Nabeel Omer [Mon, 13 Mar 2023 16:08:42 +0000 (16:08 +0000)]
[X86] Add negative test for D145930

This patch adds a negative test for the issue discovered in D145930.

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

18 months ago[mlir][Transform] NFC - Various API cleanups and use RewriterBase in lieu of PatternR...
Nicolas Vasilache [Mon, 13 Mar 2023 19:35:14 +0000 (12:35 -0700)]
[mlir][Transform] NFC - Various API cleanups and use RewriterBase in lieu of PatternRewriter

Depends on: D145685

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

18 months ago[RISCV][test] Test case for regression when MachineOutliner and MachineCopyPropagatio...
Alex Bradbury [Tue, 14 Mar 2023 11:16:23 +0000 (11:16 +0000)]
[RISCV][test] Test case for regression when MachineOutliner and MachineCopyPropagation are both enabled

MachineCopyPropagation removes a register copy in the outlined function
as it doesn't see that it's live-out from the function.

18 months ago[mlir][Affine] Add helper functions to allow reordering affine.apply operands and...
Nicolas Vasilache [Mon, 13 Mar 2023 19:29:10 +0000 (12:29 -0700)]
[mlir][Affine] Add helper functions to allow reordering affine.apply operands and decompose the ops into smaller components

Care is taken to order operands from least hoistable to most hoistable and to process subexpressions in the same
order.

This allows exposing more oppportunities for licm, cse and strength reduction.

Such a step should typically be applied while we still have loops in the IR and just before lowering affine ops to arith.
This is because the affine.apply canonicalization currently tries to maximally compose chains of affine.apply operations
and could undo the effects of these decompositions.

Depends on: D145784

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

18 months agoReapply [LowerTypeTests] Avoid creation of select constant expression
Nikita Popov [Fri, 3 Mar 2023 15:22:41 +0000 (16:22 +0100)]
Reapply [LowerTypeTests] Avoid creation of select constant expression

Reapply with a fix for phi handling: For phis, we need to insert
into the incoming block, not above the phi. This is especially
tricky if there are multiple incoming values from the same
predecessor, because these must all use the same value.

-----

LowerTypeTests replaces weak declarations with an icmp+select
constant expressions. As this is not a relocatable expression,
it additionally promotes initializers using it to global ctors.

As part of https://discourse.llvm.org/t/rfc-remove-most-constant-expressions/63179,
I would like to remove the select constant expression, of which LTT
is now the last user. This is a bit tricky, because we now need to
replace a constant with an instruction, which might require
converting intermediate constant expression users to instructions as
well.

We do this using the convertUsersOfConstantsToInstructions() helper.
However, it needs to be slightly extended to also support expansion
of ConstantAggregates. These are important in this context, because
the promotion of initializers to global ctors will produce stores
of such aggregates.

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

18 months ago[RISCV][NFC] Share interleave mask checking logic
Luke Lau [Mon, 13 Mar 2023 18:12:12 +0000 (18:12 +0000)]
[RISCV][NFC] Share interleave mask checking logic

This adds two new methods to ShuffleVectorInst, isInterleave and
isInterleaveMask, so that the logic to check if a shuffle mask is an
interleave can be shared across the TTI, codegen and the interleaved
access pass.

Reviewed By: craig.topper

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

18 months agoRevert "[DAG/AMDGPU] Use UniformityAnalysis in DAGISel"
pvanhout [Tue, 14 Mar 2023 10:48:40 +0000 (11:48 +0100)]
Revert "[DAG/AMDGPU] Use UniformityAnalysis in DAGISel"

This reverts commit 0022b5803fd4f5a4e9fcf233267c0ffa1b88f763.

18 months ago[clang-format] Treat &/&& as reference when followed by requires clause
Emilia Dreamer [Tue, 14 Mar 2023 10:48:05 +0000 (12:48 +0200)]
[clang-format] Treat &/&& as reference when followed by requires clause

Previously, the token annotator would get confused and annotate a member
function's ref qualifier as a binary operator, if said function also had
a requires clause after it.

This patch accounts for that, treating requires clauses more similarly
to `noexcept`, which also comes after the ref qualifier.

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

Reviewed By: HazardyKnusperkeks, owenpan

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

18 months ago[mlir][DialectUtils] Cleanup IndexingUtils and provide more affine variants while...
Nicolas Vasilache [Mon, 13 Mar 2023 19:24:58 +0000 (12:24 -0700)]
[mlir][DialectUtils] Cleanup IndexingUtils and provide more affine variants while reusing implementations

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

18 months ago[NFC] Drop NDEBUG around MSSA verification
Max Kazantsev [Tue, 14 Mar 2023 10:16:54 +0000 (17:16 +0700)]
[NFC] Drop NDEBUG around MSSA verification

Proposed on review of https://reviews.llvm.org/D145894.

18 months ago[IndVars] Option verify-indvars is broken (and always has been), delete it
Max Kazantsev [Tue, 14 Mar 2023 10:13:59 +0000 (17:13 +0700)]
[IndVars] Option verify-indvars is broken (and always has been), delete it

This option is switched off by default, and it seems that it has never worked correctly.
What it basically does is: it remembers current BECount SCEV, and after all transforms
tries to validate some facts for it. However, between these two points this SCEV may
become invalid (e.g. because some SCEVUnknown it references may be deleted as dead
code). So basically it may work with broken pointers.

Besides, its implementation does strange things (e.g. forgetLoop) which are invasive and
may affect behavior in other parts of the system (specifically verification), concealing some
other problems. Another issue is that it may use SCEVCouldNotCompute object without
checking this.

The option is not used in any unit tests, and if switched on by default, the following tests
fail:
```
********************
Failed Tests (14):
  LLVM :: Transforms/IndVarSimplify/2005-06-15-InstMoveCrash.ll
  LLVM :: Transforms/IndVarSimplify/2007-06-06-DeleteDanglesPtr.ll
  LLVM :: Transforms/IndVarSimplify/2008-10-03-CouldNotCompute.ll
  LLVM :: Transforms/IndVarSimplify/2009-05-24-useafterfree.ll
  LLVM :: Transforms/IndVarSimplify/2011-10-27-lftrnull.ll
  LLVM :: Transforms/IndVarSimplify/ARM/code-size.ll
  LLVM :: Transforms/IndVarSimplify/X86/deterministic-scev-verify.ll
  LLVM :: Transforms/IndVarSimplify/X86/pr57187.ll
  LLVM :: Transforms/IndVarSimplify/X86/verify-scev.ll
  LLVM :: Transforms/IndVarSimplify/bbi-63564.ll
  LLVM :: Transforms/IndVarSimplify/invalidate-modified-lcssa-phi.ll
  LLVM :: Transforms/IndVarSimplify/loop-predication.ll
  LLVM :: Transforms/IndVarSimplify/post-inc-range.ll
  LLVM :: Transforms/IndVarSimplify/turn-to-invariant.ll

********************
Unexpectedly Passed Tests (1):
  LLVM :: Transforms/IndVarSimplify/pr55689.ll
```

None of these looks like real problems found by verification, these are
bugs in the verifying code itself (such as use of deleted SCEVs and
SCEVCouldNotCompute's).

I think it all gives enough justification for its removal.

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

Differential Revision: https://reviews.llvm.org/D145894
Reviewed By: nikic

18 months ago[StructurizeCFG] Correctly depend on UniformityAnalysis
pvanhout [Tue, 14 Mar 2023 10:25:22 +0000 (11:25 +0100)]
[StructurizeCFG] Correctly depend on UniformityAnalysis

Small oversight in https://reviews.llvm.org/D145688 - the pass' dependency was not updated to reflect the change to UA.

Also, change DivergenceAnalysis to UniformityAnalysis in a comment. That way, StructurizeCFG only refers to UA and not DA anymore.

18 months ago[DAG/AMDGPU] Use UniformityAnalysis in DAGISel
pvanhout [Mon, 13 Mar 2023 10:33:15 +0000 (11:33 +0100)]
[DAG/AMDGPU] Use UniformityAnalysis in DAGISel

Switch DAGISel over to UniformityAnalysis, which was one of the last remaining users of the DivergenceAnalysis.
No explosions seen during internal testing so this looks like a smooth transition.

Reviewed By: sameerds

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

18 months ago[AArch64] Add svboolx2_t and svboolx4_t tuple types
Matt Devereau [Tue, 7 Mar 2023 15:12:31 +0000 (15:12 +0000)]
[AArch64] Add svboolx2_t and svboolx4_t tuple types

https://reviews.llvm.org/D145505

18 months ago[TTI] Evaluate cost of experimental_widenable_condition as zero
Max Kazantsev [Tue, 14 Mar 2023 10:09:50 +0000 (17:09 +0700)]
[TTI] Evaluate cost of experimental_widenable_condition as zero

This intrinsic is not supposed to live through lowering, eventually it should turn
into `true` constant and be optimized away.

Differential Revision: https://reviews.llvm.org/D146027
Reviewed By: skatkov

18 months ago[SCEV] Rename ControlsExit -> ControlsOnlyExit (NFC)
Nikita Popov [Tue, 14 Mar 2023 10:04:54 +0000 (11:04 +0100)]
[SCEV] Rename ControlsExit -> ControlsOnlyExit (NFC)

As suggested in https://reviews.llvm.org/D145510#4192162.

18 months ago[SCEV] Fix finite loop non-strict predicate simplification (PR60944)
Nikita Popov [Tue, 7 Mar 2023 14:42:16 +0000 (15:42 +0100)]
[SCEV] Fix finite loop non-strict predicate simplification (PR60944)

There are a number of issues with the current code for converting
ule -> ult (etc) predicates for comparisons controlling finite loops:

* It sets nowrap flags, which may only hold for that particular
  comparison, not globally. (PR60944)
* It doesn't check that the RHS is invariant. (I'm not sure this
  can cause practical issues independently of the previous point.)
* It runs before simplifications that may be more profitable. (PR54191)

This patch moves the handling for this into computeExitLimitFromICmp(),
because it is somewhat tightly coupled with assumptions in that code,
and addresses the aforementioned issues.

Fixes https://github.com/llvm/llvm-project/issues/60944.
Fixes https://github.com/llvm/llvm-project/issues/54191.

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

18 months ago[InstCombine] Regenerate test checks (NFC)
Nikita Popov [Tue, 14 Mar 2023 09:42:01 +0000 (10:42 +0100)]
[InstCombine] Regenerate test checks (NFC)

18 months ago[SCEV] Clarify ControlsExit comment (NFC)
Nikita Popov [Tue, 14 Mar 2023 09:37:33 +0000 (10:37 +0100)]
[SCEV] Clarify ControlsExit comment (NFC)

ControlsExit implies a single exit branch.

18 months ago[Test] Add missing REQUIRES: asserts in test
Max Kazantsev [Tue, 14 Mar 2023 09:27:40 +0000 (16:27 +0700)]
[Test] Add missing REQUIRES: asserts in test

18 months ago[Assignment Tracking] getIntrinsicInstrCost: set dbg.assign cost to zero
OCHyams [Tue, 14 Mar 2023 09:17:06 +0000 (09:17 +0000)]
[Assignment Tracking] getIntrinsicInstrCost: set dbg.assign cost to zero

Reviewed By: jmorse

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

18 months ago[LLVM][OHOS] Clang toolchain and targets
Pavel Kosov [Tue, 14 Mar 2023 09:12:35 +0000 (12:12 +0300)]
[LLVM][OHOS] Clang toolchain and targets

Add a clang part of OpenHarmony target

Related LLVM part: D138202

~~~

Huawei RRI, OS Lab

Reviewed By: DavidSpickett

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

18 months ago[mlir] Move tosa.concat lowering from TosaToLinalg to TosaToTensor
Maya Amrami [Thu, 9 Mar 2023 15:30:54 +0000 (17:30 +0200)]
[mlir] Move tosa.concat lowering from TosaToLinalg to TosaToTensor

tosa.concat is lowered to tensor.insert_slice thus it should be in
TosaToTensor rather than in TosaToLinalg.

Reviewed By: rsuderman

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

18 months agoNFC Fix cost model checks in tests for debug intrinsics
OCHyams [Tue, 14 Mar 2023 08:17:19 +0000 (08:17 +0000)]
NFC Fix cost model checks in tests for debug intrinsics

These tests don't have a "Debug Info Version" module flag causing the debug
intrinsics to be dropped with a warning `warning: ignoring debug info with an
invalid version (0)`. The test passes because there are no CHECK lines for
these intrinsics. Fix the issue and auto-update the test checks.

Reviewed By: jryans

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

18 months ago[AMDGPU] Fix .amdhsa_shared_vgpr_count error checking for GFX11
Jay Foad [Mon, 13 Mar 2023 14:05:17 +0000 (14:05 +0000)]
[AMDGPU] Fix .amdhsa_shared_vgpr_count error checking for GFX11

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

18 months ago[Test] Add test showing difference in cost models for guards
Max Kazantsev [Tue, 14 Mar 2023 08:49:25 +0000 (15:49 +0700)]
[Test] Add test showing difference in cost models for guards

18 months ago[IR] Allow !range on vector of integer instructions
Nikita Popov [Mon, 13 Mar 2023 10:18:57 +0000 (11:18 +0100)]
[IR] Allow !range on vector of integer instructions

Inspired by https://reviews.llvm.org/D144467#4188310, this allows
!range on vector of integer instructions, with the usual
element-wise interpretation, which is already used by various
analysis APIs that support vectors.

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

18 months ago[IncludeCleaner][NFC] Dont rely on implicit conversion of StringRef
Kadir Cetinkaya [Tue, 14 Mar 2023 08:20:13 +0000 (09:20 +0100)]
[IncludeCleaner][NFC] Dont rely on implicit conversion of StringRef

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

18 months ago[bazel][libc] Add errno target to function_deps of tests.
Siva Chandra Reddy [Tue, 14 Mar 2023 07:23:07 +0000 (07:23 +0000)]
[bazel][libc] Add errno target to function_deps of tests.

Existing listings in normal deps have been removed.

Reviewed By: akuegel

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

18 months ago[Analysis] Use *{Set,Map}::contains (NFC)
Kazu Hirata [Tue, 14 Mar 2023 07:32:40 +0000 (00:32 -0700)]
[Analysis] Use *{Set,Map}::contains (NFC)

18 months ago[Transforms] Use *{Set,Map}::contains (NFC)
Kazu Hirata [Tue, 14 Mar 2023 07:24:30 +0000 (00:24 -0700)]
[Transforms] Use *{Set,Map}::contains (NFC)

18 months ago[clang] Store the template param list of an explicit variable template specialization
Nathan Ridge [Fri, 27 Jan 2023 07:17:20 +0000 (02:17 -0500)]
[clang] Store the template param list of an explicit variable template specialization

VarTemplateSpecializationDecl does not store a template param list,
so the "template<>" needs to be stored in the ExtInfo.

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

18 months ago[clangd] Fix a bug in TweakTest::decorate()
Nathan Ridge [Tue, 21 Feb 2023 08:22:59 +0000 (03:22 -0500)]
[clangd] Fix a bug in TweakTest::decorate()

The second argument to string::substr() is a count,
not an end position.

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

18 months ago[C++20] [Modules] Profile TemplateName by canonical decl
Chuanqi Xu [Tue, 14 Mar 2023 06:20:44 +0000 (14:20 +0800)]
[C++20] [Modules] Profile TemplateName by canonical decl

Close https://github.com/llvm/llvm-project/issues/61317

The root cause of the problem is that we profile TemplateName by the
non-canonical decls so that the compiler thought they are two different
types. But this is not true. We fixed the issue after we profile the
template name by using the same name.

18 months ago[libc] Enable more functions on riscv64.
Siva Chandra [Tue, 14 Mar 2023 05:47:00 +0000 (05:47 +0000)]
[libc] Enable more functions on riscv64.

The list of headers has also been updated. Some duplicated entrypoints
have been removed.

18 months ago[flang] Use llvm.zext when converting from i1 -> iXX
Valentin Clement [Tue, 14 Mar 2023 05:31:27 +0000 (06:31 +0100)]
[flang] Use llvm.zext when converting from i1 -> iXX

CodeGen used llvm.sext when converting fir.convert %0 : (i1) -> iXX
where iXX is any integer. This leads to wrong values when the initial
i1 is equal to 1.

Reviewed By: PeteSteinfeld

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

18 months ago[libc] Update cross-compilation instructions
Jeff Bailey [Tue, 14 Mar 2023 05:31:01 +0000 (05:31 +0000)]
[libc] Update cross-compilation instructions

 * Add various options so that it uses the build lld and compiler-rt
 * Add instructions on how to use the newly built libc
 * Remove trailing comments in code-block for cut and pastability

Reviewed By: sivachandra

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

18 months ago[Driver] Make -X default for baremetal riscv
Alex Brachet [Tue, 14 Mar 2023 05:17:54 +0000 (05:17 +0000)]
[Driver] Make -X default for baremetal riscv

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

18 months ago[libc] Make libc_errno point to internal errno for non-public builds.
Siva Chandra Reddy [Mon, 13 Mar 2023 22:05:03 +0000 (22:05 +0000)]
[libc] Make libc_errno point to internal errno for non-public builds.

The macro llvmlibc_errno has also been removed. This change completes
the switch to using a hermetic errno for unit tests.

Fixes #61037

Reviewed By: lntue

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

18 months ago[libc] Switch sys/stat implementations over to libc_errno.
Siva Chandra Reddy [Tue, 14 Mar 2023 01:12:11 +0000 (01:12 +0000)]
[libc] Switch sys/stat implementations over to libc_errno.

Reviewed By: lntue

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

18 months ago[clang-format] Recognize Verilog always blocks
sstwcw [Fri, 10 Mar 2023 15:12:13 +0000 (15:12 +0000)]
[clang-format] Recognize Verilog always blocks

The small `Coverage` test was added because we added the space rule
about 2 at signs along with the rule about only 1 of it. We have not
fully covered covergroup yet.

Reviewed By: MyDeveloperDay, owenpan

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

18 months ago[Docs] Added llvm-mc documentation
aabhinavg [Mon, 13 Mar 2023 06:22:00 +0000 (11:52 +0530)]
[Docs] Added llvm-mc documentation

Fix #61313

Reviewed By: lattner

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

18 months ago[PowerPC] remove side effect for some cases for saturate instructions
Chen Zheng [Tue, 7 Mar 2023 02:31:32 +0000 (21:31 -0500)]
[PowerPC] remove side effect for some cases for saturate instructions

Fixes #60684

Reviewed By: nemanjai

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

18 months agoadd testcases for D145353; NFC
Chen Zheng [Mon, 6 Mar 2023 05:28:39 +0000 (00:28 -0500)]
add testcases for D145353; NFC

18 months ago[libc][NFC] Switch nanosleep_test and getcwd_test to libc_errno.
Siva Chandra Reddy [Tue, 14 Mar 2023 01:25:47 +0000 (01:25 +0000)]
[libc][NFC] Switch nanosleep_test and getcwd_test to libc_errno.

18 months ago[libc] Switch termios implementations to libc_errno.
Siva Chandra Reddy [Tue, 14 Mar 2023 01:00:23 +0000 (01:00 +0000)]
[libc] Switch termios implementations to libc_errno.

18 months agoRevert "[LogicCombine 1/?] Implement a general way to simplify logical operations."
chenglin.bi [Tue, 14 Mar 2023 00:59:53 +0000 (08:59 +0800)]
Revert "[LogicCombine 1/?] Implement a general way to simplify logical operations."

This reverts commit 97dcbea63e11d566cff0cd3a758cf1114cf1f633.

18 months ago[ADT][NFCI] Do not use non-const lvalue-refs with enumerate in llvm/
Jakub Kuderski [Tue, 14 Mar 2023 00:48:38 +0000 (20:48 -0400)]
[ADT][NFCI] Do not use non-const lvalue-refs with enumerate in llvm/

Replace references to `enumerate` results with either const lvalue
rerences or structured bindings. I did not use structured bindings
everywhere as it wasn't clear to me it would improve readability.

This is in preparation to the switch to `zip` semantics which won't
support non-const lvalue reference to elements:
https://reviews.llvm.org/D144503.

Reviewed By: dblaikie

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

18 months ago[flang] Accept non-interoperable LOGICAL scalar dummy arguments
Peter Klausler [Mon, 13 Mar 2023 18:02:32 +0000 (11:02 -0700)]
[flang] Accept non-interoperable LOGICAL scalar dummy arguments

Some Fortran compilers allow kinds of LOGICAL other than C_BOOL
for the types of dummy arguments to interoperable (BIND(C))
procedures.  As any kind of LOGICAL can be converted to any
other without loss of information, this seems to be a useful
unambiguous extension that is attested in real codes; accept it
for scalars with a portability warning.

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

18 months ago[libc][NFC] Switch unistd.h tests to libc_errno.
Siva Chandra Reddy [Mon, 13 Mar 2023 23:44:03 +0000 (23:44 +0000)]
[libc][NFC] Switch unistd.h tests to libc_errno.

18 months agollvm-symbolizer: Don't crash when referencing an invalid CU in a dwp file twice
David Blaikie [Tue, 14 Mar 2023 00:49:32 +0000 (00:49 +0000)]
llvm-symbolizer: Don't crash when referencing an invalid CU in a dwp file twice

Previously we'd stash a null pointer in a sorted vector of CUs - the
next time around, we'd try to do a binary search in that vector (sorting
on a key inside the objects pointed to by the elements of the vector)
which would deref null if we'd stashed a null in there previously.

As a reasonable, but not ideal, workaround - don't stash any result in
the vector - this means every query will produce a new warning
(resulting in duplicate warnings) but better than a crash.

Stashing null in the list could be workable if we also stashed the
offset in a pair - but then all the clients would need to be fixed up
(maybe using a filtering iterator) which seems like overkill for this
uncommon error case.

18 months ago[-Wunsafe-buffer-usage] Reducing non-determinism in diagnostics output stream
ziqingluo-90 [Tue, 14 Mar 2023 00:17:30 +0000 (17:17 -0700)]
[-Wunsafe-buffer-usage] Reducing non-determinism in diagnostics output stream

The -Wunsafe-buffer-usage analysis outputs diagnostics in the order of
pointer values to associated `VarDecl`s. This creates non-determinism
in the order of diagnostics in output since the order cannot be
guaranteed in pointer values. However, our fix-it tests were written
under the assumption that diagnostics are output in source location
order.  This results in non-deterministic failures in our tests.  This
patch fixes the problem by keeping analysis results sorted by source
locations.

Reviewed by: jkorous, NoQ

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

18 months ago[lldb] Remove MIPS Linux UnixSignals
Alex Langford [Tue, 14 Mar 2023 00:17:02 +0000 (17:17 -0700)]
[lldb] Remove MIPS Linux UnixSignals

MIPS Linux support was removed in ce03a862372a6f36d2fcf80dc80052aa155fcae8

18 months ago[libc][NFC] Switch sys/*.h tests over to libc_errno.
Siva Chandra Reddy [Mon, 13 Mar 2023 23:43:31 +0000 (23:43 +0000)]
[libc][NFC] Switch sys/*.h tests over to libc_errno.

18 months ago[IRLinker] Fix mapping of declaration metadata
Carl Ritson [Mon, 13 Mar 2023 23:42:22 +0000 (08:42 +0900)]
[IRLinker] Fix mapping of declaration metadata

Ensure metadata for declarations copied during materialization
is properly mapped if declarations do not become definitions.

Reviewed By: tejohnson

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

18 months agoSwitch ABI references to env/environment
Jacob Lambert [Sat, 11 Mar 2023 01:27:43 +0000 (17:27 -0800)]
Switch ABI references to env/environment

To be consistent with Triple.h, we update references to the
optional fourth triple field from ABI to env or enviornment

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

18 months ago[clang][deps] Handle response files in dep scanner
Ben Langmuir [Sat, 11 Mar 2023 05:21:09 +0000 (21:21 -0800)]
[clang][deps] Handle response files in dep scanner

Extract the code the driver uses to expand response files and reuse it
in the dependency scanner.

rdar://106155880

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

18 months ago[libc][NFC] Switch mman.h tests to libc_errno and update Bazel build.
Siva Chandra Reddy [Mon, 13 Mar 2023 22:46:19 +0000 (22:46 +0000)]
[libc][NFC] Switch mman.h tests to libc_errno and update Bazel build.

18 months ago[libc][NFC] Switch startup tests to libc_errno.
Siva Chandra Reddy [Mon, 13 Mar 2023 22:11:32 +0000 (22:11 +0000)]
[libc][NFC] Switch startup tests to libc_errno.

18 months ago[libc][NFC] Switch string and errno tests to libc_errno.
Siva Chandra Reddy [Mon, 13 Mar 2023 22:11:07 +0000 (22:11 +0000)]
[libc][NFC] Switch string and errno tests to libc_errno.

18 months ago[libc][NFC] Switch all uses of errno in math and math tests to libc_errno.
Siva Chandra Reddy [Mon, 13 Mar 2023 22:07:34 +0000 (22:07 +0000)]
[libc][NFC] Switch all uses of errno in math and math tests to libc_errno.