platform/upstream/llvm.git
2 years ago[mlir] Relax restriction on name location parsing
Jacques Pienaar [Sun, 12 Dec 2021 16:06:59 +0000 (08:06 -0800)]
[mlir] Relax restriction on name location parsing

We currently restrict parsing of location to not allow nameloc being
nested inside nameloc. This restriction may be historical as there
doesn't seem to be a reason for it anymore (locations like this can be
constructed in C++ and they print fine). Relax this restriction in the
parser to allow this nesting.

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

2 years ago[mlir] Flag near misses in file splitting
Jacques Pienaar [Sun, 12 Dec 2021 16:03:30 +0000 (08:03 -0800)]
[mlir] Flag near misses in file splitting

Flags some potential cases where splitting isn't happening and so could result
in confusing results. Also update some test files where there were near misses
in splitting that seemed unintentional.

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

2 years agoMicrosoft's floating-point to_chars powered by Ryu and Ryu Printf
Mark de Wever [Tue, 9 Feb 2021 16:52:41 +0000 (17:52 +0100)]
Microsoft's floating-point to_chars powered by Ryu and Ryu Printf

Microsoft would like to contribute its implementation of floating-point to_chars to libc++. This uses the impossibly fast Ryu and Ryu Printf algorithms invented by Ulf Adams at Google. Upstream repos: https://github.com/microsoft/STL and https://github.com/ulfjack/ryu .

Licensing notes: MSVC's STL is available under the Apache License v2.0 with LLVM Exception, intentionally chosen to match libc++. We've used Ryu under the Boost Software License.

This patch contains minor changes from Jorg Brown at Google, to adapt the code to libc++. He verified that it works in Google's Linux-based environment, but then I applied more changes on top of his, so any compiler errors are my fault. (I haven't tried to build and test libc++ yet.) Please tell me if we need to do anything else in order to follow https://llvm.org/docs/DeveloperPolicy.html#attribution-of-changes .

Notes:

