Commit graph

421565 commits

Author SHA1 Message Date
Alex Bradbury bea5e88bcf [clang][Sema] Fix typo in checkBuiltinArgument helper
The checkBuiltinArgument helper takes an integer ArgIndex and is
documented as performing normal type-checking on that argument. However,
it mistakenly hardcodes the argument index to zero when retrieving the
argument from the call expression.

This hadn't been noticed previously as all in-tree uses typecheck the
0th argument anyway.
2022-04-20 14:42:41 +01:00
Haojian Wu 95f0f69441 [clangd] Handle the new Using TemplateName.
Add supports in FindTarget and IncludeCleaner. This would
improve AST-based features on a tempalte which is found via a using
declaration. For example, go-to-def on `vect^or<int> v;` gives us the
location of `using std::vector`, which was not previously.

Base on https://reviews.llvm.org/D123127

Differential Revision: https://reviews.llvm.org/D123212
2022-04-20 15:42:24 +02:00
Nikita Popov 37b1515b0a [SimplifyCFG] Add additional threading tests (NFC) 2022-04-20 15:40:44 +02:00
Alexey Bataev 5f7ac15912 Revert "[DAG]Introduce llvm::processShuffleMasks and use it for shuffles in DAG Type Legalizer."
This reverts commit 2f49163b33 to fix
a buildbot failure. Reported in https://lab.llvm.org/buildbot#builders/105/builds/24284
2022-04-20 06:35:55 -07:00
Corentin Jabot 69dd89fdcb [Clang] Fix references to captured variables in dependant context.
D119136 changed how captures are handled in a lambda call operator
declaration, but did not properly handled dependant context,
which led to crash when refering to init-captures in
a trailing return type.

We fix that bug by making transformations more symetric with parsing,
ie. we first create the call operator, then transform the capture,
then compute the type of the lambda call operaror.

This ensures captures exist and have the right type when
we parse a trailing requires-clause / return type.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D124012
2022-04-20 15:35:20 +02:00
Matt Arsenault 26d575eb08 LocalStackSlotAllocation: Combine debug printing statements 2022-04-20 09:31:14 -04:00
Matt Arsenault 4575f35ea1 LocalStackSlotAllocation: Stop creating unused virtual register 2022-04-20 09:31:14 -04:00
Matt Arsenault 67aa8ed547 llvm-reduce: Fix sources with executable permission 2022-04-20 09:31:13 -04:00
Nico Weber 59bd20526c [gn build] (manually) port f26c41e8dd (lib/clang/Support) 2022-04-20 09:28:04 -04:00
Nico Weber 7d2cc882d5 [compiler-rt][sanitizers] build ubsan, asan etc libraries with Mac Catalyst support
Like D118875, but for ubsan, asan, etc.

With this, I can successfully run:

    bin/clang++ -target x86_64-apple-ios14.0-macabi foo.cc \
        -isysroot $(xcrun -show-sdk-path) -fsanitize=undefined

with a locally built libclang_rt.ubsan_osx_dynamic.dylib.

Differential Revision: https://reviews.llvm.org/D124059
2022-04-20 09:22:25 -04:00
Simon Pilgrim 9d3bdabfae [X86] Add multiuse all_of test case for D123652 2022-04-20 14:19:41 +01:00
gysit 407b351da2 [mlir][linalg] Add ods-gen helper to simplify the build methods.
Add a helper used to implement the build methods generated by ods-gen. The change reduces code size and compilation time since all structured op builders use the same build method. The change reduces the LinalgOps.cpp compilation time from 10.2s to 9.8s (debug build).

Depends On D123987

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D124003
2022-04-20 13:14:38 +00:00
Kito Cheng f26c41e8dd [RISCV] Moving RVV intrinsic type related util to clang/Support
We add a new clang library called `clangSupport` for putting those utils which can be used in clang table-gen and other clang component.

We tried to put that into `llvm/Support`, but actually those stuffs only used in clang* and clang-tblgen, so I think that might be better to create `clang/Support`

* clang will used that in https://reviews.llvm.org/D111617.

Reviewed By: khchen, MaskRay, aaron.ballman

