platform/upstream/llvm.git
2 years agoFold ashr-exact into a icmp-ugt.
Nadav Rotem [Fri, 14 Jan 2022 16:55:10 +0000 (08:55 -0800)]
Fold ashr-exact into a icmp-ugt.

This commit optimizes the code sequence:
  icmp-XXX (ashr-exact (X, C_1), C_2).

Instcombine already implements this optimization for sgt, and this
patch adds support to additional predicates. The transformation is legal
for all predicates if the 'exact' flag is set, and to SGE, UGE, SLT, ULT
when the exact flag is not present.

This pattern is found in the std::vector bounds checks code of the at()
method.

Alive2 proof:
https://alive2.llvm.org/ce/z/JT_WL8

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

2 years ago[clang-format] Fix short functions being considered as inline inside an indented...
Marek Kurdej [Fri, 14 Jan 2022 20:51:06 +0000 (21:51 +0100)]
[clang-format] Fix short functions being considered as inline inside an indented namespace.

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

With config:
```
AllowShortFunctionsOnASingleLine: Inline
NamespaceIndentation: All
```

The code:
```
namespace Test
{
    void f()
    {
        return;
    }
}
```
was incorrectly formatted to:
```
namespace Test
{
    void f() { return; }
}
```

since the function `f` was considered being inside a class/struct/record.
That's because the check was simplistic and only checked for a non-zero indentation level of the line starting `f`.

Reviewed By: MyDeveloperDay, HazardyKnusperkeks

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

2 years ago[SelectionDAGBuilder] Remove unneeded vector bitcast from visitTargetIntrinsic.
Craig Topper [Fri, 14 Jan 2022 20:03:16 +0000 (12:03 -0800)]
[SelectionDAGBuilder] Remove unneeded vector bitcast from visitTargetIntrinsic.

This seems to be a leftover from a long time ago when there was
an ISD::VBIT_CONVERT and a MVT::Vector. It looks like in those days
the vector type was carried in a VTSDNode.

As far as I know, these days ComputeValueTypes would have already
assigned "Result" the same type we're getting from TLI.getValueType
here. Thus the BITCAST is always a NOP. Verified by adding an assert
and running check-llvm.

Reviewed By: efriedma

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

2 years ago[libc++] [test] Add a test for proper _Uglification of template parameter names.
Arthur O'Dwyer [Mon, 10 Jan 2022 16:44:30 +0000 (11:44 -0500)]
[libc++] [test] Add a test for proper _Uglification of template parameter names.

Merge nasty_macros.h into the new test.

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

2 years ago[clang-format] Fix CompactNamespaces corner case when AllowShortLambdasOnASingleLine...
Marek Kurdej [Fri, 14 Jan 2022 20:42:09 +0000 (21:42 +0100)]
[clang-format] Fix CompactNamespaces corner case when AllowShortLambdasOnASingleLine/BraceWrapping.BeforeLambdaBody are set

In clang-format 12, `CompactNamespaces` misformatted the code when `AllowShortLambdasOnASingleLine` is set to false and `BraceWrapping.BeforeLambdaBody` is true.

Input:
```
namespace out {
namespace in {
}
} // namespace out::in
```

Expected output:
```
namespace out { namespace in {
}} // namespace out::in
```

Output from v12:
```
namespace out {
namespace in {
}
} // namespace out::in
```

Config triggering the issue:
```
---
AllowShortLambdasOnASingleLine: None
BraceWrapping:
  BeforeLambdaBody :    true
BreakBeforeBraces: Custom
CompactNamespaces: true
...
```

