platform/upstream/llvm.git
21 months ago[mlir][sparse] Removing DLL attributes from ExecutionEngine/SparseTensor/Enums.h
wren romano [Sat, 8 Oct 2022 01:17:27 +0000 (18:17 -0700)]
[mlir][sparse] Removing DLL attributes from ExecutionEngine/SparseTensor/Enums.h

This differential attempts to resolve certain issues on Windows (e.g., https://reviews.llvm.org/D134933#3843372 and https://reviews.llvm.org/D133462#3844195).

Reviewed By: stella.stamenova, aganea

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

21 months ago[clang-format][docs][NFC] Fix invalid syntax in ShortLambdaStyle examples.
Emilia Dreamer [Mon, 10 Oct 2022 17:54:48 +0000 (20:54 +0300)]
[clang-format][docs][NFC] Fix invalid syntax in ShortLambdaStyle examples.

21 months agoRepair a confusing standards reference; NFC
Aaron Ballman [Mon, 10 Oct 2022 18:09:11 +0000 (14:09 -0400)]
Repair a confusing standards reference; NFC

There is no 6.9 in C++11, the quote actually lives in
[intro.multithread] for that revision. However, the words moved in
C++17 to [intro.progress] so I added that information as well.

21 months ago[TargetLowering][RISCV][X86] Support even divisors in expandDIVREMByConstant.
Craig Topper [Mon, 10 Oct 2022 17:46:29 +0000 (10:46 -0700)]
[TargetLowering][RISCV][X86] Support even divisors in expandDIVREMByConstant.

If the divisor is even, we can first shift the dividend and divisor
right by the number of trailing zeros. Now the divisor is odd and we
can do the original algorithm to calculate a remainder. Then we shift
that remainder left by the number of trailing zeros and add the bits
that were shifted out of the dividend.

Reviewed By: RKSimon

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

21 months agoImplement `getrandom` function for linux targets.
Schrodinger ZHU Yifan [Mon, 10 Oct 2022 18:00:13 +0000 (11:00 -0700)]
Implement `getrandom` function for linux targets.

Reviewed By: michaelrj, sivachandra

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

21 months agoAllow DynamicLoaderDarwinKernel to activate without binary
Jason Molenda [Mon, 10 Oct 2022 17:15:43 +0000 (10:15 -0700)]
Allow DynamicLoaderDarwinKernel to activate without binary

In https://reviews.llvm.org/D133534 I made a little cleanup
to DynamicLoaderDarwinKernel::CreateInstance and unintentionally
changed the logic.  Previously it would not create an instance
if there was a binary given to lldb and it was not a kernel.
With my change, the absence of any binary would also cause it
to not create.  So connecting to a kernel without any binaries
would fail.

rdar://100985097

21 months ago[LoopSimplifyCFG] Clear SCEV dispositions when removing dead blocks.
Florian Hahn [Mon, 10 Oct 2022 17:08:34 +0000 (18:08 +0100)]
[LoopSimplifyCFG] Clear SCEV dispositions when removing dead blocks.

When removing loops & blocks we also need to clear the SCEV dispositions
as they may now contain incorrect values.

Fixes #58262.

21 months ago[mlir][linalg] Expose pattern to collapse generic op dimensions
Thomas Raoux [Fri, 7 Oct 2022 23:59:06 +0000 (23:59 +0000)]
[mlir][linalg] Expose pattern to collapse generic op dimensions

Add a pattern to be able to collapse dimensions in a linalg generic op.

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

21 months ago[lldb][test] Skip TestStepAvoidsRegexp.py on Windows
Michael Buch [Mon, 10 Oct 2022 13:31:29 +0000 (14:31 +0100)]
[lldb][test] Skip TestStepAvoidsRegexp.py on Windows

21 months ago[Clang] Support constexpr builtin fmin
Evgeny Shulgin [Fri, 7 Oct 2022 21:46:18 +0000 (21:46 +0000)]
[Clang] Support constexpr builtin fmin

Support constexpr version of __builtin_fmin and its variations.

Reviewed By: jcranmer-intel

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

21 months ago[Clang][Sema] Narrow inline namespace filtration for unqualified friend declarations
Troy Johnson [Mon, 10 Oct 2022 15:34:14 +0000 (08:34 -0700)]
[Clang][Sema] Narrow inline namespace filtration for unqualified friend declarations

rG04ba1856 introduced a call to FilterLookupForScope that is expensive
for very large translation units where it was observed to cause a 6%
compile time degradation. As the comment states, the only effect is to
"remove declarations found in inline namespaces for friend declarations
with unqualified names." This change limits the call to that scenario.
The test that was added by rG04ba1856 continues to pass, but the
observed degradation is cut in half.

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

21 months ago[mlir][sparse] Rename SparseTensorFile to SparseTensorReader.
bixia1 [Fri, 7 Oct 2022 19:01:38 +0000 (12:01 -0700)]
[mlir][sparse] Rename SparseTensorFile to SparseTensorReader.

This is to prepare for adding SparseTensorWriter.

Reviewed By: wrengr

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

21 months ago[ConstraintElimination] Bail out for GEPs with scalable vectors.
Florian Hahn [Mon, 10 Oct 2022 15:01:20 +0000 (16:01 +0100)]
[ConstraintElimination] Bail out for GEPs with scalable vectors.

This fixes a crash with scalable vectors, thanks @nikic for spotting
this!

21 months ago[LICM] Disable thread-safety checks in single-thread model
Shubham Narlawar [Mon, 10 Oct 2022 14:47:14 +0000 (16:47 +0200)]
[LICM] Disable thread-safety checks in single-thread model

If the single-thread model is used, or the
-licm-force-thread-model-single flag is specified, skip checks
related to thread-safety. This means that store promotion for
conditionally executed stores only requires proof of
dereferenceability and writability, but not of thread-safety. For
example, this enables promotion of stores to (non-constant) globals,
as well as captured allocas.

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

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

21 months agoRevert "[PGO] Make emitted symbols hidden"
Alex Brachet [Mon, 10 Oct 2022 14:37:59 +0000 (14:37 +0000)]
Revert "[PGO] Make emitted symbols hidden"

This reverts commit 4ea1a647ff0973c683dd71fec77e6fe7f6dfd2ca.

This breaks on Darwin which tries to export these symbols
https://github.com/llvm/llvm-project/blob/ebb258d3b0785f6dcc65e1f277d0690891ddc94d/clang/lib/Driver/ToolChains/Darwin.cpp#L1363

I'll try to reland which that removed and approval from
Apple folks.

21 months ago[AMDGPU] Make V_SAT_PK_U8_I16 a True16 Instruction
Joe Nash [Fri, 7 Oct 2022 18:56:36 +0000 (14:56 -0400)]
[AMDGPU] Make V_SAT_PK_U8_I16 a True16 Instruction

The return type is two u8 packed into a 16 bit VGPR, so this instruction
should be True16.

Reviewed By: dp

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

21 months ago[mlir][Bazel] Fix for reviews.llvm.org/D135559
Goran Flegar [Mon, 10 Oct 2022 14:27:53 +0000 (16:27 +0200)]
[mlir][Bazel] Fix for reviews.llvm.org/D135559

21 months agoPossibly fix sphinx regression from 6685e56ceddf
Erich Keane [Mon, 10 Oct 2022 14:22:41 +0000 (07:22 -0700)]
Possibly fix sphinx regression from 6685e56ceddf

It isn't clear that this is what it is complaining about, but looking
closer, I think this is what I got wrong here. So submitting this to
hope that the Sphinx build will be happy.

21 months agoDisallow dereferencing of void* in C++.
Erich Keane [Tue, 4 Oct 2022 19:41:43 +0000 (12:41 -0700)]
Disallow dereferencing of void* in C++.

as Discussed:
https://discourse.llvm.org/t/rfc-can-we-stop-the-extension-to-allow-dereferencing-void-in-c/65708

There is no good reason to allow this when the other compilers all
reject this, and it messes with SFINAE/constraint checking.

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

21 months ago[mlir][Linalg] Retire LinalgStrategyTileAndFusePass and filter-based pattern.
Nicolas Vasilache [Mon, 10 Oct 2022 06:36:10 +0000 (23:36 -0700)]
[mlir][Linalg] Retire LinalgStrategyTileAndFusePass and filter-based pattern.

Context: https://discourse.llvm.org/t/psa-retire-linalg-filter-based-patterns/63785

In the process, also retire `tileConsumerAndFuseProducers` that is now replaced by `tileConsumerAndFuseProducerGreedilyUsingSCFForOp`.

Context: https://discourse.llvm.org/t/psa-retire-tileandfuselinalgops-method/63850

When performing this replacement, a change of behavior appeared: the older `tileConsumerAndFuseProducers` would split the parallel
and non-parallel dimensions automatically and perform a first level of tile-and-fuse on parallel dimensions only and then introduce a
second level of tiling-only on the reduction dimensions. The newer `tileConsumerAndFuseProducerGreedilyUsingSCFForOp` on the other hand
does not perform this breakdown. As a consequence, the transform specification is evolved to produce the same output.

Additionally, replace some uses of `unsigned` by `int64_t` where possible without pulling in larger interface changes (left for a future PR).

Context: https://www.youtube.com/watch?v=Puio5dly9N8

Lastly, tests that were performing tile and fuse and distribute on tensors are retired: the generated IR mixing scf.for, tensors and
distributed processor ids was racy at best ..

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

21 months ago[gn build] port bc839b4b4e27
Nico Weber [Mon, 10 Oct 2022 13:19:12 +0000 (09:19 -0400)]
[gn build] port bc839b4b4e27

21 months ago[InstCombine] fold udiv with common factor
Sanjay Patel [Mon, 10 Oct 2022 11:21:23 +0000 (07:21 -0400)]
[InstCombine] fold udiv with common factor

((X *nuw Y) >> Z) / X --> Y >> Z

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

This is similar to 6b869be8100d / 8da2fa856f1b, but I have
not found a signed equivalent, so it's just an unsigned
match for now.

21 months ago[InstCombine] add 'exact' to udiv test for more coverage; NFC
Sanjay Patel [Mon, 10 Oct 2022 11:08:38 +0000 (07:08 -0400)]
[InstCombine] add 'exact' to udiv test for more coverage; NFC

21 months ago[PhaseOrdering] add test for sdiv with common factor; NFC
Sanjay Patel [Mon, 10 Oct 2022 10:51:43 +0000 (06:51 -0400)]
[PhaseOrdering] add test for sdiv with common factor; NFC

issue #58137

21 months agoFix clang-tools-extra Sphinx build
Aaron Ballman [Mon, 10 Oct 2022 11:53:52 +0000 (07:53 -0400)]
Fix clang-tools-extra Sphinx build

This should address the issues found in:
https://lab.llvm.org/buildbot/#/builders/115/builds/35504

21 months ago[AArch64] Add index check before lowerInterleavedStore() uses ShuffleVectorInst's...
Peter Rong [Mon, 10 Oct 2022 11:52:31 +0000 (12:52 +0100)]
[AArch64] Add index check before lowerInterleavedStore() uses ShuffleVectorInst's mask

This commit fixes https://github.com/llvm/llvm-project/issues/57326.

Currently we would take a Mask out and directly use it by doing
auto Mask = SVI->getShuffleMask();
However, if the mask is undef, this Mask is not initialized. It might be
a vector of -1 or random integers.
This would cause an Out-of-bound read later when trying to find a
StartMask.

This change checks if all indices in the Mask is in the allowed range,
and fixes the out-of-bound accesses.

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

21 months ago[lldb][CPlusPlusLanguage] Respect the step-avoid-regex for functions with auto return...
Michael Buch [Thu, 6 Oct 2022 23:35:05 +0000 (00:35 +0100)]
[lldb][CPlusPlusLanguage] Respect the step-avoid-regex for functions with auto return types

**Summary**

The primary motivation for this patch is to make sure we handle
the step-in behaviour for functions in the `std` namespace which
have an `auto` return type. Currently the default `step-avoid-regex`
setting is `^std::` but LLDB will still step into template functions
with `auto` return types in the `std` namespace.

**Details**
When we hit a breakpoint and check whether we should stop, we call
into `ThreadPlanStepInRange::FrameMatchesAvoidCriteria`. We then ask
for the frame function name via `SymbolContext::GetFunctionName(Mangled::ePreferDemangledWithoutArguments)`.
This ends up trying to parse the function name using `CPlusPlusLanguage::MethodName::GetBasename` which
parses the raw demangled name string.

`CPlusPlusNameParser::ParseFunctionImpl` calls `ConsumeTypename` to skip
the (in our case auto) return type of the demangled name (according to the
Itanium ABI this is a valid thing to encode into the mangled name). However,
`ConsumeTypename` doesn't strip out a plain `auto` identifier
(it will strip a `decltype(auto) return type though). So we are now left with
a basename that still has the return type in it, thus failing to match the `^std::`
regex.

Example frame where the return type is still part of the function name:
```
Process 1234 stopped
* thread #1, stop reason = step in
    frame #0: 0x12345678 repro`auto std::test_return_auto<int>() at main.cpp:12:5
   9
   10   template <class>
   11   auto test_return_auto() {
-> 12       return 42;
   13   }
```

This is another case where the `CPlusPlusNameParser` breaks us in subtle ways
due to evolving C++ syntax. There are longer-term plans of replacing the hand-rolled
C++ parser with an alternative that uses the mangle tree API to do the parsing for us.

**Testing**

* Added API and unit-tests
* Adding support for ABI tags into the parser is a larger undertaking
  which we would rather solve properly by using libcxxabi's mangle tree
  parser

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

21 months ago[LLDB] Complete set of char tests for static integral members
David Spickett [Thu, 6 Oct 2022 10:41:42 +0000 (10:41 +0000)]
[LLDB] Complete set of char tests for static integral members

Previously we had a bit of a mix of "signed char" "unsigned char" and
"char".

This adds seperate min and max checks for all three types.

Depends on D135170

Reviewed By: Michael137

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

21 months agoAdd llvm-gsymutil to the Bazel build files.
Simon Giesecke [Mon, 10 Oct 2022 10:03:05 +0000 (12:03 +0200)]
Add llvm-gsymutil to the Bazel build files.

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

21 months ago[AArch64][SVE] Fix AArch64_SVE_VectorCall calling convention
Matt Devereau [Thu, 8 Sep 2022 11:22:11 +0000 (11:22 +0000)]
[AArch64][SVE] Fix AArch64_SVE_VectorCall calling convention

This fixes the case where callees with SVE arguments outside of the z0-z7
range were incorrectly deduced as SVE calling convention functions

21 months agoExtended Documentation of LLVM_TARGETS_TO_BUILD by listing all possible values
Adeel Ahmad [Mon, 10 Oct 2022 08:31:50 +0000 (10:31 +0200)]
Extended Documentation of LLVM_TARGETS_TO_BUILD by listing all possible values

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

21 months ago[Attributor] Use ConstantFoldLoadFromConst()
Nikita Popov [Fri, 7 Oct 2022 09:54:17 +0000 (11:54 +0200)]
[Attributor] Use ConstantFoldLoadFromConst()

When determining the initial value of the object, use the constant
folding API to load a given type at a given offset in the global
initializer. This makes it work for cases where the load doesn't
directly correspond to an aggregate member.

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

21 months ago[Bindings] Remove go bindings
Nikita Popov [Fri, 7 Oct 2022 10:10:42 +0000 (12:10 +0200)]
[Bindings] Remove go bindings

Remove the unmaintained Go bindings per
https://discourse.llvm.org/t/rfc-remove-the-go-bindings/65725.

The tinygo project provides maintained Go bindings at
https://github.com/tinygo-org/go-llvm.

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

21 months ago[AA] Remove deprecated ModRefInfo helpers (NFC)
Nikita Popov [Mon, 10 Oct 2022 07:53:34 +0000 (09:53 +0200)]
[AA] Remove deprecated ModRefInfo helpers (NFC)

21 months ago[mlir][Linalg] Use ConfinedAttr for dimensions of ReduceOp.
Adrian Kuegel [Wed, 5 Oct 2022 08:08:18 +0000 (10:08 +0200)]
[mlir][Linalg] Use ConfinedAttr for dimensions of ReduceOp.

We can use the new DenseArrayStrictlySorted constraint.

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

21 months ago[gn build] Port 1ae33bf42680
LLVM GN Syncbot [Mon, 10 Oct 2022 07:30:41 +0000 (07:30 +0000)]
[gn build] Port 1ae33bf42680

21 months ago[clang-tidy] Add cppcoreguidelines-avoid-do-while check
Carlos Galvez [Tue, 23 Aug 2022 06:14:03 +0000 (06:14 +0000)]
[clang-tidy] Add cppcoreguidelines-avoid-do-while check

Implements rule ES.75 of C++ Core Guidelines.

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

21 months ago[flang] Allow conversion from boxed derived type to fir.class
Valentin Clement [Mon, 10 Oct 2022 06:58:20 +0000 (08:58 +0200)]
[flang] Allow conversion from boxed derived type to fir.class

This patch updates the fir.convert operation's verifier to allow
conversion from !fir.box<!fir.type<T>> to !fir.class<!fir.type<T>>.

Other conversion involving fir.class are likely needed but will
be added when lowering needs them.

Reviewed By: PeteSteinfeld

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

21 months ago[RISCV] Use hasAllWUsers to recover XORI/ORI
LiaoChunyu [Sun, 9 Oct 2022 13:52:36 +0000 (21:52 +0800)]
[RISCV] Use hasAllWUsers to recover XORI/ORI

reference 0fbe71e91f44.

Also add testcase for addi.

Reviewed By: craig.topper

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

21 months ago[examples] Fix deprecated use of llvm::empty.
Lang Hames [Mon, 10 Oct 2022 05:00:43 +0000 (22:00 -0700)]
[examples] Fix deprecated use of llvm::empty.

21 months ago[ORC] Relax assertions in SimpleRemoteEPCTransport.
Lang Hames [Mon, 10 Oct 2022 04:54:35 +0000 (21:54 -0700)]
[ORC] Relax assertions in SimpleRemoteEPCTransport.

Null source/destination pointers are ok for zero-sized messages.

21 months ago[LLJIT] Default to EPCEHFrameRegistrar rather than InProcessEHFrameRegistrar.
Lang Hames [Mon, 10 Oct 2022 04:54:09 +0000 (21:54 -0700)]
[LLJIT] Default to EPCEHFrameRegistrar rather than InProcessEHFrameRegistrar.

Now that ExecutionSession objects alway have ExecutorProcessControl (EPC)
objects attached we can use EPCEHFrameRegistrar by default, rather than
InProcessEHFrameRegistrar. This allows LLJIT to work out-of-the-box with remote
EPCs on platforms that use JITLink, without requiring a custom
ObjectLinkingLayerCreator to override the eh-frame registrar.

21 months ago[RISCV] Remove some vsetvli intrinsics under Zve32*.
Craig Topper [Mon, 10 Oct 2022 03:40:38 +0000 (20:40 -0700)]
[RISCV] Remove some vsetvli intrinsics under Zve32*.

Zve32* does not support SEW=64. Or any LMUL smaller than 32/SEW.

Reviewed By: eopXD

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

21 months ago[tsan][go] Fix string equal operator
Kai Luo [Mon, 10 Oct 2022 01:38:38 +0000 (09:38 +0800)]
[tsan][go] Fix string equal operator

Fixed error
```
compiler-rt/lib/tsan/go/buildgo.sh: 62: [: unexpected operator
```

Reviewed By: vitalybuka

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

21 months agoApply clang-tidy fixes for modernize-use-equals-default in Bufferize.cpp (NFC)
Mehdi Amini [Thu, 6 Oct 2022 18:54:20 +0000 (18:54 +0000)]
Apply clang-tidy fixes for modernize-use-equals-default in Bufferize.cpp (NFC)

21 months agoApply clang-tidy fixes for readability-identifier-naming in TosaToLinalg.cpp (NFC)
Mehdi Amini [Thu, 6 Oct 2022 18:42:49 +0000 (18:42 +0000)]
Apply clang-tidy fixes for readability-identifier-naming in TosaToLinalg.cpp (NFC)

21 months ago[AArch64] Swap 'lsl(val1,small-shmt)' to right hand side for AND(lsl(val1,small-shmt...
Mingming Liu [Tue, 4 Oct 2022 21:39:50 +0000 (14:39 -0700)]
[AArch64] Swap 'lsl(val1,small-shmt)' to right hand side for AND(lsl(val1,small-shmt), lsl(val2,large-shmt))

On many aarch64 processors (Cortex A78, Neoverse N1/N2/V1, etc), ADD with LSL shift (shift-amount <= 4) has smaller latency and higher
throughput than ADD with larger shift (shift-amunt > 4). This is at least no-op for the rest of the processors.

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

21 months ago[AArch64][NFC] Precommit test case to show sub-optimal codegen for add(lsl(val1,small...
Mingming Liu [Tue, 4 Oct 2022 21:31:35 +0000 (14:31 -0700)]
[AArch64][NFC] Precommit test case to show sub-optimal codegen for add(lsl(val1,small-shift), lsl(val2,large-shift)).

Ideally, add operand with smaller shift should be RHS. In that way, smaller-shift is folded into ADD.
- Also add another test case when 'lsl(val1,small-shift)' has one than one use, to show the (planned) optimization won't regress this case.

21 months ago[ConstraintElimination] Include index type scale.
Florian Hahn [Sun, 9 Oct 2022 20:51:54 +0000 (21:51 +0100)]
[ConstraintElimination] Include index type scale.

The current decomposition for GEPs did not correctly handle cases where
GEPs access different source types. Adjust the constraints by including
the indexed type-size as coefficients.

Further generalization to allow GEPs with more than one index is a
needed general follow-up improvement.

21 months ago[ConstraintElimination] Add tests for GEPs with different source types.
Florian Hahn [Sun, 9 Oct 2022 20:51:47 +0000 (21:51 +0100)]
[ConstraintElimination] Add tests for GEPs with different source types.

21 months ago[DSE][NFC] Add nounwind attribute to match test intent
luxufan [Mon, 3 Oct 2022 17:21:08 +0000 (17:21 +0000)]
[DSE][NFC] Add nounwind attribute to match test intent

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

21 months ago[DSE] Relax constraint on isGuaranteedLoopInvariant
luxufan [Wed, 5 Oct 2022 20:38:49 +0000 (20:38 +0000)]
[DSE] Relax constraint on isGuaranteedLoopInvariant

If the location ptr to be killed is in no loop and the Function does not
have irreducible loops, then we can regard it as loop invariant.

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

21 months ago[RISCV][NFC] Fix unused variable warning.
Yeting Kuo [Thu, 6 Oct 2022 14:55:52 +0000 (22:55 +0800)]
[RISCV][NFC] Fix unused variable warning.

Reviewed By: reames

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

21 months ago[clang-format] Add support to remove unnecessary semicolons after function definition
mydeveloperday [Sun, 9 Oct 2022 10:16:58 +0000 (11:16 +0100)]
[clang-format] Add support to remove unnecessary semicolons after function definition

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

This change is to remove extraneous and unnecessary ';' from after a function definition, its off by default and carries the same "code modification" warning as some of our other code manipulating changes.

Reviewed By: HazardyKnusperkeks, owenpan

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

21 months ago[clangd] Fix rename for symbol introduced by UsingDecl
Tom Praschan [Fri, 7 Oct 2022 23:24:13 +0000 (01:24 +0200)]
[clangd] Fix rename for symbol introduced by UsingDecl

Fixes https://github.com/clangd/clangd/issues/170

This patch actually consists of 2 fixes:

1) Add handling for UsingShadowDecl to canonicalRenameDecl().
   This fixes the issue described in https://github.com/clangd/clangd/issues/170.

2) Avoid the "there are multiple symbols under the cursor error" by applying similar
   logic as in https://reviews.llvm.org/D133664.
   This also partly fixes https://github.com/clangd/clangd/issues/586.

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

21 months ago[LoongArch] Expand fptrunc store from f64 to f32
gonglingqin [Sun, 9 Oct 2022 09:51:10 +0000 (17:51 +0800)]
[LoongArch] Expand fptrunc store from f64 to f32

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

21 months ago[ConstraintElim] Move logic to get constraint for solving to helper.
Florian Hahn [Sun, 9 Oct 2022 09:44:35 +0000 (10:44 +0100)]
[ConstraintElim] Move logic to get constraint for solving to helper.

Move common logic shared by callers of getConstraint that use the result
to query the constraint system to a new helper getConstraintForSolving.

This includes common legality checks (i.e. not an equality constraint,
no new variables) and the logic to query the unsigned system if possible
for signed predicates.

21 months ago[gn build] Port a2c6a1193f41
LLVM GN Syncbot [Sun, 9 Oct 2022 07:11:39 +0000 (07:11 +0000)]
[gn build] Port a2c6a1193f41

21 months ago[libc++][ranges]implement `std::views::take_while`
Hui Xie [Fri, 30 Sep 2022 12:06:36 +0000 (13:06 +0100)]
[libc++][ranges]implement `std::views::take_while`

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

21 months ago[C++20] [Coroutines] Exit early if we found co_await appears in
Chuanqi Xu [Sun, 9 Oct 2022 06:54:32 +0000 (14:54 +0800)]
[C++20] [Coroutines] Exit early if we found co_await appears in
unevaluated context

Closes https://github.com/llvm/llvm-project/issues/58133

The direct cause for this issue is that the compilation process
continues after it found it is in a invalid state. [expr.await]p2 says
clearly that the co_await expressions are not allowed to appear in
unevaluated context. So we can exit early in this case. It also reduces
many redundant diagnostic messages (Such as 'expression with side
effects has no effect in an unevaluated context').

21 months ago[PowerPC] Add vector pair calling convention for AIX
Ting Wang [Sun, 9 Oct 2022 05:23:18 +0000 (01:23 -0400)]
[PowerPC] Add vector pair calling convention for AIX

This is AIX part of update after https://reviews.llvm.org/D117225

Fixed the issue that AIX64 with vector pair enabled saw redundant
spill/reload of callee saved vector registers.

Based on original patch by: Kai Luo

Reviewed By: lkail

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

21 months ago[LoongArch] Don't merge FrameIndex accesses into [F]{LD,ST}X
WANG Xuerui [Sun, 9 Oct 2022 04:09:21 +0000 (12:09 +0800)]
[LoongArch] Don't merge FrameIndex accesses into [F]{LD,ST}X

Otherwise eliminateFrameIndex cannot figure out how to fixup the stack
offset with its stateless logic, because there wouldn't be an immediate
slot for it to trivially write to, and it may not be easy to transform
the surrounding code to make it work.

This fixes a fairly common crash when compiling moderately complex code with
Clang.

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

21 months ago[lld-macho] Implement -ignore_auto_link
Keith Smiley [Sun, 9 Oct 2022 03:38:00 +0000 (20:38 -0700)]
[lld-macho] Implement -ignore_auto_link

This option is really only useful for things like debugging
https://github.com/llvm/llvm-project/issues/56939, but there are some
actual uses of it in Swift's build system as well.

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

21 months ago[CMake] Use libcxx-abi-* targets for in-tree sanitizer C++ ABI
Petr Hosek [Thu, 29 Sep 2022 07:53:06 +0000 (07:53 +0000)]
[CMake] Use libcxx-abi-* targets for in-tree sanitizer C++ ABI

When in-tree libcxx is selected as the sanitizer C++ ABI, use
libcxx-abi-* targets rather than libcxxabi and libunwind directly.

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

21 months agoRemove myself as X86 Backend owner.
Craig Topper [Sun, 9 Oct 2022 01:39:45 +0000 (18:39 -0700)]
Remove myself as X86 Backend owner.

21 months ago[RISCV] Merge more rv32/rv64 vector intrinsic tests that contain the same content.
Craig Topper [Sat, 8 Oct 2022 17:49:52 +0000 (10:49 -0700)]
[RISCV] Merge more rv32/rv64 vector intrinsic tests that contain the same content.

21 months agoAdd myself to CREDITS.TXT + CODE_OWNERS.TXT
Phoebe Wang [Sun, 9 Oct 2022 00:50:16 +0000 (08:50 +0800)]
Add myself to CREDITS.TXT + CODE_OWNERS.TXT

See https://discourse.llvm.org/t/proposed-change-to-x86-code-ownership/65620

21 months ago[Support] Add fast path for StringRef::find with needle of length 2.
Tatsuyuki Ishi [Sun, 9 Oct 2022 00:58:07 +0000 (00:58 +0000)]
[Support] Add fast path for StringRef::find with needle of length 2.

InclusionRewriter on Windows (CRLF line endings) will exercise this in a
hot path. Calling memcmp repeatedly would be highly suboptimal for that
use case, so give it a specialized path.

Reviewed By: efriedma

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

21 months ago[PGO] Consider parent context when weighing branches with likelyhood.
Anton Bikineev [Thu, 22 Sep 2022 14:56:03 +0000 (16:56 +0200)]
[PGO] Consider parent context when weighing branches with likelyhood.

Generally, with PGO enabled the C++20 likelyhood attributes shall be
dropped assuming the profile has a good coverage. However, currently
this is not the case for the following code:

 if (always_false()) [[likely]] {
   ...
 }

The patch fixes this and drops the attribute, if the parent context was
executed in the profile. The patch still preserves the attribute, if the
parent context was not executed, e.g. to support the cases when the
profile has insufficient coverage.

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

21 months agoAdd myself to CREDITS.TXT + CODE_OWNERS.TXT
Simon Pilgrim [Sat, 8 Oct 2022 21:19:50 +0000 (22:19 +0100)]
Add myself to CREDITS.TXT + CODE_OWNERS.TXT

Phoebe Wang and I are replacing Craig Topper as X86 Code Owners: https://discourse.llvm.org/t/proposed-change-to-x86-code-ownership/65620

21 months ago[ConstraintElimination] Add tests for chained GEPs without inbounds.
Florian Hahn [Sat, 8 Oct 2022 18:39:36 +0000 (19:39 +0100)]
[ConstraintElimination] Add tests for chained GEPs without inbounds.

21 months agoApply clang-tidy fixes for llvm-else-after-return in TosaToLinalg.cpp (NFC)
Mehdi Amini [Thu, 6 Oct 2022 18:41:58 +0000 (18:41 +0000)]
Apply clang-tidy fixes for llvm-else-after-return in TosaToLinalg.cpp (NFC)

21 months agoApply clang-tidy fixes for performance-unnecessary-value-param in IRCore.cpp (NFC)
Mehdi Amini [Thu, 6 Oct 2022 18:21:47 +0000 (18:21 +0000)]
Apply clang-tidy fixes for performance-unnecessary-value-param in IRCore.cpp (NFC)

21 months ago[LTO] Make local linkage GlobalValue in non-prevailing COMDAT available_externally
Fangrui Song [Sat, 8 Oct 2022 18:09:42 +0000 (11:09 -0700)]
[LTO] Make local linkage GlobalValue in non-prevailing COMDAT available_externally

See the updated linkonce_resolution_comdat.ll. For a local linkage GV in a
non-prevailing COMDAT, it remains defined while its leader has been made
available_externally. This violates the COMDAT rule that its members must be
retained or discarded as a unit.

To fix this, update the regular LTO change D34803 to track local linkage
GlobalValues, and port the code to ThinLTO (GlobalAliases are not handled.)

Fix https://github.com/llvm/llvm-project/issues/58215:
as a size optimization, we place private `__profd_` in a COMDAT with a
`__profc_` key. When FuncImport.cpp makes `__profc_` available_externally due to
a non-prevailing COMDAT, `__profd_` incorrectly remains private. This change
makes the `__profd_` available_externally.

```
cat > c.h <<'eof'
extern void bar();
inline __attribute__((noinline)) void foo() {}
eof
cat > m1.cc <<'eof'
#include "c.h"
int main() {
  bar();
  foo();
}
eof
cat > m2.cc <<'eof'
#include "c.h"
__attribute__((noinline)) void bar() {
  foo();
}
eof

clang -O2 -fprofile-generate=./t m1.cc m2.cc -flto -fuse-ld=lld -o t_gen
rm -fr t && ./t_gen && llvm-profdata show -function=foo t/default_*.profraw
# one _Z3foov

clang -O2 -fprofile-generate=./t m1.cc m2.cc -flto=thin -fuse-ld=lld -o t_gen
rm -fr t && ./t_gen && llvm-profdata show -function=foo t/default_*.profraw
# one _Z3foov
```

Reviewed By: tejohnson

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

21 months ago[RISCV] Add signext attribute to i32 arguments in some tests. NFC
Craig Topper [Sat, 8 Oct 2022 17:49:52 +0000 (10:49 -0700)]
[RISCV] Add signext attribute to i32 arguments in some tests. NFC

21 months ago[clangd] FindTarget: UsingEnumDecl is not an alias
Sam McCall [Sat, 8 Oct 2022 02:32:15 +0000 (04:32 +0200)]
[clangd] FindTarget: UsingEnumDecl is not an alias

Unlike UsingDecl it doesn't name the UsingShadowDecls it emits, so it doesn't
make sense to consider them the same thing. Don't consider the UsingEnumDecl
a target when the UsingShadowDecl is referenced.

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

21 months ago[ConstraintElimination] Support chained GEPs with constant offsets.
Florian Hahn [Sat, 8 Oct 2022 15:59:27 +0000 (16:59 +0100)]
[ConstraintElimination] Support chained GEPs with constant offsets.

Handle the (gep (gep ....), C) case by incrementing the constant
coefficient of the inner GEP, if C is a constant.

21 months ago[LV] Replace check with assert for reduction resume values (NFC).
Florian Hahn [Sat, 8 Oct 2022 15:26:08 +0000 (16:26 +0100)]
[LV] Replace check with assert for reduction resume values (NFC).

At this point, we need to have resume values for all inductions. If not,
this would result in silent mis-compiles.

21 months ago[ConstraintElimination] Remove unused function (NFC).
Florian Hahn [Sat, 8 Oct 2022 15:05:55 +0000 (16:05 +0100)]
[ConstraintElimination] Remove unused function (NFC).

21 months ago[InstCombine] fold exact sdiv to ashr (2nd try)
Sanjay Patel [Sat, 8 Oct 2022 14:09:44 +0000 (10:09 -0400)]
[InstCombine] fold exact sdiv to ashr (2nd try)

The 1st attempt failed to updated the test checks as expected.

Original commit message:

sdiv exact X, (1<<ShAmt) --> ashr exact X, ShAmt (if shl is non-negative)

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

It would probably be better to use ValueTracking to replace this
and the existing transform above it, but the analysis does not
account for the no-wrap properly, and it's not immediately clear
to me how to fix it.

21 months ago[InstCombine] add test for sdiv with shl; NFC
Sanjay Patel [Sat, 8 Oct 2022 14:06:44 +0000 (10:06 -0400)]
[InstCombine] add test for sdiv with shl; NFC

21 months agoRevert "[InstCombine] fold exact sdiv to ashr"
Sanjay Patel [Sat, 8 Oct 2022 14:02:03 +0000 (10:02 -0400)]
Revert "[InstCombine] fold exact sdiv to ashr"

This reverts commit fe15290e0cf5d2bcdefca2e81ef6ff8155a2f7a8.
The test checks were not updated as expected.

21 months ago[InstCombine] fold exact sdiv to ashr
Sanjay Patel [Sat, 8 Oct 2022 13:19:21 +0000 (09:19 -0400)]
[InstCombine] fold exact sdiv to ashr

sdiv exact X, (1<<ShAmt) --> ashr exact X, ShAmt (if shl is non-negative)

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

It would probably be better to use ValueTracking to replace this
and the existing transform above it, but the analysis does not
account for the no-wrap properly, and it's not immediately clear
to me how to fix it.

21 months ago[libc++] Make charconv require C++17 or later.
Mark de Wever [Fri, 2 Sep 2022 16:46:59 +0000 (18:46 +0200)]
[libc++] Make charconv require C++17 or later.

Implementing the paper
P2291R3 Add Constexpr Modifiers to Functions to_chars and from_chars for
        Integral Types in <charconv> Header

Gives issues in language versions prior to C++17. As suggested in
D131855 disable the code prior to C++17. This removes libc++'s
extension.

Reviewed By: ldionne, #libc_vendors, #libc, philnik

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

21 months ago[clang-tidy] Ignore concepts in `misc-redundant-expression`
Evgeny Shulgin [Wed, 14 Sep 2022 20:03:14 +0000 (20:03 +0000)]
[clang-tidy] Ignore concepts in `misc-redundant-expression`

The checker should ignore requirement expressions inside concept
definitions, because redundant expressions still make sense here

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

Reviewed By: njames93, aaron.ballman

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

21 months ago[ConstraintElimination] Use logic from 3771310eed for queries only.
Florian Hahn [Sat, 8 Oct 2022 10:03:44 +0000 (11:03 +0100)]
[ConstraintElimination] Use logic from 3771310eed for queries only.

The logic added in 3771310eed was placed sub-optimally. Applying the
transform in ::getConstraint meant that it would also impact conditions
that are added to the system by the signed <-> unsigned transfer logic.

This meant we failed to add some signed facts to the signed system. To
make sure we still add as many useful facts to the signed/unsigned
systems, move the logic to the point where we query the system.

21 months ago[C++20] [Modules] Only allow redeclarations in partitions if they are in the same...
Chuanqi Xu [Sat, 8 Oct 2022 09:05:44 +0000 (17:05 +0800)]
[C++20] [Modules] Only allow redeclarations in partitions if they are in the same module

Closes https://github.com/llvm/llvm-project/issues/58196.

The root cause for the problem is an oversight in
https://reviews.llvm.org/D127624, which allows the redeclarations in
partitions. However, we took a mistake there that we should only allow
it if the redeclarations in the one same module instead of return
directly if either the redeclaration lives in a partition. The original
implementation makes no sense and I believe it was an oversight.

21 months ago[C++20] [Modules] Remove assertion of current module when acting on import
Chuanqi Xu [Sat, 8 Oct 2022 08:38:19 +0000 (16:38 +0800)]
[C++20] [Modules] Remove assertion of current module when acting on import

Closes https://github.com/llvm/llvm-project/issues/58199

Previously, when we act on a import statement, we'll assume there is a
module declaration in the current TU if the command line tells us we're
compiling a module unit. This makes since on valid codes. However, for
invalid codes, it is possible. See
https://github.com/llvm/llvm-project/issues/58199 for example.

This patch removes the assertion. And the assertion is a noop and it
should be safe to remove it.

21 months ago[X86] Remove AVX512VP2INTERSECT from Sapphire Rapids.
Freddy Ye [Sat, 8 Oct 2022 06:27:06 +0000 (14:27 +0800)]
[X86] Remove AVX512VP2INTERSECT from Sapphire Rapids.

For more details, please refer to the latest ISE document: https://www.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html

Reviewed By: pengfei

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

21 months ago[LoongArch] Do not assert value type in isFPImmLegal
gonglingqin [Sat, 8 Oct 2022 06:33:04 +0000 (14:33 +0800)]
[LoongArch] Do not assert value type in isFPImmLegal

This patch fixes the failure of llvm/test/CodeGen/Generic/vector.ll and
CodeGen/PowerPC/2007-11-19-VectorSplitting.ll for a LoongArch native build.

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

21 months ago[ARM64EC][clang-cl] Add arm64EC test; NFC
chenglin.bi [Sat, 8 Oct 2022 06:47:50 +0000 (14:47 +0800)]
[ARM64EC][clang-cl] Add arm64EC test; NFC

21 months ago[clangd] Enable standard library index by default.
Sam McCall [Thu, 15 Sep 2022 19:54:01 +0000 (21:54 +0200)]
[clangd] Enable standard library index by default.

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

21 months agoBareMetal: detect usr/include/c++/v1 path in sysroot
Manoj Gupta [Thu, 22 Sep 2022 20:53:46 +0000 (13:53 -0700)]
BareMetal: detect usr/include/c++/v1 path in sysroot

Currently baremetal driver adds <sysroot>/include/c++/v1
for libc++ headers. However on ChromeOS, all include files
are inside <sysroot>/usr/include. So add
<sysroot>/usr/include/c++/v1 if it exists in baremetal driver.

Reviewed By: MaskRay

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

21 months ago[LoongArch] Set correct encodings for DWARF exception handling
wanglei [Thu, 6 Oct 2022 12:39:59 +0000 (20:39 +0800)]
[LoongArch] Set correct encodings for DWARF exception handling

This patch sets correct encodings for DWARF exception handling for
LoongArch.

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

21 months ago[GlobalISel] Add commutative matchers for compares.
Jessica Paquette [Fri, 7 Oct 2022 19:19:33 +0000 (12:19 -0700)]
[GlobalISel] Add commutative matchers for compares.

This adds:

* `m_c_GICmp`
* `m_c_GFCmp`

These work the same way as the standard matchers, but will also try to commute
the LHS and RHS of a compare to get a match.

E.g.

```
m_c_GICmp(m_Pred(...), m_GAdd(...), m_GSub(...))
```

Can match either of

```
icmp cc (add x, y), (sub a, b)
icmp swapped_cc (sub a, b), (add x, y)
```

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

21 months ago[memprof] dump memprof profile when receive deadly signals
Enna1 [Sat, 8 Oct 2022 01:55:40 +0000 (09:55 +0800)]
[memprof] dump memprof profile when receive deadly signals

Currently memprof profile is dumped when program exits (call `FinishAndWrite()` in ~Allocator) or `__memprof_profile_dump` is manually called.
For programs that never exit (e.g. server-side application), it will be useful to dump memprof profile when specific signal is received.
This patch installs a signal handler for deadly signals(SIGSEGV, SIGBUS, SIGABRT, SIGILL, SIGTRAP, SIGFPE) like we do in other sanitizers. In the signal handler `__memprof_profile_dump` is called to dump memprof profile.

Reviewed By: tejohnson

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

21 months ago[mlir][vector] Merge accumulator/result transpose into contract
Lei Zhang [Sat, 8 Oct 2022 00:43:27 +0000 (00:43 +0000)]
[mlir][vector] Merge accumulator/result transpose into contract

This commit adds a pattern to merge accumulator and result
`vector.transpose` ops into `vector.contract`. This kind of
pattern can be generated for NCHW convolution vectorization,
where we use transposes to convert the 1-D NCW convolution
into NWC during vectorization. Merging the transpose would
mean we can avoid materialize vector extract/insert for
transposes and it makes further vector level transformations
easier.

Reviewed By: ThomasRaoux

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

21 months ago[RISCV] Fix incorrect parenthese placement in comment. NFC
Craig Topper [Sat, 8 Oct 2022 00:16:38 +0000 (17:16 -0700)]
[RISCV] Fix incorrect parenthese placement in comment. NFC

21 months ago[VP][RISCV] Add vp.smax/smin/umax/umin intrinsics
Craig Topper [Fri, 7 Oct 2022 17:26:22 +0000 (10:26 -0700)]
[VP][RISCV] Add vp.smax/smin/umax/umin intrinsics

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

21 months ago[libc] Document which date funcs are needed/done
Jeff Bailey [Sat, 8 Oct 2022 00:03:47 +0000 (00:03 +0000)]
[libc] Document which date funcs are needed/done

Reviewed By: rtenneti

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