Differential Revision: https://reviews.llvm.org/D121984
2022-04-20 21:13:13 +08:00
gysit 17721b6915 [mlir][linalg] Avoid template methods for parsing and printing.
The revision avoids template methods for parsing and printing that are replicated for every named operation. Instead, the new methods take a regionBuilder argument. The revision reduces the compile time of LinalgOps.cpp from 11.2 to 10.2 seconds (debug build).

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D123987
2022-04-20 13:06:31 +00:00
Alexey Bataev 2f49163b33 [DAG]Introduce llvm::processShuffleMasks and use it for shuffles in DAG Type Legalizer.
We can process the long shuffles (working across several actual
vector registers) in the best way if we take the actual register
represantion into account. We can build more correct representation of
register shuffles, improve number of recognised buildvector sequences.
Also, same function can be used to improve the cost model for the
shuffles. in future patches.

Part of D100486

Differential Revision: https://reviews.llvm.org/D115653
2022-04-20 05:32:56 -07:00
Uday Bondhugula d7565de6cc [MLIR] NFC. Drop trailing white space in GPU async ops print
NFC. Drop trailing end of line white space in GPU async ops' printer
whenever the list of async deps is empty.

Reviewed By: mehdi_amini, rriddle

Differential Revision: https://reviews.llvm.org/D123754
2022-04-20 17:56:53 +05:30
Joseph Huber ee74abaad7 [OpenMP] Add triple to the linker wrapper job
Summary:
I forgot to add the triple to the linker wrapper job, so we were still
generating code for the unintended platforms.
2022-04-20 08:23:43 -04:00
Uday Bondhugula d423fc3724 Add RegionBranchOpInterface on affine.for op
Add RegionBranchOpInterface on affine.for op so that transforms relying
on RegionBranchOpInterface can support affine.for. E.g.:
buffer-deallocation pass.

Reviewed By: herhut

Differential Revision: https://reviews.llvm.org/D123568
2022-04-20 17:46:07 +05:30
Jay Foad 1f91512268 [AMDGPU] Simplify calls to getDefSrcRegIgnoringCopies. NFC.
getDefSrcRegIgnoringCopies never returns None on valid MIR.
2022-04-20 12:37:24 +01:00
Sam McCall 4cec789c17 [Testing] Drop clangTesting from clang's public library interface
This was probably not particularly intended to be public, and disallows deps
on gtest which are useful in test helpers.

https://discourse.llvm.org/t/stop-exporting-clangtesting-library/61672

Differential Revision: https://reviews.llvm.org/D123610
2022-04-20 13:28:44 +02:00
Joseph Huber 1dfe0273fd [OpenMP] Add explicit triple to linker wrapper test
Summary:
Some platforms like Mach-O require different handling of section names.
This is not supported on Mac-OS or Windows yet so we shouldn't be
testing the compilation there. Add an explicit triple to the tests.
2022-04-20 07:24:51 -04:00
Jay Foad e13d2efed6 [AMDGPU] Add GlobalISel checks for flat scratch SVS addressing
Note that GlobalISel does not actually use the SVS addressing mode
for these cases yet because it chooses the VGPR bank for
G_FRAME_INDEX; see the TODO comment in
AMDGPURegisterBankInfo::getInstrMapping.
2022-04-20 12:06:39 +01:00
Simon Pilgrim 3949c2de79 [X86][SSE] Add i386 test coverage to sse2 intrinsic tests 2022-04-20 12:05:10 +01:00
Abinav Puthan Purayil b7df71524e [AMDGPU][GlobalISel] Force return atomic selection for now 2022-04-20 16:00:08 +05:30
Nikita Popov dcab8e60c5 [Support] Remove unused LLVM_PTR_SIZE macro
This was used for LLVM_ALIGNAS() arguments in the past, but has
since been superseded by plain alignas() which also accepts a type.
2022-04-20 12:27:37 +02:00
Nikita Popov 903c30f4d1 [Support] Remove LLVM_ATTRIBUTE_DEPRECATED
The guidance since D94219 is to use [[deprecated]] directly. Now
that all historical uses of the macro have been removed, drop the
macro itself.
2022-04-20 12:16:41 +02:00
Nikita Popov f767a7d115 [DomTreeUpdater] Remove deprecated methods
Remove the insertEdge(), insertEdgeRelaxed(), deleteEdge() and
deleteEdgeRelaxed() methods, which have been deprecated three
years ago.
2022-04-20 12:14:29 +02:00
Simon Pilgrim 7c1bff3f7b [X86][FMA4] Add i386 test coverage to fma4 intrinsic tests 2022-04-20 11:14:18 +01:00
Nikita Popov 9b9bd995c5 [IRBuilder] Remove deprecated CreateShuffleVector() method
This method has been deprecated for two years.
2022-04-20 12:11:03 +02:00
Simon Pilgrim ba2e567f04 [X86][SSE] Add i386 test coverage to sse42 intrinsic tests 2022-04-20 11:06:07 +01:00
Simon Pilgrim 90e5c690e2 [X86][SSE] Add i386 test coverage to sse41 intrinsic tests 2022-04-20 11:06:06 +01:00
Sven van Haastregt e67b1b0ccf [OpenCL] Add missing __opencl_c_atomic_scope_device guards
Update opencl-c.h after the specification clarification in
https://github.com/KhronosGroup/OpenCL-Docs/pull/775
2022-04-20 11:02:50 +01:00
Nikita Popov c99424f765 [IR] Deprecate Type::getPointerElementType() (NFC)
There are no more in-tree users of this method, outside the
experimental SPIRV backend.
2022-04-20 11:55:40 +02:00
Nikita Popov e1616dc59e [ScopBuilder] Avoid pointer element type access
Rather than checking the bitcast pointer element types, compare
the element type of the access and the GEP result type.