Seems there's a corner case when `AllowShortLambdasOnASingleLine` is false, and `BraceWrapping.BeforeLambdaBody` is true, that causes CompactNamespaces to stop working.
The cause was a misannotation of `{` opening brace after `namespace` as a lambda opening brace.
The regression was probably introduced with [this commit](https://github.com/llvm/llvm-project/commit/fa0118e6e588fe303b08e7e06ba28ac1f8d50c68).

Originally contributed by Ahmed Mahdy (@aybassiouny). Thank you!

Reviewed By: Wawha, HazardyKnusperkeks

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

2 years ago[libc++] Further small cleanups of move_iterator.h. NFC.
Arthur O'Dwyer [Fri, 14 Jan 2022 16:16:02 +0000 (11:16 -0500)]
[libc++] Further small cleanups of move_iterator.h. NFC.

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

2 years ago[libc++] s/_LIBCPP_INLINE_VISIBILITY/_LIBCPP_HIDE_FROM_ABI/g in move_iterator.h....
Arthur O'Dwyer [Fri, 14 Jan 2022 16:15:01 +0000 (11:15 -0500)]
[libc++] s/_LIBCPP_INLINE_VISIBILITY/_LIBCPP_HIDE_FROM_ABI/g in move_iterator.h. NFC.

2 years ago[libc++] Rename __i to __current_ in move_iterator. NFC.
Arthur O'Dwyer [Thu, 13 Jan 2022 21:11:12 +0000 (16:11 -0500)]
[libc++] Rename __i to __current_ in move_iterator. NFC.

2 years ago[BasicAliasAnalysis] Remove isMallocOrCallocLikeFn
Bryce Wilson [Thu, 13 Jan 2022 03:25:19 +0000 (19:25 -0800)]
[BasicAliasAnalysis] Remove isMallocOrCallocLikeFn

Allocation functions should be marked with onlyAccessesInaccessibleMemory (when that is correct for the given function) which is checked elsewhere so this check is no longer needed.

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

2 years ago[libc++] Add missing `<cstddef>` include in span test
Louis Dionne [Fri, 14 Jan 2022 20:05:25 +0000 (15:05 -0500)]
[libc++] Add missing `<cstddef>` include in span test

2 years ago[libcxx][test] Properly qualify uses of std::size_t
Casey Carter [Fri, 14 Jan 2022 19:41:18 +0000 (11:41 -0800)]
[libcxx][test] Properly qualify uses of std::size_t

To silence modular build error https://reviews.llvm.org/harbormaster/unit/view/1854595/

2 years ago[jitlink] add R_RISCV_BRANCH to jitlink
fourdim [Fri, 14 Jan 2022 19:35:50 +0000 (03:35 +0800)]
[jitlink] add R_RISCV_BRANCH to jitlink

This patch supported the R_RISCV_BRANCH relocation.

Reviewed By: lhames

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

2 years ago[InstrProf][NFC] Do not assume size of counter type
Ellis Hoag [Wed, 29 Dec 2021 21:36:28 +0000 (13:36 -0800)]
[InstrProf][NFC] Do not assume size of counter type

Existing code tended to assume that counters had type `uint64_t` and
computed size from the number of counters. Fix this code to directly
compute the counters size in number of bytes where possible. When the
number of counters is needed, use `__llvm_profile_counter_entry_size()`
or `getCounterTypeSize()`. In a later diff these functions will depend
on the profile mode.

Change the meaning of `DataSize` and `CountersSize` to make them more clear.
* `DataSize` (`CountersSize`) - the size of the data (counter) section in bytes.
* `NumData` (`NumCounters`) - the number of data (counter) entries.

Reviewed By: kyulee

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

2 years ago[JumpThreading] Change asserts for WantInteger into actual checks
Jessica Paquette [Fri, 2 Apr 2021 20:16:13 +0000 (13:16 -0700)]
[JumpThreading] Change asserts for WantInteger into actual checks

After e734e8286b4b521d829aaddb6d1cbbd264953625, it is possible to end up in
a situation where an `indirectbr` is fed by a cast, which is in turn fed by
an operation which only produces integers.

`indirectbr` expects a block address, however these operations can't produce
that.

There were several asserts in `computeValueKnownInPredecessorsImpl` which check
that we're not looking for a block address if we're walking through something
which can never produce one.

Since it's now possible to hit these asserts, this changes them into actual
checks which return false if `Preference` is not `WantInteger`.

This adds a testcase which verifies that we don't crash anymore in these
situations.

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

2 years ago[OpenMP] Fix problems with the declare variant append_args clause
Mike Rice [Wed, 12 Jan 2022 23:34:37 +0000 (15:34 -0800)]
[OpenMP] Fix problems with the declare variant append_args clause

Use ASTContext::getTypeDeclType() to get type of omp_interop_t since
TypeDecl::getTypeForDecl() may return null if TypeForDecl is not
setup yet.

Handle functions where the function type is under an AttributedType.

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

2 years ago[flang] "CFI" types for Fortran REAL and COMPLEX kinds 2, 3, 10, 16
V Donaldson [Fri, 14 Jan 2022 18:06:56 +0000 (10:06 -0800)]
[flang] "CFI" types for Fortran REAL and COMPLEX kinds 2, 3, 10, 16

Add additional "CFI" types for Fortran REAL and COMPLEX kinds 2, 3, 10, 16 to allow their use in Fortran descriptors.

2 years agoRecommit "[LV] Inline CreateSplatIV call for scalar VFs."
Florian Hahn [Fri, 14 Jan 2022 19:03:49 +0000 (19:03 +0000)]
Recommit "[LV] Inline CreateSplatIV call for scalar VFs."

This reverts the revert commit 073c27b5e5851f13d99d383e047309299b68827d.

A reduced test case has been added in 5e4966cbae7ba5 and the code has
been updated to handle the case where getInductionOpcode returns
BinaryOpsEnd. In this case, the original code was always using
Instruction::Add. Do the same in the patch.

Note this commit may slightly change the value naming, because it now
also assigns the 'induction' name in the floating point case.

2 years agoAdd new tests that check the icmp-ashr baseline.
Nadav Rotem [Fri, 14 Jan 2022 18:25:26 +0000 (10:25 -0800)]
Add new tests that check the icmp-ashr baseline.

This commit adds new tests that check the patterns that D117252 will
fix. As requested by @spatel.

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

2 years ago[flang] Allow pointers to non-sequence types in sequence types
Peter Klausler [Wed, 5 Jan 2022 01:09:33 +0000 (17:09 -0800)]
[flang] Allow pointers to non-sequence types in sequence types

Derived types with SEQUENCE must have data components of sequence
types; but this rule is relaxed as common an extension in the case of
pointer components, whose targets' types are not really relevant
to the implementation requirements of sequence types.

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

2 years ago[CPU-Dispatch] Make sure Dispatch names get updated if previously mangled
Erich Keane [Fri, 14 Jan 2022 18:22:06 +0000 (10:22 -0800)]
[CPU-Dispatch] Make sure Dispatch names get updated if previously mangled

Cases where there is a mangling of a cpu-dispatch/cpu-specific function
before the function becomes 'multiversion' (such as a member function)
causes the wrong name to be emitted for one of the variants/resolver,
since the name is cached.  Make sure we invalidate the cache in
cpu-dispatch/cpu-specific modes, like we previously did for just target
multiversioning.

2 years ago[libc++][NFC] Remove clang-diagnostic-c++98-compat-extra-semi warnings in experimenta...
Nikolas Klauser [Wed, 12 Jan 2022 23:07:01 +0000 (00:07 +0100)]
[libc++][NFC] Remove clang-diagnostic-c++98-compat-extra-semi warnings in experimental/simd

Force semicolons or remove them in `experimental/simd`

Reviewed By: Quuxplusone, ldionne, Mordante, #libc

Spies: libcxx-commits, miyuki

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

2 years agoApply clang-tidy fixes for readability-container-size-empty in SCF.cpp (NFC)
Mehdi Amini [Fri, 14 Jan 2022 07:34:55 +0000 (07:34 +0000)]
Apply clang-tidy fixes for readability-container-size-empty in SCF.cpp (NFC)

2 years agoApply clang-tidy fixes for readability-identifier-naming in MathOps.cpp (NFC)
Mehdi Amini [Fri, 14 Jan 2022 07:29:19 +0000 (07:29 +0000)]
Apply clang-tidy fixes for readability-identifier-naming in MathOps.cpp (NFC)

2 years agoApply clang-tidy fixes for performance-for-range-copy in PadOpInterchange.cpp (NFC)
Mehdi Amini [Fri, 14 Jan 2022 07:22:30 +0000 (07:22 +0000)]
Apply clang-tidy fixes for performance-for-range-copy in PadOpInterchange.cpp (NFC)

2 years agoApply clang-tidy fixes for performance-unnecessary-value-param in MLIRGen.cpp (NFC)
Mehdi Amini [Fri, 14 Jan 2022 06:09:14 +0000 (06:09 +0000)]
Apply clang-tidy fixes for performance-unnecessary-value-param in MLIRGen.cpp (NFC)

2 years ago[X86] Fix -Wunused-lambda-capture
Fangrui Song [Fri, 14 Jan 2022 18:07:20 +0000 (10:07 -0800)]
[X86] Fix -Wunused-lambda-capture

2 years ago[libc++] Fix __simple_view concept in std::ranges
Hui Xie [Fri, 14 Jan 2022 17:54:02 +0000 (12:54 -0500)]
[libc++] Fix __simple_view concept in std::ranges

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

2 years ago[InstCombine] remove unnecessary use check on X >>exact == 0 fold
Sanjay Patel [Fri, 14 Jan 2022 17:42:42 +0000 (12:42 -0500)]
[InstCombine] remove unnecessary use check on X >>exact == 0 fold

The transform replaces one icmp with another, so we should
not care if the shift has another use.

2 years ago[InstCombine] add tests for icmp with exact shift; NFC
Sanjay Patel [Fri, 14 Jan 2022 17:23:11 +0000 (12:23 -0500)]
[InstCombine] add tests for icmp with exact shift; NFC

2 years ago[libc++] [test] ASSERT_WITH_LIBRARY_INTERNAL_ALLOCATIONS is not supported on AIX.
Arthur O'Dwyer [Sat, 8 Jan 2022 20:20:37 +0000 (15:20 -0500)]
[libc++] [test] ASSERT_WITH_LIBRARY_INTERNAL_ALLOCATIONS is not supported on AIX.

I believe all four of these failures are directly due to the pattern where
allocations in the dylib are unobserved by the client program. If AIX32 and AIX64
don't support that, we should just disable the ASSERT_WITH_LIBRARY_INTERNAL_ALLOCATIONS
macro on AIX, and then we don't need to XFAIL these tests.

This also means I won't need to XFAIL a dozen other tests in D89057,
which rely heavily on ASSERT_WITH_LIBRARY_INTERNAL_ALLOCATIONS and
also currently fail on AIX.
See https://buildkite.com/llvm-project/libcxx-ci/builds/7669

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

2 years ago[libc] Implement correctly rounded log2f based on RLIBM library.
Tue Ly [Wed, 15 Dec 2021 21:32:40 +0000 (16:32 -0500)]
[libc] Implement correctly rounded log2f based on RLIBM library.

Implement log2f based on RLIBM library correctly rounded for all rounding modes.

Reviewed By: sivachandra, michaelrj, santoshn, jpl169, zimmermann6

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

2 years ago[libc++] [NFC] Remove a hard tab from __config.
Arthur O'Dwyer [Fri, 14 Jan 2022 17:18:44 +0000 (12:18 -0500)]
[libc++] [NFC] Remove a hard tab from __config.

2 years ago[MLIR] Introduce generic visitors.
Rahul Joshi [Thu, 13 Jan 2022 21:32:14 +0000 (13:32 -0800)]
[MLIR] Introduce generic visitors.

- Generic visitors invoke operation callbacks before/in-between/after visiting the regions
  attached to an operation and use a `WalkStage` to indicate which regions have been
  visited.
- This can be useful for cases where we need to visit the operation in between visiting
  regions attached to the operation.

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

2 years ago[X86][AVX] lowerShuffleAsLanePermuteAndShuffle - don't split repeated mask patterns
Simon Pilgrim [Fri, 14 Jan 2022 17:10:26 +0000 (17:10 +0000)]
[X86][AVX] lowerShuffleAsLanePermuteAndShuffle - don't split repeated mask patterns

Generalize 57a551a8dfa7 - if the inlane mask is a repeated mask, we're better off performing the lane permute instead of splitting

2 years ago[RISCV] Add basic support for matching shuffles to vslidedown.vi.
Craig Topper [Fri, 14 Jan 2022 17:04:53 +0000 (09:04 -0800)]
[RISCV] Add basic support for matching shuffles to vslidedown.vi.

Specifically the unary shuffle case where the elements being
shifted in are undef. This handles the shuffles produce by expanding
llvm.reduce.mul.

I did not reduce the VL which would increase the number of vsetvlis,
but may improve the execution speed. We'd also want to narrow the
multiplies so we could share vsetvlis between the vslidedown.vi and
the next multiply.

Reviewed By: frasercrmck

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

2 years ago[RISCV] Honor the VT when converting float point register names to register class...
Craig Topper [Fri, 14 Jan 2022 16:57:09 +0000 (08:57 -0800)]
[RISCV] Honor the VT when converting float point register names to register class for inline assembly.

It appears the code here was written for the inline asm clobbering
a specific register, but it also gets used for named input and
output registers.

For the input and output case, we should honor the VT so we
don't insert conversion instructions around the inline assembly.

For the clobber, case we need to pick the largest register class.

Reviewed By: asb, jrtc27

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

2 years ago[Docs] Use anonymous reference (NFC)
Nikita Popov [Fri, 14 Jan 2022 17:00:22 +0000 (18:00 +0100)]
[Docs] Use anonymous reference (NFC)

Hopefully fixes the build failure. Also fix a typo.

2 years ago[AMDGPU] Correct the known bits calculation for MUL_I24.
Craig Topper [Fri, 14 Jan 2022 16:47:40 +0000 (08:47 -0800)]
[AMDGPU] Correct the known bits calculation for MUL_I24.

I'm not entirely sure, but based on how ComputeNumSignBits handles
ISD::MUL, I believe this code was miscounting the number of sign
bits.

As an example of an incorrect result let's say that countMinSignBits
returned 1 for the left hand side and 24 for the right hand side.
LHSValBits would be 23 and RHSValBits would be 0 and the sum would
be 23. This would cause the code to set 9 high bits as zero/one. Now
suppose the real values for the left side is 0x800000 and the right
hand side is 0xffffff. The product is 0x00800000 which has 8 sign bits
not 9.

The number of valid bits for the left and right operands is now
the number of non-sign bits + 1. If the sum of the valid bits of
the left and right sides exceeds 32, then the result may overflow and we
can't say anything about the sign of the result. If the sum is 32
or less then it won't overflow and we know the result has at least
1 sign bit.

For the previous example, the code will now calculate the left
side valid bits as 24 and the right side as 1. The sum will be 25
and the sign bits will be 32 - 25 + 1 which is 8, the correct value.

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

2 years ago[AMDGPU] Pre-commit test for D116469. NFC
Craig Topper [Fri, 14 Jan 2022 16:47:05 +0000 (08:47 -0800)]
[AMDGPU] Pre-commit test for D116469. NFC

The multiply in this test is miscompiled to 0.

Reviewed By: foad

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

2 years ago[InstCombine] add more tests for binop with phi operands; NFC
Sanjay Patel [Fri, 14 Jan 2022 15:13:11 +0000 (10:13 -0500)]
[InstCombine] add more tests for binop with phi operands; NFC

Goes with D117110.

2 years ago[InstCombine] add test for limitation of knownbits with overshift; NFC
Sanjay Patel [Fri, 14 Jan 2022 15:01:11 +0000 (10:01 -0500)]
[InstCombine] add test for limitation of knownbits with overshift; NFC

The tests above this were added for D30781 and used to provide
coverage for a limit of knownbits, but improvements in other
transforms killed that intended purpose. This was noted because
another proposed improvement in D117110 will further reduce
those tests.

2 years ago[Docs] Update opaque pointer docs (NFC)
Nikita Popov [Fri, 14 Jan 2022 16:41:42 +0000 (17:41 +0100)]
[Docs] Update opaque pointer docs (NFC)

Mention -opaque-pointers, write a bit more about migration pitfalls
and update the open issues.

2 years ago[SystemZ][z/OS] ASCII/EBCDIC support with no coexistence
Muiez Ahmed [Fri, 14 Jan 2022 16:35:53 +0000 (11:35 -0500)]
[SystemZ][z/OS] ASCII/EBCDIC support with no coexistence

The aim of this patch is to break up the larger patch (https://reviews.llvm.org/D111323) to be more upstream friendly. In particular, this patch adds the char encoding sensitive changes but does not use inline namespaces as before. The use of namespaces to build both versions of the library, and localization of error messages will follow in a subsequent patch.

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

2 years agoRevert "[MemoryBuiltins] [NFC] Add missing section comments"
Philip Reames [Fri, 14 Jan 2022 16:01:56 +0000 (08:01 -0800)]
Revert "[MemoryBuiltins] [NFC] Add missing section comments"

This reverts commit 83338d5032424741accb1e851408021b47b84c08.  Comments in source are non-idiomatic and naming choice in head is unclear.

2 years ago[LTO] runNewPMPasses - remove check for TM != nullptr as we already dereference the...
Simon Pilgrim [Fri, 14 Jan 2022 16:31:14 +0000 (16:31 +0000)]
[LTO] runNewPMPasses - remove check for TM != nullptr as we already dereference the pointer directly later on in the same code

2 years ago[libc] Update exhaustive testing documentations.
Tue Ly [Fri, 14 Jan 2022 16:08:52 +0000 (11:08 -0500)]
[libc] Update exhaustive testing documentations.

2 years ago[flang] Fix a bug in the `flang` wrapper script
Andrzej Warzynski [Fri, 14 Jan 2022 10:47:39 +0000 (10:47 +0000)]
[flang] Fix a bug in the `flang` wrapper script

Please see
https://github.com/flang-compiler/f18-llvm-project/issues/1344#issuecomment-1012706527
for context and the discussion.

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

2 years ago[LV] Add test with an integer induction based on a ptr one.
Florian Hahn [Fri, 14 Jan 2022 15:56:47 +0000 (15:56 +0000)]
[LV] Add test with an integer induction based on a ptr one.

Reduced test case from the reproducer mentioned in
073c27b5e5851f13d99.

2 years ago[llvm-profgen] ProfiledBinary::load - use cast<> instead of dyn_cast<> to avoid deref...
Simon Pilgrim [Fri, 14 Jan 2022 15:51:21 +0000 (15:51 +0000)]
[llvm-profgen] ProfiledBinary::load - use cast<> instead of dyn_cast<> to avoid dereference of nullptr

The pointer is always dereferenced immediately, so assert the cast is correct instead of returning nullptr

2 years ago[X86] combineConcatVectorOps - fold concat(permilpd(x),permilpd(y)) -> permilpd(conca...
Simon Pilgrim [Fri, 14 Jan 2022 15:43:28 +0000 (15:43 +0000)]
[X86] combineConcatVectorOps - fold concat(permilpd(x),permilpd(y)) -> permilpd(concat(x,y))

2 years ago[X86] combineConcatVectorOps - fold concat(movs*dup(x),movs*dup(y)) -> movs*dup(conca...
Simon Pilgrim [Fri, 14 Jan 2022 15:10:23 +0000 (15:10 +0000)]
[X86] combineConcatVectorOps - fold concat(movs*dup(x),movs*dup(y)) -> movs*dup(concat(x,y))

2 years ago[libc++] _Uglify some template parameter names. NFCI.
Arthur O'Dwyer [Mon, 10 Jan 2022 17:00:10 +0000 (12:00 -0500)]
[libc++] _Uglify some template parameter names. NFCI.

2 years ago[mlir][memref] Fix memref.copy of scalar memref
Stephan Herhut [Fri, 14 Jan 2022 15:01:42 +0000 (16:01 +0100)]
[mlir][memref] Fix memref.copy of scalar memref

Also fix a memory leak in the test while at it.

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

2 years ago[gn build] Port 5726e5598104
LLVM GN Syncbot [Fri, 14 Jan 2022 15:05:57 +0000 (15:05 +0000)]
[gn build] Port 5726e5598104

2 years ago[CGBuiltin] Simplify code. NFCI.
Benjamin Kramer [Fri, 14 Jan 2022 15:02:02 +0000 (16:02 +0100)]
[CGBuiltin] Simplify code. NFCI.

2 years ago[clang][dataflow] Add transfer functions for constructors
Stanislav Gatev [Thu, 13 Jan 2022 13:53:52 +0000 (13:53 +0000)]
[clang][dataflow] Add transfer functions for constructors

This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.

Reviewed-by: ymandel, xazax.hun
Differential Revision: https://reviews.llvm.org/D117218

2 years ago[libc++] Modularize <chrono>
Louis Dionne [Mon, 10 Jan 2022 19:56:43 +0000 (14:56 -0500)]
[libc++] Modularize <chrono>

I didn't split the calendar bits more than this because there was little
benefit to doing it, and I know our calendar support is incomplete.
Whoever picks up the missing calendar bits can organize these headers
at their leisure.

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

2 years ago[msan] Fix typo in test from rGf6875c434ec2
Vitaly Buka [Fri, 14 Jan 2022 14:49:00 +0000 (06:49 -0800)]
[msan] Fix typo in test from rGf6875c434ec2

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

2 years ago[X86] Add tests showing failure to concatenate vmovsldup or vmovshdup nodes
Simon Pilgrim [Fri, 14 Jan 2022 14:49:40 +0000 (14:49 +0000)]
[X86] Add tests showing failure to concatenate vmovsldup or vmovshdup nodes

2 years ago[X86] combineConcatVectorOps - fold concat(movddup(x),movddup(y)) -> movddup(concat...
Simon Pilgrim [Fri, 14 Jan 2022 14:38:45 +0000 (14:38 +0000)]
[X86] combineConcatVectorOps - fold concat(movddup(x),movddup(y)) -> movddup(concat(x,y))

For AVX2+ targets this requires us to also recognise v4f64 concat(broadcast(x),broadcast(y)) -> movddup(concat(x,y))

2 years ago[llvm-profgen] Pass iteration value by reference in for-range loops to avoid unnecess...
Simon Pilgrim [Fri, 14 Jan 2022 14:16:18 +0000 (14:16 +0000)]
[llvm-profgen] Pass iteration value by reference in for-range loops to avoid unnecessary copies

2 years ago[llvm-profgen] CSProfileGenerator::generateLineNumBasedProfile - use cast<> instead...
Simon Pilgrim [Fri, 14 Jan 2022 14:10:07 +0000 (14:10 +0000)]
[llvm-profgen] CSProfileGenerator::generateLineNumBasedProfile - use cast<> instead of dyn_cast<> to avoid dereference of nullptr

The pointer is always dereferenced immediately below, so assert the cast is correct instead of returning nullptr

2 years ago[AArch64][SVE] Fix VLS mulh tests to use literal vectors
David Truby [Fri, 14 Jan 2022 14:20:44 +0000 (14:20 +0000)]
[AArch64][SVE] Fix VLS mulh tests to use literal vectors

This is a simple test fix that canonicalises the SVE mulh tests.

2 years ago[NFCI][SCEV] `computeExitLimitFromCondFromBinOp()`: rely on `getSequentialMinMaxExpr...
Roman Lebedev [Fri, 14 Jan 2022 13:43:25 +0000 (16:43 +0300)]
[NFCI][SCEV] `computeExitLimitFromCondFromBinOp()`: rely on `getSequentialMinMaxExpr()` constant relaxation

`getSequentialMinMaxExpr()` has been taught to perform this relaxation,
so rely on that now. Not sure this can be tested.

2 years ago[SCEV] `getSequentialMinMaxExpr()`: relax 2-op umin_seq w/ constant to umin
Roman Lebedev [Fri, 14 Jan 2022 13:42:55 +0000 (16:42 +0300)]
[SCEV] `getSequentialMinMaxExpr()`: relax 2-op umin_seq w/ constant to umin

Currently, `computeExitLimitFromCondFromBinOp()` does that directly.

2 years ago[NFC][SCEV] Add test with umin_seq w/ 1op and constant
Roman Lebedev [Fri, 14 Jan 2022 13:52:54 +0000 (16:52 +0300)]
[NFC][SCEV] Add test with umin_seq w/ 1op and constant

2 years ago[MLIR] NFC. affine data copy generate utility return value cleanup
Uday Bondhugula [Thu, 13 Jan 2022 10:50:11 +0000 (16:20 +0530)]
[MLIR] NFC. affine data copy generate utility return value cleanup

Clean up return value on affineDataCopyGenerate utility. Return the
actual success/failure status instead of the "number of bytes" which
isn't being used in the codebase in any way. The success/failure status
wasn't being sent out earlier.

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

2 years ago[Clang] Add __builtin_reduce_or and __builtin_reduce_and
Jun Zhang [Wed, 5 Jan 2022 09:20:57 +0000 (17:20 +0800)]
[Clang] Add __builtin_reduce_or and __builtin_reduce_and

This patch implements two builtins specified in D111529.
The last __builtin_reduce_add will be seperated into another one.

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

2 years ago[LLDB][NFC] Fix a typo in comment
Coelacanthus [Fri, 14 Jan 2022 08:27:44 +0000 (16:27 +0800)]
[LLDB][NFC] Fix a typo in comment

fix typo in comment: libcstd++ -> libstdc++

Reviewed By: wallace

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

2 years ago[mlir][linalg][bufferize] Support custom insertion point for buffer copies
Matthias Springer [Fri, 14 Jan 2022 13:46:52 +0000 (22:46 +0900)]
[mlir][linalg][bufferize] Support custom insertion point for buffer copies

By default, copies are inserted right before the tensor OpOperand use. With this change, `bufferize` implementation can change the insertion point. This is needed for some ops where it would be illegal to insert a copy right before the use.

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

2 years ago[mlir][memref] Fold self copies
Matthias Springer [Fri, 14 Jan 2022 13:31:01 +0000 (22:31 +0900)]
[mlir][memref] Fold self copies

Fold `memref.copy %x, %x`.

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

2 years ago[clang-format] Add missing test for loops formatting. NFC.
Marek Kurdej [Fri, 14 Jan 2022 13:40:03 +0000 (14:40 +0100)]
[clang-format] Add missing test for loops formatting. NFC.

The case with an inner while loop wasn't tested before. Same for outer loop with a ForeachMacro.

2 years ago[LoopVersioning] Add test case with foldable icmp in runtime check.
Florian Hahn [Fri, 14 Jan 2022 13:42:20 +0000 (13:42 +0000)]
[LoopVersioning] Add test case with foldable icmp in runtime check.

Test case showing a foldable icmp ('icmp ult i8* [[SCEVGEP1]], [[SCEVGEP1]]').
This can be simplified in a follow-up change.

2 years agoRevert "[clangd] Elide even more checks in SelectionTree."
Kadir Cetinkaya [Fri, 14 Jan 2022 13:32:43 +0000 (14:32 +0100)]
Revert "[clangd] Elide even more checks in SelectionTree."

This reverts commit 07f9fb8b51417ec3e6f46508e1b5ef78287b32ad.

2 years ago[mlir][linalg][bufferize] Use memref.copy instead of linalg.copy
Matthias Springer [Fri, 14 Jan 2022 12:57:30 +0000 (21:57 +0900)]
[mlir][linalg][bufferize] Use memref.copy instead of linalg.copy

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

2 years ago[mlir][memref] Implement fast lowering of memref.copy
Stephan Herhut [Fri, 7 Jan 2022 09:00:19 +0000 (10:00 +0100)]
[mlir][memref] Implement fast lowering of memref.copy

In the absence of maps, we can lower memref.copy to a memcpy.

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

2 years ago[DebugInfo][DWARF][NFC] Refactor DWARFTypePrinter usages. Create functions to print...
Alexey Lapshin [Wed, 12 Jan 2022 15:42:48 +0000 (18:42 +0300)]
[DebugInfo][DWARF][NFC] Refactor DWARFTypePrinter usages. Create functions to print type dies.

This patch creates functions which might be used to dump types.
This functionality was already implemented by  DWARFTypePrinter.
Now it could be reused. It will help D96035, which uses DWARFTypePrinter.

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

2 years ago[mlir][memref] Fold copy of cast
Matthias Springer [Fri, 14 Jan 2022 12:50:33 +0000 (21:50 +0900)]
[mlir][memref] Fold copy of cast

If the source/dest is a cast that does not change shape/element type, the cast can be skipped.

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

2 years ago[SCEV] `getSequentialMinMaxExpr()`: rewrite deduplication to be fully recursive
Roman Lebedev [Fri, 14 Jan 2022 12:11:20 +0000 (15:11 +0300)]
[SCEV] `getSequentialMinMaxExpr()`: rewrite deduplication to be fully recursive

Since we don't merge/expand non-sequential umin exprs into umin_seq exprs,
we may have umin_seq(umin(umin_seq())) chain, and the innermost umin_seq
can have duplicate operands still.

2 years ago[clang-format] Fix typos in test. NFC.
Marek Kurdej [Fri, 14 Jan 2022 12:24:16 +0000 (13:24 +0100)]
[clang-format] Fix typos in test. NFC.

2 years ago[RISCV][NFC] Use TableGen 'foreach' to simplify repetitive CSR definitions
Alex Bradbury [Fri, 14 Jan 2022 11:58:27 +0000 (11:58 +0000)]
[RISCV][NFC] Use TableGen 'foreach' to simplify repetitive CSR definitions

Make the definitions of hpmcounter3-hpmcounter31,
hpmcounter3h-hpmcounter31h, mhpmcounter3-mhpmcounter31,
mhpmcounter3h-mhpmcounter31h, pmpaddr0-pmpaddr63, mhpmevent3-31, and
pmpcfg0-15 substantially less repetitive using a foreach loop.

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

2 years ago[mlir] Fix invalid assertion in ModuleTranslation.cpp
Alex Zinenko [Thu, 13 Jan 2022 13:29:09 +0000 (14:29 +0100)]
[mlir] Fix invalid assertion in ModuleTranslation.cpp

LLVM dialect supports terminators with repeated successor blocks that take
different operands. This cannot be directly expressed in LLVM IR though since
it uses the number of the predecessor block to differentiate values in its PHI
nodes. Therefore, the translation to LLVM IR inserts dummy blocks to forward
arguments in case of repeated succesors with arguments. The insertion works
correctly. However, when connecting PHI nodes to their source values, the
assertion of the insertion having worked correctly was incorrect: it would only
trigger if repeated blocks were adjacent in the successor list (not guaranteed
by anything) and would not check if the successors have operands (no need for
dummy blocks in absence of operands since no PHIs are being created). Change
the assertion to only trigger in case of duplicate successors with operands,
and don't expect them to be adjacent.

Reviewed By: wsmoses

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

2 years ago[IRBuilder] Migrate gep-folding to value-based FoldGEP.
Florian Hahn [Fri, 14 Jan 2022 11:23:50 +0000 (11:23 +0000)]
[IRBuilder] Migrate gep-folding to value-based FoldGEP.

Depends on D117038.

Reviewed By: lebedev.ri

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

2 years ago[Verifier] Avoid asserting on invalid cleanuppad chain
Nikita Popov [Fri, 14 Jan 2022 11:08:33 +0000 (12:08 +0100)]
[Verifier] Avoid asserting on invalid cleanuppad chain

The invalid undef value already triggers a verifier failure, but
then the upwards scan from the cleanuppad ends up asserting. Make
sure this is handled gacefully instead.

2 years ago[mlir] Use .empty() instead of checking size() == 0.
Adrian Kuegel [Fri, 14 Jan 2022 10:58:52 +0000 (11:58 +0100)]
[mlir] Use .empty() instead of checking size() == 0.

Based on a finding by ClangTidy readability-container-size-empty check.

2 years ago[llvm-dwp] Simplify FileCheck patterns. NFC.
Jay Foad [Fri, 14 Jan 2022 10:37:55 +0000 (10:37 +0000)]
[llvm-dwp] Simplify FileCheck patterns. NFC.

Take advantage of D117117 to simplify {{\[}}[[ to [[[.

2 years agoUse {LITERAL} instead of regex escaping in some lit tests. NFC.
Jay Foad [Fri, 14 Jan 2022 10:35:03 +0000 (10:35 +0000)]
Use {LITERAL} instead of regex escaping in some lit tests. NFC.

2 years ago[LLDB] Skip TestIOHandlerPythonREPLSigint.py on Arm/Linux
Muhammad Omair Javaid [Fri, 14 Jan 2022 10:46:02 +0000 (15:46 +0500)]
[LLDB] Skip TestIOHandlerPythonREPLSigint.py on Arm/Linux

TestIOHandlerPythonREPLSigint.py is failing on Arm/Linux buildbot. I am
marking it as skip for now.

2 years ago[clang-format] Fix namespace end comments fixer with anonymous namespaces.
Marek Kurdej [Fri, 14 Jan 2022 10:37:04 +0000 (11:37 +0100)]
[clang-format] Fix namespace end comments fixer with anonymous namespaces.

Previously, a strange trailing comment was produced:
```
namespace out { namespace {
}} // namespace out::
```
(mind the "out::").

Reviewed By: MyDeveloperDay, owenpan

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

2 years ago[InstSimplify] Pass pointer and indices separately to SimplifyGEPInst.
Florian Hahn [Fri, 14 Jan 2022 09:59:43 +0000 (09:59 +0000)]
[InstSimplify] Pass pointer and indices separately to SimplifyGEPInst.

This doesn't require callers to put the pointer operand and the indices
in a container like a vector when calling the function. This is not
really an issue with the existing callers. But when using it from
IRBuilder the inputs are available as separate pointer value and indices
ArrayRef.

Reviewed By: lebedev.ri

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

2 years ago[InstCombine] Fold for masked scatters to a uniform address
Caroline Concatto [Mon, 13 Dec 2021 12:03:26 +0000 (12:03 +0000)]
[InstCombine] Fold for masked scatters to a uniform address

When masked scatter intrinsic does a uniform store to a destination
address from a source vector, and in this case, the mask is all one value.
This patch replaces the masked scatter with an extracted element of the
last lane of the source vector and stores it in the destination vector.
This patch also folds when the value in the masked scatter is a splat.
In this case, the mask cannot be all zero, and it folds to a scalar store
of the value in the destination pointer.

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

2 years ago[ConstantFold] Check for uniform value before reinterpret load
Nikita Popov [Fri, 14 Jan 2022 09:07:37 +0000 (10:07 +0100)]
[ConstantFold] Check for uniform value before reinterpret load

The reinterpret load code will convert undef values into zero.
Check the uniform value case before it to produce a better result
for all-undef initializers.

However, the uniform value handling will return the uniform value
even if the access is out of bounds, while the reinterpret load
code will return undef. Add an explicit check to retain the
previous result in this case.

2 years ago[InstSimplify] Add test for load from undef (NFC)
Nikita Popov [Fri, 14 Jan 2022 08:57:03 +0000 (09:57 +0100)]
[InstSimplify] Add test for load from undef (NFC)

If we're loading from an all-undef value, we sometimes still
return zero rather than undef.

2 years ago[GlobalOpt] Add test for SRA with i8 array type (NFC)
Nikita Popov [Fri, 14 Jan 2022 08:51:13 +0000 (09:51 +0100)]
[GlobalOpt] Add test for SRA with i8 array type (NFC)

2 years ago[CMake] Do not override user specified CMAKE_{C,CXX}_ARCHIVE_FINISH on Linux
Fangrui Song [Fri, 14 Jan 2022 09:10:23 +0000 (01:10 -0800)]
[CMake] Do not override user specified CMAKE_{C,CXX}_ARCHIVE_FINISH on Linux

Respect the user choice, e.g. -DCMAKE_CXX_ARCHIVE_FINISH=: (to skip the
(usually) no-op step).

2 years ago[clang-check] Adjust argument adjusters for clang-check to strip options blocking...
Sam McCall [Fri, 14 Jan 2022 07:34:11 +0000 (08:34 +0100)]
[clang-check] Adjust argument adjusters for clang-check to strip options blocking the static analyzer

Output generation options (like `-save-temps`) will make the analyzer not executed even `--analyze` option is provided in the driver arguments.
Besides, the original approach of adding `--analyze` option will not work when (more than one) `-fsyntax-only` options are provided in the driver arguments.

This patch fixes these two problems by using the syntax-only adjuster to remove output generation options and manually filter out redundant `-fsyntax-only` options.

In the new implementation, the adjusters added by `ClangTool` will not be removed but used as dependencies for clang-check adjusters for analyzer options.

Reviewed By: sammccall

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

2 years ago[NFC][CSKY] Remove duplicate setOperationAction in CSKYTargetLowering constructor
Zi Xuan Wu [Fri, 14 Jan 2022 09:01:43 +0000 (17:01 +0800)]
[NFC][CSKY] Remove duplicate setOperationAction in CSKYTargetLowering constructor

2 years agoAdd -fsanitize-address-param-retval to clang.
Kevin Athey [Fri, 14 Jan 2022 08:20:33 +0000 (00:20 -0800)]
Add -fsanitize-address-param-retval to clang.

With the introduction of this flag, it is no longer necessary to enable noundef analysis with 4 separate flags.
(-Xclang -enable-noundef-analysis -mllvm -msan-eager-checks=1).
This change only covers the introduction into the compiler.

This is a follow up to: https://reviews.llvm.org/D116855

Reviewed By: vitalybuka

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

2 years agoRevert unrelated change from: [clang-format] Fix break being added to macro define...
Marek Kurdej [Fri, 14 Jan 2022 07:43:59 +0000 (08:43 +0100)]
Revert unrelated change from: [clang-format] Fix break being added to macro define with ColumnLimit: 0

2 years ago[clang-format] Fix break being added to macro define with ColumnLimit: 0
Armen Khachkinaev [Thu, 13 Jan 2022 14:49:50 +0000 (15:49 +0100)]
[clang-format] Fix break being added to macro define with ColumnLimit: 0

Fix for #[[ https://github.com/llvm/llvm-project/issues/49164 | 49164 ]] issue.

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, curdeius, owenpan

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