platform/upstream/llvm.git
2 years ago[NFC] [Coroutines] Fix incorrect use of coroutine intrinsics
Chuanqi Xu [Tue, 4 Jan 2022 03:12:17 +0000 (11:12 +0800)]
[NFC] [Coroutines] Fix incorrect use of coroutine intrinsics

The inlined llvm.coro.id should contain the function it refers to.
The modifed test would caused the compiler crash under O2. See
issue52912 for example.

2 years ago[MLIR[PDL] NFC. Fix unused variable warning in PDLToPDLInterp.cpp
Uday Bondhugula [Tue, 4 Jan 2022 02:54:14 +0000 (08:24 +0530)]
[MLIR[PDL] NFC. Fix unused variable warning in PDLToPDLInterp.cpp

NFC. Fix unused variable warning in PDLToPDLInterp.cpp.

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

2 years ago[MLIR] Printing a null Value.
Stanislav Funiak [Tue, 4 Jan 2022 02:42:51 +0000 (08:12 +0530)]
[MLIR] Printing a null Value.

This diff adds support to printing a Value when it is null. We encounter this situation when debugging the PDL bytcode execution (where a null Value is perfectly valid). Currently, the AsmPrinter crashes (with an assert in a cast) when it encounters such Value.

We follow the same format used in other printed entities (e.g., null attribute).

Reviewed By: mehdi_amini, bondhugula

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

2 years ago[MLIR][PDL] Generalize result type verification
Stanislav Funiak [Tue, 4 Jan 2022 02:41:35 +0000 (08:11 +0530)]
[MLIR][PDL] Generalize result type verification

Presently the result type verification checks if the type is used by a `pdl::OperationOp` inside the matcher. This is unnecessarily restrictive; the type could come from a `pdl::OperandOp or `pdl::OperandsOp` and still be inferrable.

Reviewed By: rriddle, Mogball

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

2 years ago[MLIR][PDL] Integration test of multi-root matching and related fixes.
Stanislav Funiak [Tue, 4 Jan 2022 02:33:29 +0000 (08:03 +0530)]
[MLIR][PDL] Integration test of multi-root matching and related fixes.

This diff adds an integration test to multi-root PDL matching. It consists of two subtests:
1) A 1-layer perceptron with split forward / backward operations.
2) A 2-layer perceptron with fused forward / backward operations.

These tests use a collection of hand-written patterns and TensorFlow operations to be matched. The first test has a DAG / SSA dominant resulting match; the second does not and is therefore stored in a graph region.

This diff also includes two bug fixes:
1) Mark the pdl_interp dialect as a dependent in the TestPDLByteCodePass. This is needed, because we create ops from that dialect as a part of the PDL-to-PDLInterp lowering.
2) Fix of the starting index in the liveness range for the ForEach operations (bug exposed by the integration test).

Reviewed By: Mogball

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

2 years ago[MLIR][PDL] Make predicate order deterministic.
Stanislav Funiak [Tue, 4 Jan 2022 02:33:26 +0000 (08:03 +0530)]
[MLIR][PDL] Make predicate order deterministic.

The tree merging of pattern predicates places the predicates in an unordered set. When the predicates are sorted, they are taken in the set order, not the insertion order. This results in nondeterministic behavior.

One solution to this problem would be to use `SetVector`. However, the value `SetVector` does not provide a `find` function for fast O(1) lookups and stores the predicates twice -- once in the set and once in the vector, which is undesirable, because we store patternToAnswer in each predicate. A simpler solution is to store the tie breaking ID (which follows the insertion order), and use this ID to break any ties when comparing predicates.

Reviewed By: Mogball

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

2 years ago[MLIR][PDL] Refactor the positions for multi-root patterns.
Stanislav Funiak [Tue, 4 Jan 2022 02:33:18 +0000 (08:03 +0530)]
[MLIR][PDL] Refactor the positions for multi-root patterns.

When the original version of multi-root patterns was reviewed, several improvements were made to the pdl_interp operations during the review process. Specifically, the "get users of a value at the specified operand index" was split up into "get users" and "compare the users' operands with that value". The iterative execution was also cleaned up to `pdl_interp.foreach`. However, the positions in the pdl-to-pdl_interp lowering were not similarly refactored. This introduced several problems, including hard-to-detect bugs in the lowering and duplicate evaluation of `pdl_interp.get_users`.

This diff cleans up the positions. The "upward" `OperationPosition` was split-out into `UsersPosition` and `ForEachPosition`, and the operand comparison was replaced with a simple predicate. In the process, I fixed three bugs:
1. When multiple roots were had the same connector (i.e., a node that they shared with a subtree at the previously visited root), we would generate a single foreach loop rather than one foreach loop for each such root. The reason for this is that such connectors shared the position. The solution for this is to add root index as an id to the newly introduced `ForEachPosition`.
2. Previously, we would use `pdl_interp.get_operands` indiscriminately, whether or not the operand was variadic. We now correctly detect variadic operands and insert `pdl_interp.get_operand` when needed.
3. In certain corner cases, we would trigger the "connector has not been traversed yet" assertion. This was caused by not inserting the values during the upward traversal correctly. This has now been fixed.

Reviewed By: Mogball

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

2 years ago[M68k][NFC] Fix file header
Jim Lin [Tue, 4 Jan 2022 02:14:01 +0000 (10:14 +0800)]
[M68k][NFC] Fix file header

Let all file header have the same style. NFC.

2 years ago[llvm-readobj][test] Rename ELF/reloc-types-elf-*.test to avoid redundant "elf-"...
Fangrui Song [Tue, 4 Jan 2022 01:24:54 +0000 (17:24 -0800)]
[llvm-readobj][test] Rename ELF/reloc-types-elf-*.test to avoid redundant "elf-" infix

2 years ago[lldb] Use std::move in StringList (NFC)
Dave Lee [Sun, 2 Jan 2022 22:35:52 +0000 (14:35 -0800)]
[lldb] Use std::move in StringList (NFC)

2 years ago[mlir][LLVM] Fix mapping of result values of `llvm.invoke` during export
Markus Böck [Mon, 3 Jan 2022 22:45:26 +0000 (23:45 +0100)]
[mlir][LLVM] Fix mapping of result values of `llvm.invoke` during export

The result value of a llvm.invoke operation is currently not mapped to the corresponding llvm::Value* when exporting to LLVM IR. This leads to any later operations using the result to crash as it receives a nullptr.

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

2 years ago[mlir] NFC - Format ExecutionEngine.cpp
Nicolas Vasilache [Mon, 3 Jan 2022 22:17:11 +0000 (17:17 -0500)]
[mlir] NFC - Format ExecutionEngine.cpp

2 years agoRevert "[clang-format][NFC] Prefer pass by reference"
Björn Schäpers [Sun, 5 Dec 2021 11:31:56 +0000 (12:31 +0100)]
Revert "[clang-format][NFC] Prefer pass by reference"

This reverts commit 25f637913fe31b6d23e78ff07c725bb537dd3b97.

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

2 years ago[clang-format][NFC] Merge another two calls to isOneOf
Björn Schäpers [Fri, 3 Dec 2021 15:37:02 +0000 (16:37 +0100)]
[clang-format][NFC] Merge another two calls to isOneOf

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

2 years ago[clang-format][NFC] Code Tidies in UnwrappedLineFormatter
Björn Schäpers [Fri, 3 Dec 2021 07:13:57 +0000 (08:13 +0100)]
[clang-format][NFC] Code Tidies in UnwrappedLineFormatter

* Give I[1] and I[-1] a name:
  - Easier to understand
  - Easier to debug (since you don't go through operator[] everytime)
* TheLine->First != TheLine->Last follows since last is a l brace and
  first isn't.
* Factor the check for is(tok::l_brace) out.
* Drop else after return.

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

2 years ago[lld][MinGW] Remove `--no-as-needed` from ignored flags
Markus Böck [Mon, 3 Jan 2022 22:00:39 +0000 (23:00 +0100)]
[lld][MinGW] Remove `--no-as-needed` from ignored flags

In the post commit discussion of https://reviews.llvm.org/D116484 it was concluded that `--no-as-needed` should not be ignored. `--as-needed` stays ignored as it is already the default behaviour on COFF, which cannot be changed.

2 years agoAdd IgnoreBaseInCopyConstructors to .clang-tidy
Kazu Hirata [Mon, 3 Jan 2022 21:41:32 +0000 (13:41 -0800)]
Add IgnoreBaseInCopyConstructors to .clang-tidy

gcc issues warnings on copy constructors that do not explicitly
initialize the base class.

2 years ago[libc++][CI] Don't install libc6-dev-i386 in the Docker image
Louis Dionne [Mon, 3 Jan 2022 20:44:36 +0000 (15:44 -0500)]
[libc++][CI] Don't install libc6-dev-i386 in the Docker image

We don't cross-compile to 32 bits in the CI anymore.

2 years ago[libc++][NFC] Fix comment for running Docker container
Louis Dionne [Mon, 3 Jan 2022 20:08:05 +0000 (15:08 -0500)]
[libc++][NFC] Fix comment for running Docker container

2 years ago[CMake] Use `LLVM_COMMON_CMAKE_UTILS` in runtimes just for clarity
John Ericson [Sat, 1 Jan 2022 07:03:31 +0000 (07:03 +0000)]
[CMake] Use `LLVM_COMMON_CMAKE_UTILS` in runtimes just for clarity

In D116472 we created conditionally defined variables for the tools to
unbreak the legacy build where they are in `llvm/tools`.

The runtimes are not tools, so that flexibility doesn't matter. Still,
it might be nice to define (unconditionally) and use the variable for
the runtimes simply to make the code a bit clearer and document what is
going on.

Also, consistently put project dirs at the beginning, not end of `CMAKE_MODULE_PATH`. This ensures they will properly shadow similarly named stuff that happens to be later on the path.

Reviewed By: mstorsjo, #libunwind, #libc, #libc_abi, ldionne

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

2 years ago[gn build] Port 6f6f88ffdae1
LLVM GN Syncbot [Mon, 3 Jan 2022 20:50:31 +0000 (20:50 +0000)]
[gn build] Port 6f6f88ffdae1

2 years ago[clang-format] Style to separate definition blocks
ksyx [Tue, 28 Dec 2021 15:01:26 +0000 (10:01 -0500)]
[clang-format] Style to separate definition blocks

This commit resolves GitHub issue #45895 (Bugzilla #46550), to
add or remove empty line between definition blocks including
namespaces, classes, structs, enums and functions.

Reviewed By: MyDeveloperDay, curdeius, HazardyKnusperkeks

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

2 years ago[clang-format] Add penalty for breaking after '('
G. Pery [Mon, 3 Jan 2022 19:55:13 +0000 (20:55 +0100)]
[clang-format] Add penalty for breaking after '('

My team has a vendetta against lines ending with an open parenthesis, thought it might be useful for others too 😊

Reviewed By: HazardyKnusperkeks, curdeius

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

2 years agoRevert "[unroll] Prune all but first copy of invariant exit"
Philip Reames [Mon, 3 Jan 2022 19:56:02 +0000 (11:56 -0800)]
Revert "[unroll] Prune all but first copy of invariant exit"

This reverts commit 9bd22595bad36cd19f5e7ae18ccd9f41cba29dc5.

Seeing some bot failures which look plausibly connected.  Revert while investigating/waiting for bots to stablize.

e.g. https://lab.llvm.org/buildbot#builders/36/builds/15933

2 years ago[ValueTracking][SelectionDAG] Rename ComputeMinSignedBits->ComputeMaxSignificantBits...
Craig Topper [Mon, 3 Jan 2022 19:13:25 +0000 (11:13 -0800)]
[ValueTracking][SelectionDAG] Rename ComputeMinSignedBits->ComputeMaxSignificantBits. NFC

This function returns an upper bound on the number of bits needed
to represent the signed value. Use "Max" to match similar functions
in KnownBits like countMaxActiveBits.

Rename APInt::getMinSignedBits->getSignificantBits. Keeping the old
name around to keep this patch size down. Will do a bulk rename as
follow up.

Rename KnownBits::countMaxSignedBits->countMaxSignificantBits.

Reviewed By: lebedev.ri, RKSimon, spatel

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

2 years agoRevert "[llvm] Remove redundant member initialization (NFC)"
Kazu Hirata [Mon, 3 Jan 2022 19:28:47 +0000 (11:28 -0800)]
Revert "[llvm] Remove redundant member initialization (NFC)"

This reverts commit fd4808887ee47f3ec8a030e9211169ef4fb094c3.

This patch causes gcc to issue a lot of warnings like:

  warning: base class ‘class llvm::MCParsedAsmOperand’ should be
  explicitly initialized in the copy constructor [-Wextra]

2 years agoSilence a "not all control paths return a value" warning; NFC
Aaron Ballman [Mon, 3 Jan 2022 19:18:45 +0000 (14:18 -0500)]
Silence a "not all control paths return a value" warning; NFC

2 years ago[clangd] Fix windows build after 478863ef58c7f7314e06
Sam McCall [Mon, 3 Jan 2022 19:17:20 +0000 (20:17 +0100)]
[clangd] Fix windows build after 478863ef58c7f7314e06

http://45.33.8.238/win/51774/step_4.txt

MS extension causes the wrong class to be friended.

2 years ago[CodeCompletion] Signature help for braced constructor calls
Sam McCall [Mon, 27 Dec 2021 19:42:11 +0000 (20:42 +0100)]
[CodeCompletion] Signature help for braced constructor calls

Implementation is based on the "expected type" as used for
designated-initializers in braced init lists. This means it can deduce the type
in some cases where it's not written:

  void foo(Widget);
  foo({ /*help here*/ });

Only basic constructor calls are in scope of this patch, excluded are:
 - aggregate initialization (no help is offered for aggregates)
 - initializer_list initialization (no help is offered for these constructors)

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

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

2 years ago[X86] Improve selection of the mov instruction in FrameLowering
Erik Desjardins [Mon, 3 Jan 2022 19:09:50 +0000 (11:09 -0800)]
[X86] Improve selection of the mov instruction in FrameLowering

MOV64ri results in a significantly longer encoding, and use of this
operator is fairly avoidable as we can always check the size of the
immediate we're using.

This is an updated version of D99045.

Co-authored-by: Simonas Kazlauskas <git@kazlauskas.me>
Reviewed By: craig.topper

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

2 years ago[X86] autogen segmented stacks tests (NFC)
Erik Desjardins [Mon, 3 Jan 2022 18:58:26 +0000 (10:58 -0800)]
[X86] autogen segmented stacks tests (NFC)

Reviewed By: craig.topper

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

2 years ago[clang-format] respect AfterEnum for enums
Michael Zimmermann [Mon, 3 Jan 2022 11:16:11 +0000 (12:16 +0100)]
[clang-format] respect AfterEnum for enums

There is some similar looking code in `TokenAnnotator.cpp` but given that I've
never worked on clang-format before I don't know what the purpose of that code
is and how it's related to `UnwrappedLineParser.cpp`.

Either way, it fixes clang-format with `BraceWrapping.AfterEnum=true` and
`AllowShortEnumsOnASingleLine=false` to behave like the documentation says.

Before this patch:
```
enum
{
  A,
  B
} myEnum;
```

After this patch:
```
enum {
  A,
  B
} myEnum;
```

According to the unittests which I had to modify this would change the LLVM
style. Please evaluate if you want to change the defaults or if you consider
the current style a bug.

Reviewed By: curdeius, HazardyKnusperkeks

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

2 years ago[CodeView] Remove unnecessary property that was commited by accident.
Alexandre Ganea [Sun, 2 Jan 2022 19:19:12 +0000 (14:19 -0500)]
[CodeView] Remove unnecessary property that was commited by accident.

2 years ago[MSVC] Silence -Wnon-virtual-dtor on DIA APIs
Alexandre Ganea [Mon, 3 Jan 2022 18:22:26 +0000 (13:22 -0500)]
[MSVC] Silence -Wnon-virtual-dtor on DIA APIs

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

2 years ago[clang][cmake] Rearrange top-level CMakeLists.txt for D116492
John Ericson [Sun, 2 Jan 2022 06:29:26 +0000 (06:29 +0000)]
[clang][cmake] Rearrange top-level CMakeLists.txt for D116492

In that revision, I make LLD match Clang in deprecating `llvm-config`.
This patch isn't to worthwhile on its own --- there isn't a sense in
which the new order is "better" in isolation --- but by putting the
steps that LLD also neeeds to do first, I make the diff between LLD and
Clang's top-level `CMakeLists.txt` very legible.

Longer term I hope:

 1. We can remove calling `llvm-config` altogether, and just go strait to
    finding the CMake config file. This is what Flang does, at least.

 2. Hopefully the diffable part is smaller then --- i.e. there is less
    duplicated boilerplate.

 3. Any duplicate boilerplate that remains can be factored out.

I didn't both trying to factor anything out in e.g. the top level common
CMake Utility modules because this deprecated-but-not-removed state is a
merely transitional.

Reviewed By: beanz

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

2 years ago[NFC][CMake] Add FOLDER to utility targets
Chris Bieneman [Mon, 3 Jan 2022 17:52:44 +0000 (11:52 -0600)]
[NFC][CMake] Add FOLDER to utility targets

As Visual Studio's CMake support is getting better and better the line
between IDE generator and non-IDE generators is blurring. Visual Studio
2019 and later have a very useful UI that can handle all of the various
targets we create, but if they are unsorted it is wildly unwieldy.

This change sorts the lit testsuite targets and per-component install
targets into folders, which are not generated for IDE generators but
are generated by default under Visual Studio's CMake + Ninja
integration.

2 years ago[AMDGPU] Use ComputeMinSignedBits and KnownBits::countMaxActiveBits to simplify some...
Craig Topper [Mon, 3 Jan 2022 18:09:50 +0000 (10:09 -0800)]
[AMDGPU] Use ComputeMinSignedBits and KnownBits::countMaxActiveBits to simplify some code. NFC

Reviewed By: RKSimon

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

2 years ago[SimplifyCFG] Make use of ComputeMinSignedBits and KnownBits::getBitWidth. NFC
Craig Topper [Mon, 3 Jan 2022 18:07:37 +0000 (10:07 -0800)]
[SimplifyCFG] Make use of ComputeMinSignedBits and KnownBits::getBitWidth. NFC

2 years ago[unroll] Prune all but first copy of invariant exit
Philip Reames [Mon, 3 Jan 2022 17:55:19 +0000 (09:55 -0800)]
[unroll] Prune all but first copy of invariant exit

If we have an exit which is controlled by a loop invariant condition and which dominates the latch, we know only the copy in the first unrolled iteration can be taken. All other copies are dead.

The change itself is pretty straight forward, but let me add two points of context:
* I'd have expected other transform passes to catch this after unrolling, but I'm seeing multiple examples where we get to the end of O2/O3 without simplifying.
* I'd like to do a stronger change which did CSE during unroll and accounted for invariant expressions (as defined by SCEV instead of trivial ones from LoopInfo), but that doesn't fit cleanly into the current code structure.

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

2 years agoRemove loop invariant exit conditions from tests in advance of D116496
Philip Reames [Mon, 3 Jan 2022 17:39:26 +0000 (09:39 -0800)]
Remove loop invariant exit conditions from tests in advance of D116496

Reviewer suggested this was more in spirit of the original tests.

2 years ago[libc++][CI] Temporarily disable several Linux jobs
Louis Dionne [Mon, 3 Jan 2022 17:27:04 +0000 (12:27 -0500)]
[libc++][CI] Temporarily disable several Linux jobs

There is an ongoing CI outage with our Linux nodes, so I temporarily
set up a couple of nodes. These nodes will be much slower than the
usual ones and there's only a few of them, so I am temporarily disabling
most of our CI to keep things working.

2 years agoSIGSEGV in ompt_tsan_dependences with for-ordered
RitanyaB [Mon, 3 Jan 2022 17:22:50 +0000 (11:22 -0600)]
SIGSEGV in ompt_tsan_dependences with for-ordered

Segmentation fault in ompt_tsan_dependences function due to an unchecked NULL pointer dereference is as follows:

```
ThreadSanitizer:DEADLYSIGNAL
==140865==ERROR: ThreadSanitizer: SEGV on unknown address 0x000000000050 (pc 0x7f217c2d3652 bp 0x7ffe8cfc7e00 sp 0x7ffe8cfc7d90 T140865)
==140865==The signal is caused by a READ memory access.
==140865==Hint: address points to the zero page.
/usr/bin/addr2line: DWARF error: could not find variable specification at offset 1012a
/usr/bin/addr2line: DWARF error: could not find variable specification at offset 133b5
/usr/bin/addr2line: DWARF error: could not find variable specification at offset 1371a
/usr/bin/addr2line: DWARF error: could not find variable specification at offset 13a58
#0 ompt_tsan_dependences(ompt_data_t*, ompt_dependence_t const*, int) /ptmp/bhararit/llvm-project/openmp/tools/archer/ompt-tsan.cpp:1004 (libarcher.so+0x15652)
#1 __kmpc_doacross_post /ptmp/bhararit/llvm-project/openmp/runtime/src/kmp_csupport.cpp:4280 (libomp.so+0x74d98)
#2 .omp_outlined. for_ordered_01.c:? (for_ordered_01.exe+0x5186cb)
#3 __kmp_invoke_microtask /ptmp/bhararit/llvm-project/openmp/runtime/src/z_Linux_asm.S:1166 (libomp.so+0x14e592)
#4 __kmp_invoke_task_func /ptmp/bhararit/llvm-project/openmp/runtime/src/kmp_runtime.cpp:7556 (libomp.so+0x909ad)
#5 __kmp_fork_call /ptmp/bhararit/llvm-project/openmp/runtime/src/kmp_runtime.cpp:2284 (libomp.so+0x8461a)
#6 __kmpc_fork_call /ptmp/bhararit/llvm-project/openmp/runtime/src/kmp_csupport.cpp:308 (libomp.so+0x6db55)
#7 main ??:? (for_ordered_01.exe+0x51828f)
#8 __libc_start_main ??:? (libc.so.6+0x24349)
#9 _start /home/abuild/rpmbuild/BUILD/glibc-2.26/csu/../sysdeps/x86_64/start.S:120 (for_ordered_01.exe+0x4214e9)

ThreadSanitizer can not provide additional info.
SUMMARY: ThreadSanitizer: SEGV /ptmp/bhararit/llvm-project/openmp/tools/archer/ompt-tsan.cpp:1004 in ompt_tsan_dependences(ompt_data_t*, ompt_dependence_t const*, int)
==140865==ABORTING
```

To reproduce the error, use the following openmp code snippet:

```
/* initialise  testMatrixInt Matrix, cols, r and c */
  #pragma omp parallel private(r,c) shared(testMatrixInt)
    {
      #pragma omp for ordered(2)
      for (r=1; r < rows; r++) {
        for (c=1; c < cols; c++) {
          #pragma omp ordered depend(sink:r-1, c+1) depend(sink:r-1,c-1)
          testMatrixInt[r][c] = (testMatrixInt[r-1][c] + testMatrixInt[r-1][c-1]) % cols ;
          #pragma omp ordered depend (source)
        }
      }
    }
```

Compilation:
```
clang -g -stdlib=libc++ -fsanitize=thread -fopenmp -larcher test_case.c
```

It seems like the changes introduced by the commit https://reviews.llvm.org/D114005 causes this particular SEGV while using Archer.

Reviewed By: protze.joachim

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

2 years ago[clangd] Basic IncludeCleaner support for c/c++ standard library
Sam McCall [Wed, 17 Nov 2021 12:27:58 +0000 (13:27 +0100)]
[clangd] Basic IncludeCleaner support for c/c++ standard library

There are some limitations here, so this is behind a flag for now (in addition
to the config setting for the overall feature).

- symbols without exactly one associated header aren't handled right
- no macro support
- referencing std::size_t usually doesn't leave any trace in the AST that the
  alias in std was used, so we associate with stddef.h instead of cstddef.
  (An AST issue not specific to stdlib, but much worse there)

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

2 years ago[gn build] Port fe68088d44f7
LLVM GN Syncbot [Mon, 3 Jan 2022 17:01:27 +0000 (17:01 +0000)]
[gn build] Port fe68088d44f7

2 years ago[clangd] Helper for determining member insertion point.
Sam McCall [Sun, 2 Jan 2022 22:22:18 +0000 (23:22 +0100)]
[clangd] Helper for determining member insertion point.

To be used in D116490 and D116385, and an upcoming patch to generate C++
constructors.

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

2 years ago[clangd] Respect .clang-tidy ExtraArgs (-Wfoo only) when producing diagnostics
Sam McCall [Wed, 22 Dec 2021 10:07:50 +0000 (11:07 +0100)]
[clangd] Respect .clang-tidy ExtraArgs (-Wfoo only) when producing diagnostics

This mechanism is used almost exclusively to enable extra warnings in clang-tidy
using ExtraArgs=-Wfoo, Checks="clang-diagnostic-foo".
Its presence is a strong signal that these flags are useful.

We choose not to actually emit them as clang-tidy diagnostics, but under their
"main" name - this ensures we show the same diagnostic in a consistent way.

We don't add the ExtraArgs to the compile command in general, but rather just
handle the -W<group> flags, which is the common case and avoids unexpected
side-effects.
And we only do this for the main file parse, when producing diagnostics.

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

2 years ago[clang] Pacify GCC warning. NFC.
Michael Liao [Mon, 3 Jan 2022 15:58:40 +0000 (10:58 -0500)]
[clang] Pacify GCC warning. NFC.

- This partially reverts d677a7cb056b17145a50ec8ca2ab6d5f4c494749 to
  pacify GCC warnings like
  ```
  base class should be explicitly initialized in the copy constructor
  ```
- Shall we keep turning on option `IgnoreBaseInCopyConstructors` when
  enabling `readability-redundant-member-init` check?

2 years ago[ARM][AArch64] clang support for Armv9.3-A
Tomas Matheson [Tue, 21 Dec 2021 16:22:44 +0000 (16:22 +0000)]
[ARM][AArch64] clang support for Armv9.3-A

This patch introduces support for targetting the Armv9.3-A architecture,
which should map to the existing Armv8.8-A extensions.

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

2 years ago [mlir] Remove unnecessary canonicalization from Linalg Detensorize.cpp
Alexander Belyaev [Mon, 3 Jan 2022 15:25:00 +0000 (16:25 +0100)]
 [mlir] Remove unnecessary canonicalization from Linalg Detensorize.cpp

After https://reviews.llvm.org/D115821 it became possible to create
`tensor<elem_type>` with a single `tensor.from_elements` operation without
collapsing tensor shape from `tensor<1xelem_type>` to `tensor<elem_type>`

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

2 years ago[CodeCompletion] Signature help for template argument lists
Sam McCall [Wed, 29 Dec 2021 03:16:47 +0000 (04:16 +0100)]
[CodeCompletion] Signature help for template argument lists

Provide signature while typing template arguments: Foo< ^here >
Here the parameters are e.g. "typename x", and the result type is e.g.
"struct" (class template) or "int" (variable template) or "bool (std::string)"
(function template).

Multiple overloads are possible when a template name is used for several
overloaded function templates.

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

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

2 years ago[gn build] Port a8ae6828a98d
LLVM GN Syncbot [Mon, 3 Jan 2022 15:14:39 +0000 (15:14 +0000)]
[gn build] Port a8ae6828a98d

2 years ago[lldb] Delete GDBRemoteCommunicationReplayServer
Pavel Labath [Mon, 3 Jan 2022 15:12:47 +0000 (16:12 +0100)]
[lldb] Delete GDBRemoteCommunicationReplayServer

This survived the reproducer deletion.

2 years ago[MLIR] Fix confusing diagnostic during dialect conversion
Uday Bondhugula [Wed, 22 Dec 2021 10:34:55 +0000 (16:04 +0530)]
[MLIR] Fix confusing diagnostic during dialect conversion

Fix confusing diagnostic during partial dialect conversion. A failure to
legalize is not the same as an operation being illegal: for eg. an
operation neither explicity marked legal nor explicitly marked illegal
could have been generated and may have failed to legalize further. The
op isn't an illegal one per
https://mlir.llvm.org/docs/DialectConversion/#conversion-target
which is an op that is explicitly marked illegal.

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

2 years ago[MLIR] Create add of sub folder
William S. Moses [Sat, 1 Jan 2022 05:39:49 +0000 (00:39 -0500)]
[MLIR] Create add of sub folder

Create folders for add(sub(a, b), b) -> a and add(b, sub(a, b)) -> a

Reviewed By: ftynse

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

2 years ago[lldb/qemu] Set qemu's "ld prefix" based on the platform sysroot
Pavel Labath [Mon, 3 Jan 2022 13:48:13 +0000 (14:48 +0100)]
[lldb/qemu] Set qemu's "ld prefix" based on the platform sysroot

Both serve the same purpose (finding shared libraries) and allow one to
launch a dynamically linked executable by just specifying the platform
sysroot.

2 years ago[lldb-server/linux] Fix waitpid for multithreaded forks
Pavel Labath [Wed, 29 Dec 2021 12:48:16 +0000 (13:48 +0100)]
[lldb-server/linux] Fix waitpid for multithreaded forks

The lldb-server code is currently set up in a way that each
NativeProcess instance does its own waitpid handling. This works fine
for BSDs, where the code can do a waitpid(process_id), and get
information for all threads in that process.

The situation is trickier on linux, because waitpid(pid) will only
return information for the main thread of the process (one whose tid ==
pid). For this reason the linux code does a waitpid(-1), to get
information for all threads. This was fine while we were supporting just
a single process, but becomes a problem when we have multiple processes
as they end up stealing each others events.

There are two possible solutions to this problem:
- call waitpid(-1) centrally, and then dispatch the events to the
  appropriate process
- have each process call waitpid(tid) for all the threads it manages

This patch implements the second approach. Besides fitting better into
the existing design, it also has the added benefit of ensuring
predictable ordering for thread/process creation events (which come in
pairs -- one for the parent and one for the child). The first approach
OTOH, would make this ordering even more complicated since we would
have to keep the half-threads hanging in mid-air until we find the
process we should attach them to.

The downside to this approach is an increased number of syscalls (one
waitpid for each thread), but I think we're pretty far from optimizing
things like this, and so the cleanliness of the design is worth it.

The included test reproduces the circumstances which should demonstrate
the bug (which manifests as a hung test), but I have not been able to
get it to fail. The only place I've seen this failure modes are very
rare hangs in the thread sanitizer tests (tsan forks an addr2line
process to produce its error messages).

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

2 years ago[CodeExtractor] Remove unnecessary explicit attribute handling (NFC)
Nikita Popov [Mon, 3 Jan 2022 13:11:56 +0000 (14:11 +0100)]
[CodeExtractor] Remove unnecessary explicit attribute handling (NFC)

The nounwind and uwtable attributes will get handled as part of
the loop below as well, there is no need to special-case them here.

2 years ago[clang-format] NFC update LLVM overall clang-formatted status
mydeveloperday [Mon, 3 Jan 2022 13:04:51 +0000 (13:04 +0000)]
[clang-format] NFC update LLVM overall clang-formatted status

A 1% increase in the number of clang-formatted files.

An additional 235 files have been added to LLVM, and an additional
268 files are now clang-format clean. Raising the overall % to 52%

There are now 8407 files clean out of 15902 (ignoring lit tests)

2 years ago[CodeExtractor] Separate function from param/ret attributes (NFC)
Nikita Popov [Mon, 3 Jan 2022 13:06:01 +0000 (14:06 +0100)]
[CodeExtractor] Separate function from param/ret attributes (NFC)

This list is confusing because it conflates functions attributes
(which are either extractable or not) and other attribute kinds,
which are simply irrelevant for this code.

2 years ago[IR] Allow the 'align' param attr on vectors of pointers
Fraser Cormack [Mon, 6 Dec 2021 15:49:23 +0000 (15:49 +0000)]
[IR] Allow the 'align' param attr on vectors of pointers

This patch extends the available uses of the 'align' parameter attribute
to include vectors of pointers. The attribute specifies pointer
alignment element-wise.

This change was previously requested and discussed in D87304.

The vector predication (VP) intrinsics intend to use this for scatter
and gather operations, as they lack the explicit alignment parameter
that the masked versions use.

Reviewed By: nikic

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

2 years ago[ARM][AArch64] Introduce Armv9.3-A
Lucas Prates [Thu, 2 Sep 2021 15:12:55 +0000 (16:12 +0100)]
[ARM][AArch64] Introduce Armv9.3-A

This patch introduces support for targetting the Armv9.3-A architecture,
which should map to the existing Armv8.8-A extensions.

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

2 years ago[AArch64] Adding "armv8.8-a" BC instruction.
Simon Tatham [Thu, 11 Feb 2021 11:19:44 +0000 (11:19 +0000)]
[AArch64] Adding "armv8.8-a" BC instruction.

This instruction is described in the Arm A64 Instruction Set
Architecture documentation available here:
https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/BC-cond--Branch-Consistent-conditionally-?lang=en

FEAT_HBC "Hinted Conditional Branches" is listed in the 2021 A-Profile Architecture Extensions:
https://developer.arm.com/architectures/cpu-architecture/a-profile/exploration-tools/feature-names-for-a-profile

'BC.cc', where 'cc' is any ordinary condition code, is an instruction
that looks exactly like B.cc (the normal conditional branch), except
that bit 4 of the encoding is 1 rather than 0, which hints something
to the branch predictor (specifically, that this branch is expected to
be highly consistent, even though _which way_ it will consistently go
is not known at compile time).

This commit introduces a special subtarget feature for HBC, which is a
dependency of the top-level 8.8-A feature, and uses that to enable the
new BC instruction.

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

2 years ago[clang-format] spacesRequiredBetween is not honouring clang-format off/on
mydeveloperday [Mon, 3 Jan 2022 11:19:02 +0000 (11:19 +0000)]
[clang-format] spacesRequiredBetween is not honouring clang-format off/on

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

It seems that clang-format off/on is not being honoured in regard to adding spaces.

My understanding of clang-format off/on is that it marks the token as finalized based on whether formatting is currently enabled or disabled.

This was causing a space to be added between the `<` and `<<`  in the Cuda kernel `foo<<<1, 1>>>();`

This if doesn't solve this actual issue but ensure that clang-format is at least honoured.

Reviewed By: curdeius, owenpan

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

2 years ago[MLIR] Remove dependency on IR for Simplex
Groverkss [Mon, 3 Jan 2022 10:53:07 +0000 (16:23 +0530)]
[MLIR] Remove dependency on IR for Simplex

This patch removes unnecessary dependency on IR for Simplex. This patch allows
users to use Presburger library without depending on MLIRIR.

Reviewed By: ftynse

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

2 years ago[clang-format][NFC] Correct comment about checking merging of blocks
Gabriel Smith [Mon, 3 Jan 2022 10:50:31 +0000 (11:50 +0100)]
[clang-format][NFC] Correct comment about checking merging of blocks

Reviewed By: HazardyKnusperkeks, MyDeveloperDay, owenpan

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

2 years ago[clang-format] Add option to explicitly specify a config file
Zhao Wei Liew [Mon, 3 Jan 2022 10:37:20 +0000 (11:37 +0100)]
[clang-format] Add option to explicitly specify a config file

This diff extends the -style=file option to allow a config file to be specified explicitly. This is useful (for instance) when adding IDE commands to reformat code to a personal style.

Usage: `clang-format -style=file:<path/to/config/file> ...`

Reviewed By: HazardyKnusperkeks, curdeius, MyDeveloperDay, zwliew

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

2 years ago[clang-format] Support inheriting from more than 1 parents in the fallback case
Zhao Wei Liew [Mon, 3 Jan 2022 10:30:24 +0000 (11:30 +0100)]
[clang-format] Support inheriting from more than 1 parents in the fallback case

Currently, we are unable to inherit from a chain of parent configs where the outermost parent config has `BasedOnStyle: InheritParentConfig` set. This patch adds a test case for this scenario, and adds support for it.

To illustrate, suppose we have the following directory structure:
```
- e/
  |- .clang-format (BasedOnStyle: InheritParentConfig) <-- outermost config
  |- sub/
    |- .clang-format (BasedOnStyle: InheritParentConfig)
    |- sub/
      |- .clang-format (BasedOnStyle: InheritParentConfig)
      |- code.cpp
```
Now consider what happens when we run `clang-format --style=file /e/sub/sub/code.cpp`.

Without this patch, on a release build, only the innermost config will be applied. On a debug build, clang-format crashes due to an assertion failure.
With this patch, clang-format behaves as we'd expect, applying all 3 configs.

Reviewed By: HazardyKnusperkeks, curdeius

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

2 years ago[LV] Set loop metadata after VPlan execution (NFC).
Florian Hahn [Mon, 3 Jan 2022 09:59:39 +0000 (09:59 +0000)]
[LV] Set loop metadata after VPlan execution (NFC).

Setting the loop metadata for the vector loop after VPlan execution
allows generating the full loop body during VPlan execution. This is in
preparation for D113224.

2 years ago[LoadStoreVectorizer] Check for guaranteed-to-transfer (PR52950)
Nikita Popov [Mon, 3 Jan 2022 09:55:47 +0000 (10:55 +0100)]
[LoadStoreVectorizer] Check for guaranteed-to-transfer (PR52950)

Rather than checking for nounwind in particular, make sure the
instruction is guaranteed to transfer execution, which will also
handle non-willreturn calls correctly.

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

2 years ago[ConstantFold] Drop unused function (NFC)
Nikita Popov [Mon, 3 Jan 2022 09:14:00 +0000 (10:14 +0100)]
[ConstantFold] Drop unused function (NFC)

isMaybeZeroSizeType() is no longer used after
5afbfe33e7d6ce40af0ad6d99421b443c45b351b.

2 years ago[RISCV] Fix the code alignment for GroupFloatVectors. NFC
Jim Lin [Mon, 3 Jan 2022 07:03:55 +0000 (15:03 +0800)]
[RISCV] Fix the code alignment for GroupFloatVectors. NFC

Reviewed By: craig.topper

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

2 years ago[clang-format] Use get*StyleWithColumns helper. NFC.
Marek Kurdej [Mon, 3 Jan 2022 08:40:24 +0000 (09:40 +0100)]
[clang-format] Use get*StyleWithColumns helper. NFC.

2 years ago[ConstantFold] Make icmp of gep fold offset based
Nikita Popov [Tue, 28 Dec 2021 11:27:04 +0000 (12:27 +0100)]
[ConstantFold] Make icmp of gep fold offset based

We can fold an equality or unsigned icmp between base+offset1 and
base+offset2 with inbounds offsets by comparing the offsets directly.

This replaces a pair of specialized folds that tried to reason
based on the GEP structure instead. One of those folds was plain
wrong (because it does not account for negative offsets), while
the other is unnecessarily complicated and limited (e.g. it will
fail with bitcasts involved).

The disadvantage of this change is that it requires data layout,
so the fold is no longer performed by datalayout-independent
constant folding. I don't think this is a loss in practice, but
it does regress the ConstantExprFold.ll test, which checks folding
without running any passes.

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

2 years ago[DSE] Fix DSE test to use non-extern global (NFC)
Nikita Popov [Mon, 3 Jan 2022 08:38:04 +0000 (09:38 +0100)]
[DSE] Fix DSE test to use non-extern global (NFC)

The intended transform is not legal with an extern global, because
the actual global defined in a different TU might have larger
size. Make it non-extern to show that the desired transform already
works.

2 years ago[DSE] Check for whole object overwrite even if dead store size not known
Nikita Popov [Fri, 24 Dec 2021 11:09:38 +0000 (12:09 +0100)]
[DSE] Check for whole object overwrite even if dead store size not known

If the killing store overwrites the whole object, we know that the
preceding store is dead, regardless of the accessed offset or size.
This case was previously only handled if the size of the dead store
was also known.

This allows us to perform conventional DSE for calls that write to
an argument (but without known size).

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

2 years ago[NFC][sanitizer] Allow madvise in symbolizer
Vitaly Buka [Mon, 3 Jan 2022 08:34:20 +0000 (00:34 -0800)]
[NFC][sanitizer] Allow madvise in symbolizer

2 years ago[clang-format] [docs] Fix Mozilla coding style URL.
Marek Kurdej [Mon, 3 Jan 2022 08:10:37 +0000 (09:10 +0100)]
[clang-format] [docs] Fix Mozilla coding style URL.

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

2 years ago[llvm] Fix namespace comments (NFC)
Kazu Hirata [Mon, 3 Jan 2022 07:59:52 +0000 (23:59 -0800)]
[llvm] Fix namespace comments (NFC)

Identified with llvm-namespace-comment.

2 years ago[llvm][cmake] Normalize some indent
John Ericson [Mon, 3 Jan 2022 01:29:39 +0000 (01:29 +0000)]
[llvm][cmake] Normalize some indent

- Change a stray tab to spaces

- 4 not 2 spaces in second line of `set` like above.

Reviewed By: mstorsjo

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

2 years ago[Support] Add KnownBits::countMaxSignedBits(). Make KnownBits::countMinSignBits(...
Craig Topper [Mon, 3 Jan 2022 07:20:32 +0000 (23:20 -0800)]
[Support] Add KnownBits::countMaxSignedBits(). Make KnownBits::countMinSignBits() always return at least 1.

Even if we don't have any known bits, we can assume that there is
at least 1 sign bit. This is consistent with ComputeNumSignBits
which always returns at least 1.

Add KnownBits::countMaxSignedBits() which computes the number of
bits needed to represent all signed values with those known bits.
This is the signed equivalent of countMaxActiveBits().

Split from D116469.

Reviewed By: lebedev.ri

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

2 years ago[RISCV][VP] Add RVV codegen for [nX]vXi1 vp.select
Victor Perez [Mon, 3 Jan 2022 07:12:06 +0000 (23:12 -0800)]
[RISCV][VP] Add RVV codegen for [nX]vXi1 vp.select

Expand [nX]vXi1 vp.select the same way as [nX]vXi1 vselect.

Reviewed By: craig.topper

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

2 years ago[Transform] Remove redundant declaration PollyAllowFullFunction (NFC)
Kazu Hirata [Mon, 3 Jan 2022 07:08:40 +0000 (23:08 -0800)]
[Transform] Remove redundant declaration PollyAllowFullFunction (NFC)

The variable is declared in ScopDetection.h, which ScopInliner.cpp
includes.

Identified by readability-redundant-declaration.

2 years ago[RISCV] Prune more unnecessary vector pseudo instructions. NFC
Craig Topper [Mon, 3 Jan 2022 07:00:09 +0000 (23:00 -0800)]
[RISCV] Prune more unnecessary vector pseudo instructions. NFC

For floating point specific vector instructions, we don't need
pseudos for mf8.

Reviewed By: khchen

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

2 years agoFix doc on how to run clang-tidy on MLIR codebase (NFC)
Mehdi Amini [Mon, 3 Jan 2022 06:58:45 +0000 (06:58 +0000)]
Fix doc on how to run clang-tidy on MLIR codebase (NFC)

2 years ago[Transforms] Use all_of instead of any_of (NFC)
Kazu Hirata [Mon, 3 Jan 2022 06:53:09 +0000 (22:53 -0800)]
[Transforms] Use all_of instead of any_of (NFC)

2 years ago[API] Remove redundant member initialization (NFC)
Kazu Hirata [Mon, 3 Jan 2022 06:44:15 +0000 (22:44 -0800)]
[API] Remove redundant member initialization (NFC)

Identified with readability-redundant-member-init.

2 years agoRevert "Define a `cppAccessorType` to const-ref in APFloatParameter and update ODS...
Mehdi Amini [Mon, 3 Jan 2022 06:31:44 +0000 (06:31 +0000)]
Revert "Define a `cppAccessorType` to const-ref in APFloatParameter and update ODS emitter to use it for verifier signatures"

This reverts commit 89af17c0c74eb9d8d11870f6510e475eff74eef4.

This broke the gcc5 build.

2 years ago[MLIR] Canonicalize/fold select %x, 1, 0 to extui
William S. Moses [Mon, 3 Jan 2022 04:49:29 +0000 (23:49 -0500)]
[MLIR] Canonicalize/fold select %x, 1, 0 to extui

Two canonicalizations for select %x, 1, 0
  If the return type is i1, return simply the condition %x, otherwise extui %x to the return type.

Reviewed By: mehdi_amini

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

2 years ago[MLIR][Arith] Canonicalize and/or with ext
William S. Moses [Mon, 3 Jan 2022 05:38:41 +0000 (00:38 -0500)]
[MLIR][Arith] Canonicalize and/or with ext

Replace and(ext(a),ext(b)) with ext(and(a,b)). This both reduces one instruction, and results in the computation (and/or) being done on a smaller type.

Reviewed By: mehdi_amini

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

2 years agoAdd back missing return to non-void function
Mehdi Amini [Mon, 3 Jan 2022 06:18:25 +0000 (06:18 +0000)]
Add back missing return to non-void function

It was incorrectly removed accidentally in e4e463e7476.

2 years agoRemove misused RAII gil_scoped_release/gil_scoped_acquire: without name they don...
Mehdi Amini [Mon, 3 Jan 2022 06:17:00 +0000 (06:17 +0000)]
Remove misused RAII gil_scoped_release/gil_scoped_acquire: without name they don't have any effect

I'm not sure what is the right fix here, but adding a name to all these
lead to many segfaults.

Reviewed By: stellaraccident

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

2 years ago[MLIR][NFC] Fix clang-tidy errors in Analysis/Presburger/
Groverkss [Mon, 3 Jan 2022 06:06:35 +0000 (11:36 +0530)]
[MLIR][NFC] Fix clang-tidy errors in Analysis/Presburger/

This patch fixes clang-tidy errors related to different parameter names
in header file and source file in Analysis/Presburger/ directory.

2 years agoUse cast<> instead of dyn_cast<> when we don't check the result (NFC)
Mehdi Amini [Mon, 3 Jan 2022 06:06:36 +0000 (06:06 +0000)]
Use cast<> instead of dyn_cast<> when we don't check the result (NFC)

2 years agoRemove dead return after return (NFC)
Mehdi Amini [Mon, 3 Jan 2022 06:03:34 +0000 (06:03 +0000)]
Remove dead return after return (NFC)

2 years agoRemove useless nesting blok and dead return statement in TosaToLinalg.cpp (NFC)
Mehdi Amini [Mon, 3 Jan 2022 06:02:21 +0000 (06:02 +0000)]
Remove useless nesting blok and dead return statement in TosaToLinalg.cpp (NFC)

Flagged by Coverity.

2 years agoMinor reflow of FloorDivSIOp/CeilDivSIOp folder to limit the number of APInt API...
Mehdi Amini [Mon, 3 Jan 2022 05:51:35 +0000 (05:51 +0000)]
Minor reflow of FloorDivSIOp/CeilDivSIOp folder to limit the number of APInt API calls (NFC)

Cache the result of the comparison in boolean, and check early for 0 to
leverage `(a < 0) == !(a > 0)`.

2 years ago[MLIR] Move LinearTransform to Presburger/
Groverkss [Mon, 3 Jan 2022 05:40:14 +0000 (11:10 +0530)]
[MLIR] Move LinearTransform to Presburger/

This patch moves LinearTransform to Presburger/ and makes it use
IntegerPolyhedron instead of FlatAffineConstraints. Also modifies its usage in
`FlatAffineConstraints::findIntegerSample` to support the changes.

This patch is part of a series of patches for moving presburger math functionality into Presburger directory.

Reviewed By: arjunp

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

2 years ago[MLIR] Create folders for extsi/extui
William S. Moses [Mon, 3 Jan 2022 03:06:57 +0000 (22:06 -0500)]
[MLIR] Create folders for extsi/extui

Create folders/canonicalizers for extsi/extui. Specifically,

extui(extui(x)) -> extui(x)
extsi(extsi(x)) -> extsi(x)
extsi(extui(x)) -> extui(x)

Reviewed By: mehdi_amini

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

2 years agoDefine a `cppAccessorType` to const-ref in APFloatParameter and update ODS emitter...
Mehdi Amini [Mon, 3 Jan 2022 04:56:08 +0000 (04:56 +0000)]
Define a `cppAccessorType` to const-ref in APFloatParameter and update ODS emitter to use it for verifier signatures

This reduce an unnecessary amount of copy of non-trivial objects, like
APFloat.

Reviewed By: rriddle, jpienaar

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

2 years agoAdd a script to run clang-tidy on the entire MLIR codebase
Mehdi Amini [Mon, 3 Jan 2022 04:53:10 +0000 (04:53 +0000)]
Add a script to run clang-tidy on the entire MLIR codebase