The entire code is dubious due to the inspection of GEP structure,
but this at least preserves the spirit of the existing code.
2022-04-20 11:52:36 +02:00
Matthias Springer 9235e597a4 [mlir][bufferize] Fix missing copies when writing to a buffer in a loop
Writes into tensors that are definied outside of a repetitive region, but with the write happening inside of the repetitive region were previously not considered conflicts. This was incorrect.

E.g.:
```
%0 = ... : tensor<?xf32>
scf.for ... {
  "reading_op"(%0) : tensor<?xf32>
  %1 = "writing_op"(%0) : tensor<?xf32> -> tensor<?xf32>
  ...
}
```

In the above example, "writing_op" should be out-of-place.

This commit fixes the bufferization for any op that declares its repetitive semantics via RegionBranchOpInterface.
2022-04-20 18:51:06 +09:00
Simon Pilgrim b402ea55a8 [X86][SSE] Add i386 test coverage to sse4a intrinsic tests 2022-04-20 10:48:47 +01:00
Simon Pilgrim c86588af65 [X86][SSE] Add i386 test coverage to ssse3 intrinsic tests 2022-04-20 10:44:28 +01:00
Simon Pilgrim 88d61cc6e9 [X86][SSE] Add i386 test coverage to sse3 intrinsic tests 2022-04-20 10:44:28 +01:00
Simon Pilgrim 6574d75b8d [XOP] Add i386 test coverage to xop intrinsic tests 2022-04-20 10:44:27 +01:00
Ingo Müller 1fe1f913c5 [mlir][docs] Add missing parentheses in example code on walkers.
`getFunction` was missing parentheses.

Reviewed By: ftynse, mehdi_amini

Differential Revision: https://reviews.llvm.org/D123999
2022-04-20 09:43:41 +00:00
Chen Zheng 3c776c70a7 [PowerPC] add XLC compat builtin __abs
Reviewed By: jsji

Differential Revision: https://reviews.llvm.org/D123372
2022-04-20 05:14:22 -04:00
Max Kazantsev a0595f8c99 [Test] One more test with potentially malformed phis 2022-04-20 15:50:27 +07:00
Chuanqi Xu 5b6742a6bd [NFC] Return correct PreservedAnalysis for CoroEarly
This is a fix for previous typo. It makes no sense to return
PreservedAnalyses::all() if anything is change. This change simplify
codes further.
2022-04-20 16:47:10 +08:00
Zakk Chen bd0d126302 [RISCV][Clang][NFC] Update vid intrinsic tests.
Re-run the update_cc_test_checks.py to update expected result.
I'm not sure why those tests are passed before.

Differential Revision: https://reviews.llvm.org/D124062
2022-04-20 01:35:53 -07:00
Sheng e4cd110f1c [NFC] test commit
Empty test commit, check commit access
2022-04-20 01:35:53 -07:00
Ting Wang f6bdbb91c2 [NFC] Empty test commit, check commit access 2022-04-20 01:35:53 -07:00
Whisperity f4834815f4 [clang-tidy] Fix crash on calls to overloaded operators in llvmlibc-callee-namespace
The routine that facilitated symbols to be explicitly allowed asked
the name of the called function, which resulted in a crash when the
check was accidentally run on non-trivial C++ code.