* libc++'s integer charconv is unchanged (except for a small refactoring). MSVC's integer charconv hasn't been tuned for performance yet, so you're not missing anything.
* Floating-point from_chars isn't part of this patch because Jorg found that MSVC's implementation (derived from our CRT's strtod) was slower than Abseil's. If you're unable to use Abseil or another implementation due to licensing or technical considerations, Microsoft would be delighted if you used MSVC's from_chars (and you can just take it, or ask us to provide a patch like this). Ulf is also working on a novel algorithm for from_chars.
* This assumes that float is IEEE 32-bit, double is IEEE 64-bit, and long double is also IEEE 64-bit.
* I have added MSVC's charconv tests (the whole thing: integer/floating from_chars/to_chars), but haven't adapted them to libcxx's harness at all. (These tests will be available in the microsoft/STL repo soon.)
* Jorg added int128 codepaths. These were originally present in upstream Ryu, and I removed them from microsoft/STL purely for performance reasons (MSVC doesn't support int128; Clang on Windows does, but I found that x64 intrinsics were slightly faster).
* The implementation is split into 3 headers. In MSVC's STL, charconv contains only Microsoft-written code. xcharconv_ryu.h contains code derived from Ryu (with significant modifications and additions). xcharconv_ryu_tables.h contains Ryu's large lookup tables (they were sufficiently large to make editing inconvenient, hence the separate file). The xmeow.h convention is MSVC's for internal headers; you may wish to rename them.
* You should consider separately compiling the lookup tables (see https://github.com/microsoft/STL/issues/172 ) for compiler throughput and reduced object file size.
* See https://github.com/StephanTLavavej/llvm-project/commits/charconv for fine-grained history. (If necessary, I can perform some rebase surgery to show you what Jorg changed relative to the microsoft/STL repo; currently that's all fused into the first commit.)

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

2 years ago[X86][AVX512] Use WriteShuffleX for xmm->xmm extensions
Simon Pilgrim [Sun, 12 Dec 2021 15:22:32 +0000 (15:22 +0000)]
[X86][AVX512] Use WriteShuffleX for xmm->xmm extensions

The XMM evex cases have the same behaviour as the SSE41 versions, which already uses WriteShuffleX

2 years ago[mlir][Vector] Support 0-D vectors in `CreateMaskOp`
Nicolas Vasilache [Sun, 12 Dec 2021 13:32:26 +0000 (13:32 +0000)]
[mlir][Vector] Support 0-D vectors in `CreateMaskOp`

The 0-D case gets lowered in almost the same way that the 1-D case does
in VectorCreateMaskOpConversion. I also had to slightly update the
verifier for the op to always require exactly 1 operand in the 0-D case.

Depends On D115220

Reviewed by: ftynse

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

2 years ago[mlir][Vector] Support 0-D vectors in `CmpIOp`
Michal Terepeta [Sun, 12 Dec 2021 11:44:04 +0000 (11:44 +0000)]
[mlir][Vector] Support 0-D vectors in `CmpIOp`

Following the example of `VectorOfAnyRankOf`, I've done a few changes in the
`.td` files to help with adding the support for the 0-D case gradually.

Reviewed By: ftynse

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

2 years ago[X86][AVX512] Use WriteVPMOV256 sched class for all truncations/extensions.
Simon Pilgrim [Sun, 12 Dec 2021 13:24:26 +0000 (13:24 +0000)]
[X86][AVX512] Use WriteVPMOV256 sched class for all truncations/extensions.

At the moment these are identical to WriteShuffle256 (which we were using), but it should be WriteVPMOV256 to match the AVX2 instruction, plus it will help us remove some unnecessary overrides by tweaking the WriteVPMOV256 class.

Also, as D115547 shows, we still need to split off 128-bit extensions/truncations sched classes to remove some other overrides.

2 years ago[MLIR] PresburgerSet subtraction: fix bug where the set `b` was not restored properly...
Arjun P [Sat, 11 Dec 2021 12:42:08 +0000 (18:12 +0530)]
[MLIR] PresburgerSet subtraction: fix bug where the set `b` was not restored properly on return

When subtracting `b \ c`, when there are divisions in `c`, these division
constraints get added to `b`. `b` must be restored to its original state
when returning, but these added divisions constraints were not removed in
one of the return paths. This patch fixes this and deduplicates the
restoration logic by encapuslating it in a lambda `restoreState`. The patch
also includes a regression test for the bug fix.

Reviewed By: Groverkss

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

2 years agoVersion bump
Anton Korobeynikov [Sun, 12 Dec 2021 09:58:52 +0000 (12:58 +0300)]
Version bump

2 years agoTry another labeler implementation
Anton Korobeynikov [Sun, 12 Dec 2021 09:54:29 +0000 (12:54 +0300)]
Try another labeler implementation

2 years agoAutolabel new issues
Anton Korobeynikov [Sun, 12 Dec 2021 09:46:21 +0000 (12:46 +0300)]
Autolabel new issues

2 years ago[libc++][ranges] Add subsumption tests to `[special.mem.concepts]`.
Konstantin Varlamov [Sun, 12 Dec 2021 08:37:02 +0000 (00:37 -0800)]
[libc++][ranges] Add subsumption tests to `[special.mem.concepts]`.

Test that `nothrow-forward-iterator` subsumes `nothrow-input-iterator`,
`nothrow-forward-range` subsumes `nothrow-input-range`, and
`nothrow-sentinel-for` and `sentinel_for` subsume each other.

This is a follow-up to [D114761](https://reviews.llvm.org/D114761).

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

2 years ago[AST] Remove an unnecessary continue (NFC)
Kazu Hirata [Sun, 12 Dec 2021 07:04:08 +0000 (23:04 -0800)]
[AST] Remove an unnecessary continue (NFC)

2 years ago[AST] Remove isWhitespace in favor of clang::isWhitespace (NFC)
Kazu Hirata [Sun, 12 Dec 2021 06:51:59 +0000 (22:51 -0800)]
[AST] Remove isWhitespace in favor of clang::isWhitespace (NFC)

2 years ago[llvm] Use range-based for loops (NFC)
Kazu Hirata [Sun, 12 Dec 2021 06:34:07 +0000 (22:34 -0800)]
[llvm] Use range-based for loops (NFC)

2 years ago[Passes] Fix relative lookup table converter pass
Gulfem Savrun Yeniceri [Sat, 11 Dec 2021 03:14:48 +0000 (03:14 +0000)]
[Passes] Fix relative lookup table converter pass

This patch fixes the relative table converter pass for the lookup table
accesses that are resulted in an instruction sequence, where gep is not
immediately followed by a load, such as gep being hoisted outside the loop
or another instruction is inserted in between them. The fix inserts the
call to load.relative.instrinsic in the original place of load instead of gep.
Issue is reported by FreeBSD via https://bugs.freebsd.org/259921.

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

2 years agoRevert "Revert "[clang][dataflow] Add framework for testing analyses.""
Yitzhak Mandelbaum [Fri, 10 Dec 2021 16:40:33 +0000 (16:40 +0000)]
Revert "Revert "[clang][dataflow] Add framework for testing analyses.""

This reverts commit 78ff12da1115abcaf4cbf50b605a197011505646 and fixes the initial cause of the revert.

2 years ago[mlir] Flip dialects to _Prefixed
Jacques Pienaar [Sat, 11 Dec 2021 21:27:11 +0000 (13:27 -0800)]
[mlir] Flip dialects to _Prefixed

Following
https://llvm.discourse.group/t/psa-ods-generated-accessors-will-change-to-have-a-get-prefix-update-you-apis/4476
these have been flipped to both for ~4 weeks, flipping to _Prefixed.

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

2 years ago[libc] Add ADD_FMA_FLAG macro to add -mfma flag to functions that requires it.
Tue Ly [Sat, 11 Dec 2021 04:01:22 +0000 (23:01 -0500)]
[libc] Add ADD_FMA_FLAG macro to add -mfma flag to functions that requires it.

Add ADD_FMA_FLAG macro to add -mfma flag to functions that requires it.

Reviewed By: sivachandra

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

2 years ago[SCEV] Fix unused variable warning (NFC)
Nikita Popov [Sat, 11 Dec 2021 20:02:37 +0000 (21:02 +0100)]
[SCEV] Fix unused variable warning (NFC)

2 years agoUse llvm::any_of and llvm::all_of (NFC)
Kazu Hirata [Sat, 11 Dec 2021 19:54:36 +0000 (11:54 -0800)]
Use llvm::any_of and llvm::all_of (NFC)

2 years ago[mlir][spirv] Fix nested control flow serialization
Lei Zhang [Sat, 11 Dec 2021 19:40:24 +0000 (14:40 -0500)]
[mlir][spirv] Fix nested control flow serialization

If we have a `spv.mlir.selection` op nested in a `spv.mlir.loop`
op, when serializing the loop's block, we might need to jump
from the selection op's merge block, which might be different
than the immediate MLIR IR predecessor block. But we still need
to get the block argument from the MLIR IR predecessor block.

Also, if the `spv.mlir.selection` is in the `spv.mlir.loop`'s
header block, we need to make sure `OpLoopMerge` is emitted
in the current block before start processing the nested selection
op. Otherwise we'll see the LoopMerge in the wrong SPIR-V
basic block.

Reviewed By: Hardcode84

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

2 years ago[llvm] Use llvm::is_contained (NFC)
Kazu Hirata [Sat, 11 Dec 2021 19:42:09 +0000 (11:42 -0800)]
[llvm] Use llvm::is_contained (NFC)

2 years ago[llvm] Use range-based for loops (NFC)
Kazu Hirata [Sat, 11 Dec 2021 19:29:12 +0000 (11:29 -0800)]
[llvm] Use range-based for loops (NFC)

2 years ago[mlir][python] Add fused location
Jacques Pienaar [Sat, 11 Dec 2021 18:12:29 +0000 (10:12 -0800)]
[mlir][python] Add fused location

2 years agoAMDGPU: Indicate pessimistic fixpoint for entry functions
Matt Arsenault [Sat, 11 Dec 2021 15:56:09 +0000 (10:56 -0500)]
AMDGPU: Indicate pessimistic fixpoint for entry functions

There aren't going to be any callers for these, so avoid running
through the machinery to look at the callers.

2 years ago[EarlyCSE] Retain poison flags, if program is UB if poison.
Florian Hahn [Sat, 11 Dec 2021 13:44:14 +0000 (13:44 +0000)]
[EarlyCSE] Retain poison flags, if program is UB if poison.

Poison-generating flags can be retained during CSE on the earlier
instruction , *if* the earlier instruction being poison causes UB. For
now, always take AND for floating point instructions.

https://alive2.llvm.org/ce/z/4K3D7P

Reviewed By: nikic

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

2 years ago[MLIR][FlatAffineConstraints] Add support for extracting divisions with tighter bounds
Groverkss [Sat, 11 Dec 2021 08:27:19 +0000 (13:57 +0530)]
[MLIR][FlatAffineConstraints] Add support for extracting divisions with tighter bounds

This patch adds support for extracting divisions when the set contains bounds
which are tighter than the division bounds. For example:

```
     3q - i + 2 >= 0                       <-- Lower bound for 'q'
    -3q + i - 1 >= 0                       <-- Tighter upper bound for 'q'
```

Here, the actual upper bound for division for `q` would be `-3q + i >= 0`, but
since this actual upper bound is implied by a tighter upper bound, which awe can still
extract the divison.

Reviewed By: arjunp

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

2 years agoEnable github issues
Anton Korobeynikov [Sat, 11 Dec 2021 09:13:33 +0000 (12:13 +0300)]
Enable github issues

2 years ago[lld-macho][nfc] Simplify LC_DATA_IN_CODE generation
Jez Ng [Sat, 11 Dec 2021 06:01:14 +0000 (01:01 -0500)]
[lld-macho][nfc] Simplify LC_DATA_IN_CODE generation

1. After D113241, we have the section address easily accessible and no
   longer need to iterate across the LC_SEGMENT commands to emit
   LC_DATA_IN_CODE.

2. There's no need to store a pointer to the data in code entries during
   the parse step; we can just look it up as part of the output step.

Reviewed By: #lld-macho, thakis

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

2 years ago[lld-macho][nfc] InputSections don't need to track their total # of callsites
Jez Ng [Sat, 11 Dec 2021 06:01:13 +0000 (01:01 -0500)]
[lld-macho][nfc] InputSections don't need to track their total # of callsites

... only whether they have more than zero. This simplifies the code slightly.

I've also moved the field into the ConcatInputSection subclass since it doesn't
actually get used by the other InputSections.

Reviewed By: #lld-macho, oontvoo

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

2 years ago[NFC][Clang] clang-format -i clang/lib/Sema/SemaOpenMP.cpp
Shilei Tian [Sat, 11 Dec 2021 03:05:25 +0000 (22:05 -0500)]
[NFC][Clang] clang-format -i clang/lib/Sema/SemaOpenMP.cpp

2 years agoRevert "[gn build] (manually) port 492de35df44"
Nico Weber [Sat, 11 Dec 2021 02:00:02 +0000 (21:00 -0500)]
Revert "[gn build] (manually) port 492de35df44"

This reverts commit 9a3df8fbc2283da50b66cda42f122f9f4ff065a0.
492de35df44 was reverted in 30fc88bf1d.

2 years ago[clangd] ... and mark a new test as -fno-ms-compatibility too
Sam McCall [Sat, 11 Dec 2021 01:39:11 +0000 (02:39 +0100)]
[clangd] ... and mark a new test as -fno-ms-compatibility too

2 years agoRevert "Revert "Revert "Use `GNUInstallDirs` to support custom installation dirs...
Med Ismail Bennani [Sat, 11 Dec 2021 01:30:16 +0000 (17:30 -0800)]
Revert "Revert "Revert "Use `GNUInstallDirs` to support custom installation dirs. -- LLVM"""

This reverts commit 492de35df443d5f31480173d5f1274c7835cd3d8.

I tried to apply John's changes in 8d897ec91528 that were expected to
fix his patch but that didn't work unfortunately.

Reverting this again to fix the macOS bots and leave him more time to
investigate the issue.

2 years agoRevert "[llvm] Partial revert, hopefully fix LLVM module maps build"
Med Ismail Bennani [Sat, 11 Dec 2021 01:26:36 +0000 (17:26 -0800)]
Revert "[llvm] Partial revert, hopefully fix LLVM module maps build"

This reverts commit 8d897ec91528e943bf2be7356845d3428ae369ae.

I tentativily landed John's patch in D115553 to fix the macOS bots but
it's still failing as shown here:

https://green.lab.llvm.org/green/job/lldb-cmake/39267/

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years ago[clangd] Restore -fno-ms-compatibility to tests
Sam McCall [Sat, 11 Dec 2021 01:30:29 +0000 (02:30 +0100)]
[clangd] Restore -fno-ms-compatibility to tests

Turns out these weren't obsolete after all...
http://45.33.8.238/win/50653/step_9.txt

2 years ago[llvm] Partial revert, hopefully fix LLVM module maps build
John Ericson [Sat, 11 Dec 2021 01:17:01 +0000 (17:17 -0800)]
[llvm] Partial revert, hopefully fix LLVM module maps build

In 492de35df443d5f31480173d5f1274c7835cd3d8 / D115544 I accidentally
added ${LLVM_INCLUDE_DIR}/ to the destination path. This broke the
"LLDB Incremental" build. Putting it back the way it was should fix it.

Differencial Revision: https://reviews.llvm.org/D115553

2 years ago[clangd] Include-fixer: handle more "incomplete type" diags.
Sam McCall [Fri, 10 Dec 2021 01:14:15 +0000 (02:14 +0100)]
[clangd] Include-fixer: handle more "incomplete type" diags.

I started adding tests for all diags but found there were just too many cases.

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

2 years agoRevert "[ASan] Replace IR based callbacks with shared assembly code callbacks."
Kirill Stoimenov [Sat, 11 Dec 2021 00:40:04 +0000 (00:40 +0000)]
Revert "[ASan] Replace IR based callbacks with shared assembly code callbacks."

This reverts commit db124df4950699caa020384ee8da23af6c707d3c.

Broke some builds:
https://lab.llvm.org/buildbot/#/builders/98/builds/9895
https://lab.llvm.org/buildbot/#/builders/91/builds/434

Reviewed By: kstoimenov

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

2 years agoAMDGPU: Remove fixed function ABI option
Matt Arsenault [Sat, 14 Aug 2021 19:52:37 +0000 (15:52 -0400)]
AMDGPU: Remove fixed function ABI option

2 years agoRevert "[amdgpu][nfc] Delete dead code in LowerModuleLDS"
Jon Chesterfield [Sat, 11 Dec 2021 00:30:34 +0000 (00:30 +0000)]
Revert "[amdgpu][nfc] Delete dead code in LowerModuleLDS"

This reverts commit 7b9ab06d10a6a989f76e6c5ecf89d906f838fe7d.
Said code is better removed as part of a larger change.

2 years ago[clangd] Clean up some include-fixer tests. NFC
Sam McCall [Fri, 10 Dec 2021 01:14:15 +0000 (02:14 +0100)]
[clangd] Clean up some include-fixer tests. NFC

2 years ago[mlir][spirv] Propagate LogicalResult in (de)serialization
Lei Zhang [Fri, 10 Dec 2021 23:55:44 +0000 (18:55 -0500)]
[mlir][spirv] Propagate LogicalResult in (de)serialization

`(void)` was added when LogicalResult was marked as non
discard. This commit cleans them up to properly propagate
failures.

Reviewed By: scotttodd

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

2 years ago[mlir][spirv] Change default subgroup size
Lei Zhang [Fri, 10 Dec 2021 18:58:02 +0000 (13:58 -0500)]
[mlir][spirv] Change default subgroup size

This should really come from a matching target environment. But
as a default, it can be handy (to avoid always listing the full
resource limits attribute in IR, etc.). It's common to see 32
so use that as the subgroup size.

Reviewed By: scotttodd

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

2 years ago[mlir][spirv] Avoid duplicated Block decoration during serialization
Lei Zhang [Fri, 10 Dec 2021 18:57:46 +0000 (13:57 -0500)]
[mlir][spirv] Avoid duplicated Block decoration during serialization

It's legal per the Vulkan / SPIR-V spec; still it's better to avoid
such duplication to have cleaner blob and reduce the binary size.

Reviewed By: scotttodd

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

2 years ago[mlir][spirv] Add serialization control to emit symbol name
Lei Zhang [Fri, 10 Dec 2021 18:57:29 +0000 (13:57 -0500)]
[mlir][spirv] Add serialization control to emit symbol name

In SPIR-V, symbol names are encoded as `OpName` instructions.
They are not semantic impacting and can be omitted, which can
reduce the binary size.

Reviewed By: scotttodd

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

2 years ago[ASan] Replace IR based callbacks with shared assembly code callbacks.
Kirill Stoimenov [Wed, 8 Dec 2021 21:24:10 +0000 (21:24 +0000)]
[ASan] Replace IR based callbacks with shared assembly code callbacks.

This change moves optimized callbacks from each .o file to compiler-rt.

Reviewed By: vitalybuka, morehouse

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

2 years ago[mlir] Update BUILD rule for AffineUtils
Chia-hung Duan [Fri, 10 Dec 2021 23:50:27 +0000 (23:50 +0000)]
[mlir] Update BUILD rule for AffineUtils

bc657b2eef82f604e5bfb8da421cbdfc80156739 adds the dependency to
MemRefDialect.

Reviewed By: GMNGeoffrey, mehdi_amini

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

2 years ago[llvm-readobj] Add JSONScopedPrinter to llvm-readelf
Jayson Yan [Fri, 10 Dec 2021 23:27:06 +0000 (23:27 +0000)]
[llvm-readobj] Add JSONScopedPrinter to llvm-readelf

Adds JSONScopedPrinter to llvm-readelf. It includes an empty
JSONELFDumper class which will be used to override any LLVMELFDumper
methods which utilize startLine() which JSONScopedPrinter cannot
provide.

This introduces a change where calls to llvm-readelf with non-ELF object
files that specify --elf-output-style=GNU will now print file summary
information where it previously didn't.

Fixes previous Windows test failure which occured due to JSON escaping
of '\' by not relying on LIT substitution.

Reviewed By: jhenderson

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

2 years agoRevert "[mlir][tensor] Fix insert_slice + tensor cast overflow"
Nicolas Vasilache [Fri, 10 Dec 2021 22:47:49 +0000 (22:47 +0000)]
Revert "[mlir][tensor] Fix insert_slice + tensor cast overflow"

This reverts commit 5601821daec72b221631cfd6175760557281d602.

The prefix + canonical complete behavior is actually obsolete and should not be reintroduced.
Reverting.

2 years agoRevert "[asan] Add support for disable_sanitizer_instrumentation attribute"
Andrew Browne [Fri, 10 Dec 2021 22:28:36 +0000 (14:28 -0800)]
Revert "[asan] Add support for disable_sanitizer_instrumentation attribute"

This reverts commit 2b554920f11c8b763cd9ed9003f4e19b919b8e1f.

This change causes tsan test timeout on x86_64-linux-autoconf.

The timeout can be reproduced by:
  git clone https://github.com/llvm/llvm-zorg.git
  BUILDBOT_CLOBBER= BUILDBOT_REVISION=eef8f3f85679c5b1ae725bade1c23ab7bb6b924f llvm-zorg/zorg/buildbot/builders/sanitizers/buildbot_standard.sh

2 years agoMove x86-specific test into the DebugInfo/X86 directory
David Blaikie [Fri, 10 Dec 2021 22:26:04 +0000 (14:26 -0800)]
Move x86-specific test into the DebugInfo/X86 directory

2 years ago[sanitizers] include build ids in stacks on linux.
Florian Mayer [Fri, 10 Dec 2021 22:21:09 +0000 (14:21 -0800)]
[sanitizers] include build ids in stacks on linux.

Reviewed By: eugenis

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

2 years ago[Docs][ORCv2] GetForCurrentProcess now returns an Expected<std::unique_ptr>. NFC
Jon Roelofs [Tue, 5 Oct 2021 15:00:03 +0000 (08:00 -0700)]
[Docs][ORCv2] GetForCurrentProcess now returns an Expected<std::unique_ptr>. NFC

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

2 years ago[MLIR] FlatAffineConstraints::isIntegerEmpty: fix bug in computation of duals
Arjun P [Fri, 10 Dec 2021 22:15:59 +0000 (03:45 +0530)]
[MLIR] FlatAffineConstraints::isIntegerEmpty: fix bug in computation of duals

The method that was previously used for computing dual variables was incorrect.
This was used in the integer emptiness check algorithm, where this bug could lead to much longer running times. (Due to the way it is used, this never results in an incorrect emptiness check result.)

This patch fixes the dual computation and adds some additional asserts that catch this bug, along with regression test cases that trigger the asserts when the incorrect dual computation is used.

Reviewed By: Groverkss

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

2 years ago[MLIR] IntegerPolyhedron: introduce getNumIdKind to replace calls to assertAtMostNumI...
Arjun P [Fri, 10 Dec 2021 21:48:04 +0000 (03:18 +0530)]
[MLIR] IntegerPolyhedron: introduce getNumIdKind to replace calls to assertAtMostNumIdKind

Introduce a function `getNumIdKind` that returns the number of ids of the
specified kind. Remove the function `assertAtMostNumIdKind` and instead just
directly assert the inequality with a call to `getNumIdKind`.

2 years agoRevert "X86InstrInfo: Support immediates that are +1/-1 different in optimizeCompareI...
Bogdan Graur [Fri, 10 Dec 2021 15:44:36 +0000 (16:44 +0100)]
Revert "X86InstrInfo: Support immediates that are +1/-1 different in optimizeCompareInstr"

This reverts commit 847a6807332b13f43704327c2d30103ec0347c77.

The reverted revision was causing miscompiles that manifest on AMD
machines.

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

2 years ago[mlir][vector] NFC move vector unroll/distribute patterns to their own file
Thomas Raoux [Fri, 10 Dec 2021 20:18:34 +0000 (12:18 -0800)]
[mlir][vector] NFC move vector unroll/distribute patterns to their own file

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

2 years ago[MLIR][NFC] Move out affine scalar replacement utility to affine utils
Uday Bondhugula [Fri, 10 Dec 2021 08:35:52 +0000 (14:05 +0530)]
[MLIR][NFC] Move out affine scalar replacement utility to affine utils

NFC. Move out and expose affine scalar replacement utility through
affine utils. Renaming misleading forwardStoreToLoad ->
affineScalarReplace. Update a stale doc comment.

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

2 years ago[ASan] Added NO_EXEC_STACK_DIRECTIVE to assembly callback file.
Kirill Stoimenov [Fri, 10 Dec 2021 21:44:14 +0000 (21:44 +0000)]
[ASan] Added NO_EXEC_STACK_DIRECTIVE to assembly callback file.

This is present in our assembly files. It should fix decorate_proc_maps.cpp failures because of shadow memory being allocated as executable.

Reviewed By: vitalybuka

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

2 years ago[mlir][tensor] Fix insert_slice + tensor cast overflow
Nicolas Vasilache [Fri, 10 Dec 2021 21:27:20 +0000 (21:27 +0000)]
[mlir][tensor] Fix insert_slice + tensor cast overflow

InsertSliceOp may have subprefix semantics where missing trailing dimensions
are automatically inferred directly from the operand shape.
This revision fixes an overflow that occurs in such cases when the impl is based on the op rank.

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

2 years ago[gn build] (manually) port 492de35df44
Nico Weber [Fri, 10 Dec 2021 21:33:55 +0000 (16:33 -0500)]
[gn build] (manually) port 492de35df44

2 years agoRevert "[llvm-readobj] Add JSONScopedPrinter to llvm-readelf"
Jayson Yan [Fri, 10 Dec 2021 20:58:07 +0000 (20:58 +0000)]
Revert "[llvm-readobj] Add JSONScopedPrinter to llvm-readelf"

This reverts commit 824eef231a853d7054d55010c16654f6f20e0394.
file-summary-json.test and pretty-print.test fails on Windows.

2 years agoRevert "Revert "Use `GNUInstallDirs` to support custom installation dirs. -- LLVM""
John Ericson [Thu, 4 Nov 2021 02:09:30 +0000 (02:09 +0000)]
Revert "Revert "Use `GNUInstallDirs` to support custom installation dirs. -- LLVM""

This reverts commit 797b50d4be873b4662983413a06806fca544c276.

See the original D99484. @mib who noticed the original problem could not longer
reproduce it, after I tried and also failed. We are threfore hoping it went
away on its own!

Reviewed By: mib

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

2 years agoRevert "[OpenMP] Avoid costly shadow map traversals whenever possible"
Joseph Huber [Fri, 10 Dec 2021 20:56:55 +0000 (15:56 -0500)]
Revert "[OpenMP] Avoid costly shadow map traversals whenever possible"

This reverts commit 7c8f4e7b85ed98497f37571d72609f39a8eed447.
Fails a few OpenMP tests, causes a few updates to segfault.

2 years ago[OpenMP][libomp] Add core attributes to KMP_HW_SUBSET
Jonathan Peyton [Tue, 30 Nov 2021 22:43:47 +0000 (16:43 -0600)]
[OpenMP][libomp] Add core attributes to KMP_HW_SUBSET

Allow filtering of resources based on core attributes. There are two new
attributes added:
1) Core Type (intel_atom, intel_core)
2) Core Efficiency (integer) where the higher the efficiency, the more
   performant the core
On hybrid architectures , e.g., Alder Lake, users can specify
KMP_HW_SUBSET=4c:intel_atom,4c:intel_core to select the first four Atom
and first four Big cores. The can also use the efficiency syntax. e.g.,
KMP_HW_SUBSET=2c:eff0,2c:eff1

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

2 years agoFix shared build of unittests.
Michael Liao [Fri, 10 Dec 2021 19:21:30 +0000 (14:21 -0500)]
Fix shared build of unittests.

2 years ago[ThinLTO][MC] Use conditional assignments for promotion aliases
Sami Tolvanen [Fri, 10 Dec 2021 19:11:28 +0000 (11:11 -0800)]
[ThinLTO][MC] Use conditional assignments for promotion aliases

Inline assembly refererences to static functions with ThinLTO+CFI were
fixed in D104058 by creating aliases for promoted functions. Creating
the aliases unconditionally resulted in an unexpected size increase in
a Chrome helper binary:

https://bugs.chromium.org/p/chromium/issues/detail?id=1261715

This is caused by the compiler being unable to drop unused code now
referenced by the alias in module-level inline assembly. This change
adds a .set_conditional assembly extension, which emits an assignment
only if the target symbol is also emitted, avoiding phantom references
to functions that could have otherwise been dropped.

This is an alternative to the solution proposed in D112761.

Reviewed By: pcc, nickdesaulniers, MaskRay

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

2 years agoVerifier: accept enums as scopes
Augie Fackler [Fri, 10 Dec 2021 20:17:18 +0000 (12:17 -0800)]
Verifier: accept enums as scopes

Rust allows enums to be scopes, as shown by the previous change. Sadly,
D111770 disallowed enums-as-scopes in the LLVM Verifier, which means
that LLVM HEAD stopped working for Rust compiles.  As a result, we back
out the verifier part of D111770 with a modification to the testcase so
we don't break this in the future.

The testcase is now actual IR from rustc at commit 8f8092cc3, which is
the nightly as of 2021-09-28. I would expect rustc 1.57 to produce
similar or identical IR if someone wants to reproduce this IR in the
future with minimal changes. A recipe for reproducing the IR using rustc
is included in the test file.

Reviewed By: dblaikie

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

2 years ago[gn build] Port 04f2712ef4e4
LLVM GN Syncbot [Fri, 10 Dec 2021 19:52:50 +0000 (19:52 +0000)]
[gn build] Port 04f2712ef4e4

2 years agoRevert "[sanitizers] include build ids in stacks on linux."
Florian Mayer [Fri, 10 Dec 2021 19:52:26 +0000 (11:52 -0800)]
Revert "[sanitizers] include build ids in stacks on linux."

This reverts commit 2a31b240df1ce1724960fd7cf98f673064b44206.

2 years ago[mlir:PDL] Allow non-bound pdl.attribute/pdl.type operations that create constants
River Riddle [Fri, 10 Dec 2021 19:36:21 +0000 (19:36 +0000)]
[mlir:PDL] Allow non-bound pdl.attribute/pdl.type operations that create constants

This allows for passing in these attributes/types to constraints/rewrites as arguments.

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

2 years ago[mlir:PDL] Fix bugs in PDLPatternModule merging
River Riddle [Fri, 10 Dec 2021 19:36:07 +0000 (19:36 +0000)]
[mlir:PDL] Fix bugs in PDLPatternModule merging

* Constraints/Rewrites registered before a pattern was added were dropped
* Constraints/Rewrites may be registered multiple times (if different pattern sets depend on them)
* ModuleOp no longer has a terminator, so we shouldn't be removing the terminator from it

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

2 years ago[mlir:PDL] Adjust the assembly format for AttributeOp to avoid conflicts with Diction...
River Riddle [Fri, 10 Dec 2021 19:35:55 +0000 (19:35 +0000)]
[mlir:PDL] Adjust the assembly format for AttributeOp to avoid conflicts with DictionaryAttr

Switch the attribute creation operations to use attr-dict-with-
keyword to avoid conflicts (in the case of pdl.attribute) and
confusion(in the case of pdl_interp.create_attribute) with
having a DictionaryAttr as a value and specifying the
attributes of the operation itself (as a dictionary).

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

2 years ago[mlir:PDL] Fix assembly format for pdl.apply_native_rewrite
River Riddle [Fri, 10 Dec 2021 19:35:43 +0000 (19:35 +0000)]
[mlir:PDL] Fix assembly format for pdl.apply_native_rewrite

The results of a rewrite are optional, but we currently require
them to be present in the assembly format. This commit
makes the results component in the format optional.

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

2 years ago[mlir][ods] Fix OpFormatGen sometimes not calling inferReturnTypes
Mogball [Fri, 10 Dec 2021 15:04:46 +0000 (15:04 +0000)]
[mlir][ods] Fix OpFormatGen sometimes not calling inferReturnTypes

Reviewed By: jpienaar

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

2 years ago[mlir][ir] OpRewritePattern should accept generatedNames
Mogball [Fri, 10 Dec 2021 13:30:11 +0000 (13:30 +0000)]
[mlir][ir] OpRewritePattern should accept generatedNames

Reviewed By: rriddle

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

2 years ago[mlir][ir] Custom ops' parse/print fall back to dialect hooks
Mogball [Fri, 10 Dec 2021 00:47:48 +0000 (00:47 +0000)]
[mlir][ir] Custom ops' parse/print fall back to dialect hooks

Custom ops that have no parser or printer should fall back to the dialect's parser and/or printer hooks. This avoids the need to define parsers and printers that simply dispatch to the dialect hook.

Reviewed By: mehdi_amini, rriddle

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

2 years ago[OpenMP] Avoid costly shadow map traversals whenever possible
Joseph Huber [Fri, 10 Dec 2021 17:49:59 +0000 (12:49 -0500)]
[OpenMP] Avoid costly shadow map traversals whenever possible

In the OpenMC app we saw `omp target update` spending an awful lot of
time in the shadow map traversal without ever doing any update there.
There are two cases that allow us to avoid the traversal completely.
The simplest thing is that small updates cannot (reasonably) contain
an attached pointer part. The other case requires to track in the
mapping table if an entry might contain an attached pointer as part.
Given that we have a single location shadow map entries are created,
the latter is actually fairly easy as well.

Reviewed By: grokos

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

2 years ago[sanitizers] include build ids in stacks on linux.
Florian Mayer [Thu, 18 Nov 2021 03:50:33 +0000 (19:50 -0800)]
[sanitizers] include build ids in stacks on linux.

Reviewed By: eugenis

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

2 years agoutils: Remove some no-op raw_string_ostream flush calls, NFC
Duncan P. N. Exon Smith [Fri, 10 Dec 2021 02:57:38 +0000 (18:57 -0800)]
utils: Remove some no-op raw_string_ostream flush calls, NFC

Since 65b13610a5226b84889b923bae884ba395ad084d, raw_string_ostream has
been unbuffered by default. Based on an audit of llvm/utils/, this
commit removes every call to `raw_string_ostream::flush()` and any call
to `raw_string_ostream::str()` whose result is ignored or that doesn't
help with clarity.

I left behind a few calls to `str()`. In these cases, the underlying
std::string was declared pretty far away and never used again, whereas
stream recently had its last write. The code is easier to read as-is;
the no-op call to `flush()` inside `str()` isn't harmful, and when
https://reviews.llvm.org/D115421 lands it'll be gone anyway.

2 years ago[NFC][MLGO] Factor ModelUnderTrainingRunner for reuse
Mircea Trofin [Thu, 9 Dec 2021 20:56:16 +0000 (12:56 -0800)]
[NFC][MLGO] Factor ModelUnderTrainingRunner for reuse

This is so we may reuse it. It was very non-inliner specific already.

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

2 years ago[OpenMP] Part 2 of At present, amdgpu plugin merges both asynchronous
Carlo Bertolli [Fri, 10 Dec 2021 19:10:53 +0000 (19:10 +0000)]
[OpenMP] Part 2 of At present, amdgpu plugin merges both asynchronous
and synchronous kernel launch implementations into a single
synchronous version.  This patch prepares the plugin for asynchronous
implementation by:

    Privatizing actual kernel launch code (valid in both cases) into
    an anonymous namespace base function (submitted at D115267)

    - Separating the control flow path of asynchronous and synchronous
      kernel launch functions** (this diff)

Reviewed By: JonChesterfield

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

2 years ago[gn build] Port d25a65030bc1
LLVM GN Syncbot [Fri, 10 Dec 2021 18:58:26 +0000 (18:58 +0000)]
[gn build] Port d25a65030bc1

2 years ago[llvm-readobj] Add JSONScopedPrinter to llvm-readelf
Jayson Yan [Fri, 10 Dec 2021 18:46:55 +0000 (18:46 +0000)]
[llvm-readobj] Add JSONScopedPrinter to llvm-readelf

 Adds JSONScopedPrinter to llvm-readelf. It includes an empty
 JSONELFDumper class which will be used to override any LLVMELFDumper
 methods which utilize startLine() which JSONScopedPrinter cannot
 provide.

 Reviewed By: jhenderson

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

2 years ago[llvm] Add JSONScopedPrinter class
Jayson Yan [Fri, 10 Dec 2021 18:44:45 +0000 (18:44 +0000)]
[llvm] Add JSONScopedPrinter class

This change adds a JSONScopedPrinter as a subclass to ScopedPrinter.

Reviewed By: jhenderson

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

2 years ago[llvm] Add ScopedPrinter unit tests
Jayson Yan [Fri, 10 Dec 2021 18:35:11 +0000 (18:35 +0000)]
[llvm] Add ScopedPrinter unit tests

Add unit tests for the ScopedPrinter class.

Reviewed By: jhenderson

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

2 years ago[NFC] Move printNumber method
Jayson Yan [Fri, 10 Dec 2021 18:29:09 +0000 (18:29 +0000)]
[NFC] Move printNumber method

Move printNumber(StringRef Label, StringRef Str, T Value) to
be with the rest of the printNumber(...) methods.

Reviewed By: jhenderson

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

2 years ago[NFC] Remove unneeded printString methods
Jayson Yan [Fri, 10 Dec 2021 18:14:53 +0000 (18:14 +0000)]
[NFC] Remove unneeded printString methods

Both std::string and char * implicitly convert to StringRef so
the overloaded method using std::string and char* are unneeded.

Reviewed By: jhenderson

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

2 years ago[llvm] Make ScopedPrinter interface virtual
Jayson Yan [Fri, 10 Dec 2021 17:45:40 +0000 (17:45 +0000)]
[llvm] Make ScopedPrinter interface virtual

Make the interface provided by ScopedPrinter virtual to support a future
JSONScopedPrinter which will supply it's own implementation.

Reviewed By: jhenderson

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

2 years ago[MCA][X86] Add missing VPMOVSX/VPMOVZX from AVX512 tests
Simon Pilgrim [Fri, 10 Dec 2021 17:30:27 +0000 (17:30 +0000)]
[MCA][X86] Add missing VPMOVSX/VPMOVZX from AVX512 tests

2 years ago[OpenMP] Add test for custom state machine if have reduction
Joel E. Denny [Fri, 10 Dec 2021 17:07:31 +0000 (12:07 -0500)]
[OpenMP] Add test for custom state machine if have reduction

D113602 broke the custom state machine when a reduction is present, as
revealed by the reproducer this patch adds to the test suite.  In that
case, openmp-opts changes the return value to undef in
`__kmpc_get_warp_size` (which the custom state machine calls as of
D113602).  Later optimizations then optimize away the custom state
machine code as if all threads are outside the thread block, so the
target region does not execute.  D114802 fixed that but didn't add a
reproducer.

This patch also adds a `__OMP_RTL_ATTRS` entry for
`__kmpc_get_warp_size` to OMPKinds.def, which D113602 missed.  This
change does not seem to have any impact on the reduction problem.

Reviewed By: JonChesterfield, jdoerfert

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

2 years ago[RISCV] Share tablegen classes for F, D, and Zfh. Other simplifications. NFC
Craig Topper [Fri, 10 Dec 2021 17:27:13 +0000 (09:27 -0800)]
[RISCV] Share tablegen classes for F, D, and Zfh. Other simplifications. NFC

By adding the register class and funct as template parameters we
can share the classes with all 3 extensions.

I've used "let SchedRW =" to avoid repeating scheduler classes on
multiple lines where we previously inherited from the Sched class.

A subsequent patch will add mayRaiseFPException and FRM dependencies.
Reducing the number of classes means less repeating for those changes.

This of course conflicts with the Zfinx patch D93298.

Reviewed By: achieveartificialintelligence

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

2 years ago[DwarfDebug] Refuse to emit DW_OP_LLVM_arg values wider than 64 bits
Adrian Prantl [Fri, 10 Dec 2021 17:15:54 +0000 (09:15 -0800)]
[DwarfDebug] Refuse to emit DW_OP_LLVM_arg values wider than 64 bits

DwarfExpression::addUnsignedConstant(const APInt &Value) only supports
wider-than-64-bit values when it is used to emit a top-level DWARF
expression representing the location of a variable. Before this change,
it was possible to call addUnsignedConstant on >64 bit values within a
subexpression when substituting DW_OP_LLVM_arg values.

This can trigger an assertion failure (e.g. PR52584, PR52333) when it
happens in a fragment (DW_OP_LLVM_fragment) expression, as
addUnsignedConstant on >64 bit values splits the constant into separate
DW_OP_pieces, which modifies DwarfExpression::OffsetInBits.

This change papers over the assertion errors by bailing on overly wide
DW_OP_LLVM_arg values. A more comprehensive fix might be to be to split
wide values into pointer-sized fragments.

[0] https://github.com/llvm/llvm-project/blob/e71fa03/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp#L799-L805

Patch by Ricky Zhou!

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

2 years ago[RISCV] Remove FCSR from RISCVRegisterInfo.
Craig Topper [Fri, 10 Dec 2021 17:20:40 +0000 (09:20 -0800)]
[RISCV] Remove FCSR from RISCVRegisterInfo.

We only used this to mark it as a reserved register. But that's not
important if we don't do anything else with it.

I think if we were ever to do anything with it, we would need to
model it as a super register of FRM and FFLAGS. But it might be
easier to reference both FRM and FFLAGS in implicit defs/uses
for anything we were to do with "fcsr".

Reviewed By: sepavloff

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

2 years ago[RISCV][Clang] Compute the default target-abi if it's empty.
Zakk Chen [Thu, 4 Nov 2021 17:13:50 +0000 (10:13 -0700)]
[RISCV][Clang] Compute the default target-abi if it's empty.

Every generated IR has a corresponding target-abi value, so
encoding a non-empty value would improve the robustness and
correctness.

Reviewed By: asb, jrtc27, arichardson

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

2 years ago[Support] Use range-based for loops (NFC)
Kazu Hirata [Fri, 10 Dec 2021 16:53:14 +0000 (08:53 -0800)]
[Support] Use range-based for loops (NFC)

2 years ago[analyzer] Implemented RangeSet::Factory::unite function to handle intersections...
Denys Petrov [Thu, 18 Nov 2021 14:06:06 +0000 (16:06 +0200)]
[analyzer] Implemented RangeSet::Factory::unite function to handle intersections and adjacency

Summary: Handle intersected and adjacent ranges uniting them into a single one.
Example:
intersection [0, 10] U [5, 20] = [0, 20]
adjacency [0, 10] U [11, 20] = [0, 20]

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

2 years ago[AArch64] Fix a warning
Kazu Hirata [Fri, 10 Dec 2021 16:33:07 +0000 (08:33 -0800)]
[AArch64] Fix a warning

This patch fixes:

  llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerCombiner.cpp:315:7:
  error: unused variable 'ValTy' [-Werror,-Wunused-variable]