Differential Revision: http://reviews.llvm.org/D123992

Reviewed By: aaron.ballman
2022-04-20 10:15:03 +02:00
chenglin.bi 8242fc7f8a [InstCombine] add tests for mul+lshr; NFC
Baseline tests for D123453(issue #54824)
2022-04-20 16:13:31 +08:00
Jean Perier 3d63d2111c [flang] Do not pass derived type by descriptor when not needed
A missing "!" in the call interface lowering caused all derived type
arguments without length parameters that require and explicit interface
to be passed via fir.box (runtime descriptor).

This was not the intent: there is no point passing a simple derived type
scalars or explicit shapes by descriptor just because they have an attribute
like TARGET. This would actually be problematic with existing code that is
not always 100% compliant: some code implicitly calls procedures with
TARGET dummy attributes (this is not something a compiler can enforce
if the call and procedure definition are not in the same file).

Add a Scope::IsDerivedTypeWithLengthParameter to avoid passing derived
types with only kind parameters by descriptor. There is no point, the
callee knows about the kind parameter values.

Differential Revision: https://reviews.llvm.org/D123990
2022-04-20 10:00:34 +02:00
Konrad Kleine d46fa023ca [clang-format] SortIncludes should support "@import" lines in Objective-C
Fixes [[ https://github.com/llvm/llvm-project/issues/38995 | #38995 ]]

This is an attempt to modify the regular expression to identify
`@import` and `import` alongside the regular `#include`. The challenging
part was not to support `@` in addition to `#` but how to handle
everything that comes after the `include|import` keywords. Previously
everything that wasn't `"` or `<` was consumed. But as you can see in
this example from the issue #38995, there is no `"` or `<` following the
keyword:

```
@import Foundation;
```

I experimented with a lot of fancy and useful expressions in [this
online regex tool](https://regex101.com) only to find out that some
things are simply not supported by the regex implementation in LLVM.

 * For example the beginning `[\t\ ]*` should be replacable by the
   horizontal whitespace character `\h*` but this will break the
   `SortIncludesTest.LeadingWhitespace` test.

That's why I've chosen to come back to the basic building blocks.

The essential change in this patch is the change from this regular
expression:

```
^[\t\ ]*#[\t\ ]*(import|include)[^"<]*(["<][^">]*[">])
        ~                              ~~~~~~~~~~~~~~
        ^                              ^
        |                              |
        only support # prefix not @    |
                                       only support "" and <> as
delimiters
                                       no support for C++ modules and ;
                                       ending. Also this allows for ">
                                       or <" or "" or <> which all seems
                                       either off or wrong.
```

to this:

```
^[\t\ ]*[@#][\t\ ]*(import|include)([^"]*("[^"]+")|[^<]*(<[^>]+>)|[\t\
]*([^;]+;))
        ~~~~                        ~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~
~~~~~~~~~~~~~~
        ^                                 ^           ^       ^       ^
        |                                 |           |       |       |
        Now support @ and #.            Clearly support "" and <> as
well as an
                                        include name without enclosing
characters.
                                        Allows for no mixture of "> or
<" or
                                        empty include names.

```

Here is how I've tested this patch:

```
ninja clang-Format
ninja FormatTests
./tools/clang/unittests/Format/FormatTests
--gtest_filter=SortIncludesTest*
```

And if that worked I doubled checked that nothing else broke by running
all format checks:

```
./tools/clang/unittests/Format/FormatTests
```

One side effect of this change is it should partially support
[C++20 Module](https://en.cppreference.com/w/cpp/language/modules)
`import` lines without the optional `export` in front. Adding
this can be a change on its own that shouldn't be too hard. I say
partially because the `@` or `#` are currently *NOT* optional in the
regular expression.

I see an opportunity to optimized the matching to exclude `@include` for
example. But eventually these should be caught by the compiler, so...

With my change, the matching group is not at a fixed position any
longer. I decided to
choose the last match (group) that is not empty.

Reviewed By: HazardyKnusperkeks

Differential Revision: https://reviews.llvm.org/D121370
2022-04-20 07:03:35 +00:00