platform/upstream/llvm.git
2 years ago[amdgpu] Add regression test for LDS in metadata
Jon Chesterfield [Mon, 13 Dec 2021 13:33:12 +0000 (13:33 +0000)]
[amdgpu] Add regression test for LDS in metadata

2 years ago[VPlan] Add printing test with VPInstruction with debug locs.
Florian Hahn [Mon, 13 Dec 2021 13:08:41 +0000 (13:08 +0000)]
[VPlan] Add printing test with VPInstruction with debug locs.

Test case for D113223.

2 years ago[mlir][linalg] Only compose PadTensorOps if no ExtractSliceOp is rank-reducing.
gysit [Mon, 13 Dec 2021 13:01:09 +0000 (13:01 +0000)]
[mlir][linalg] Only compose PadTensorOps if no ExtractSliceOp is rank-reducing.

Do not compose pad tensor operations if the extract slice of the outer pad tensor operation is rank reducing. The inner extract slice op cannot be rank-reducing since it source type must match the desired type of the padding.

Depends On D115359

Reviewed By: nicolasvasilache

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

2 years ago[mlir][linalg] Adapt the PadTensorOpVectorizationWithInsertSlicePattern matching.
gysit [Mon, 13 Dec 2021 12:54:37 +0000 (12:54 +0000)]
[mlir][linalg] Adapt the PadTensorOpVectorizationWithInsertSlicePattern matching.

Tighten the matcher of the PadTensorOpVectorizationWithInsertSlicePattern pattern. Only match if the PadOp result is used by the InsertSliceOp source. Fail if the result is used by the InsertSliceOp dest.

Depends On D115336

Reviewed By: nicolasvasilache

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

2 years ago[mlir][linalg] Make padding work for rank-reducing slice ops.
gysit [Mon, 13 Dec 2021 12:33:54 +0000 (12:33 +0000)]
[mlir][linalg] Make padding work for rank-reducing slice ops.

Adapt the computation of a static bounding box to take rank-reducing slice operations into account by filtering out reduced size one dimensions. The revision is needed to make padding work for decomposed convolution operations. The decomposition introduces rank reducing extract slice operations that previously let padding fail.

Reviewed By: nicolasvasilache

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

2 years agoRevert "[NFC] format .cppm files in test"
Nico Weber [Mon, 13 Dec 2021 12:12:55 +0000 (07:12 -0500)]
Revert "[NFC] format .cppm files in test"

This reverts commit 7c51a128339184c64307f3862e4cd36bf996189b.
Breaks SemaCXX/modules-ts.cppm in check-clang.

2 years ago[LV] Add test with debug locations on branches that get scalarized.
Florian Hahn [Mon, 13 Dec 2021 12:06:35 +0000 (12:06 +0000)]
[LV] Add test with debug locations on branches that get scalarized.

2 years ago[gn build] Make arm_neon_sve_bridge.h header auto-syncable
Nico Weber [Mon, 13 Dec 2021 12:04:38 +0000 (07:04 -0500)]
[gn build] Make arm_neon_sve_bridge.h header auto-syncable

2 years ago[LV][NFC] Fix debug message to print out resulting clamped VF
Evgeniy Brevnov [Mon, 13 Dec 2021 11:52:13 +0000 (18:52 +0700)]
[LV][NFC] Fix debug message to print out resulting clamped VF

2 years ago[NFC] format .cppm files in test
Chuanqi Xu [Mon, 13 Dec 2021 11:52:18 +0000 (19:52 +0800)]
[NFC] format .cppm files in test

2 years agotsan: enable the new runtime
Dmitry Vyukov [Mon, 13 Dec 2021 11:45:53 +0000 (12:45 +0100)]
tsan: enable the new runtime

This enables the new runtime (D112603) by default.

Depends on D112603.

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

2 years agotsan: new runtime (v3)
Dmitry Vyukov [Thu, 2 Dec 2021 07:36:44 +0000 (08:36 +0100)]
tsan: new runtime (v3)

This change switches tsan to the new runtime which features:
 - 2x smaller shadow memory (2x of app memory)
 - faster fully vectorized race detection
 - small fixed-size vector clocks (512b)
 - fast vectorized vector clock operations
 - unlimited number of alive threads/goroutimes

Depends on D112602.

Reviewed By: melver

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

2 years ago[SVE] Only combine (fneg (fma)) => FNMLA with nsz
Peter Waller [Wed, 8 Dec 2021 15:54:06 +0000 (15:54 +0000)]
[SVE] Only combine (fneg (fma)) => FNMLA with nsz

-(Za + Zm * Zn) != (-Za + Zm * (-Zn))
when the FMA produces a zero output (e.g. all zero inputs can produce -0
output)

Add a PatFrag to check presence of nsz on the fneg, add tests which
ensure the combine does not fire in the absense of nsz.

See https://reviews.llvm.org/D90901 for a similar discussion on X86.

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

2 years ago[AArch64][SVE][NEON] Add NEON-SVE-Bridge intrinsics
Matt Devereau [Mon, 29 Nov 2021 15:48:38 +0000 (15:48 +0000)]
[AArch64][SVE][NEON] Add NEON-SVE-Bridge intrinsics

Adds svset_neonq, svget_neonq, svdup_neonq AArch64 intrinsics.

These are described in the ACLE specification:
https://github.com/ARM-software/acle/pull/72

https://reviews.llvm.org/D114713

2 years ago[VE] Support srel32 in symbol reference
Kazushi (Jam) Marukawa [Fri, 10 Dec 2021 18:06:02 +0000 (03:06 +0900)]
[VE] Support srel32 in symbol reference

Support R_VE_SREL32 in symbol references in MC layer.

Reviewed By: simoll

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

2 years ago[VE] Support R_VE_RELATIVE
Kazushi (Jam) Marukawa [Sun, 12 Dec 2021 03:51:44 +0000 (12:51 +0900)]
[VE] Support R_VE_RELATIVE

Change getELFRelativeRelocationType() to return R_VE_RELATIVE
as a preparation of lld for VE.

Reviewed By: simoll

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

2 years ago[AArch64][SVE] Lower vector.insert to predicated merged MOV
Matt Devereau [Tue, 7 Dec 2021 16:52:43 +0000 (16:52 +0000)]
[AArch64][SVE] Lower vector.insert to predicated merged MOV

Use predicated SEL for vector.insert instead of going through memory

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

2 years ago[VPlan] Remove unused createNaryOp (NFC).
Florian Hahn [Mon, 13 Dec 2021 11:11:00 +0000 (11:11 +0000)]
[VPlan] Remove unused createNaryOp (NFC).

2 years agotsan: deflake dlopen_static_tls.cpp
Dmitry Vyukov [Mon, 13 Dec 2021 08:28:42 +0000 (09:28 +0100)]
tsan: deflake dlopen_static_tls.cpp

Currently the test calls dlclose in the thread
concurrently with the main thread calling a function
from the dynamic library. This is not good.
Wait for the main thread to call the function
before calling dlclose.

Depends on D115612.

Reviewed By: melver

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

2 years agotsan: deflake flush_memory.cpp
Dmitry Vyukov [Mon, 13 Dec 2021 08:27:07 +0000 (09:27 +0100)]
tsan: deflake flush_memory.cpp

The test contains a race and checks that it's detected.
But the race may not be detected since we are doing aggressive flushes
and if the state flush happens between racing accesses, tsan won't
detect the race). So return 1 to make the test deterministic
regardless of the race.

Reviewed By: melver

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

2 years ago[PR52475] Ensure a correct chain in copies to/from hidden sret parameter
Fraser Cormack [Tue, 30 Nov 2021 12:28:45 +0000 (12:28 +0000)]
[PR52475] Ensure a correct chain in copies to/from hidden sret parameter

This patch fixes an issue during SelectionDAG construction. When the
target is unable to lower the function's return value, a hidden sret
parameter is created. It is initialized and copied to a stored variable
(DemoteRegister) with CopyToReg and is later fetched with
CopyFromReg. The bug is that the chains used for each copy are
inconsistent, and thus in rare cases the scheduler may issue them out of
order.

The fix is to ensure that the CopyFromReg uses the DAG root which is set
as the chain corresponding to the initial CopyToReg.

Fixes https://llvm.org/PR52475

Reviewed By: craig.topper

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

2 years ago[MemCpyOpt] Add additional call slot capture tests (NFC)
Nikita Popov [Mon, 13 Dec 2021 09:08:50 +0000 (10:08 +0100)]
[MemCpyOpt] Add additional call slot capture tests (NFC)

One test shows a miscompile when bitcasts are involved, the others
cases where we can perform the optimization despite a capture.

2 years ago[VE][NFC] Cleanup vector patterns
Simon Moll [Mon, 13 Dec 2021 09:12:12 +0000 (10:12 +0100)]
[VE][NFC] Cleanup vector patterns

Cleanup VE vector isel patterns and follow the downstream LLVM-VE
pattern naming convention.

Reviewed By: kaz7

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

2 years ago[libc][NFC] Add back NOLINT anntotations to PolyEval.
Siva Chandra Reddy [Mon, 13 Dec 2021 07:07:14 +0000 (07:07 +0000)]
[libc][NFC] Add back NOLINT anntotations to PolyEval.

They were accidentally removed in a previous change.

2 years ago[LV] Make sure VF doesn't exceed compile time known TC
Evgeniy Brevnov [Wed, 24 Nov 2021 11:30:52 +0000 (18:30 +0700)]
[LV] Make sure VF doesn't exceed compile time known TC

For the simple copy loop (see test case) vectorizer selects VF equal to 32 while the loop is known to have 17 iterations only. Such behavior makes no sense to me since such vector loop will never be executed. The only case we may want to select VF large than TC is masked vectoriztion. So I haven't touched that case.

Reviewed By: dmgreen

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

2 years ago[ELF] Use parallelSort for .rela.dyn
Fangrui Song [Mon, 13 Dec 2021 04:53:06 +0000 (20:53 -0800)]
[ELF] Use parallelSort for .rela.dyn

An unstable sort suffices. In a large link (11.06s), this decreases .rela.dyn
writeTo time from 1.52s to 0.81s, resulting in 6% total time speedup (the
benefit will greatly dilute if --pack-dyn-relocs=relr becomes prevailing).

Encoding the dynamic relocations then sorting raw Elf_Rel/Elf_Rela doesn't seem
to improve much (doing that would require code duplicate because of
Elf_Rel/Elf_Rela plus unfortunate mips64le), so don't do that.

2 years ago[ELF] initializeSections: move SHT_LLVM_CALL_GRAPH_PROFILE check into SHF_EXCLUDE...
Fangrui Song [Mon, 13 Dec 2021 04:05:21 +0000 (20:05 -0800)]
[ELF] initializeSections: move SHT_LLVM_CALL_GRAPH_PROFILE check into SHF_EXCLUDE && !relocatable. NFC

Avoid a comparison in the majority of cases.

2 years ago[ELF] relocateAlloc: remove variables type and expr. NFC
Fangrui Song [Mon, 13 Dec 2021 03:31:30 +0000 (19:31 -0800)]
[ELF] relocateAlloc: remove variables type and expr. NFC

2 years ago[ELF] Move adjustSplitStackFunctionPrologues's splitStack check to the caller. NFC
Fangrui Song [Mon, 13 Dec 2021 03:26:03 +0000 (19:26 -0800)]
[ELF] Move adjustSplitStackFunctionPrologues's splitStack check to the caller. NFC

Avoid a function call in the majority of cases and make the output smaller.

2 years ago[ELF] Avoid mutable addend parameter. NFC
Fangrui Song [Mon, 13 Dec 2021 03:12:01 +0000 (19:12 -0800)]
[ELF] Avoid mutable addend parameter. NFC

2 years ago[Driver][test] Make some tests work with CLANG_DEFAULT_PIE_ON_LINUX=on
Fangrui Song [Mon, 13 Dec 2021 00:28:33 +0000 (16:28 -0800)]
[Driver][test] Make some tests work with CLANG_DEFAULT_PIE_ON_LINUX=on

Also delete some cross-linux.c tests which are covered by linux-cross.cpp

2 years ago[llvm] Use llvm::reverse (NFC)
Kazu Hirata [Mon, 13 Dec 2021 00:13:49 +0000 (16:13 -0800)]
[llvm] Use llvm::reverse (NFC)

2 years ago[X86][Atom] Fix CVT uops + port usage
Simon Pilgrim [Sun, 12 Dec 2021 22:57:53 +0000 (22:57 +0000)]
[X86][Atom] Fix CVT uops + port usage

Fix overrides to use both ports. Update the uops counts + port usage based off the most recent llvm-exegesis captures (PR36895) and what Intel AoM / Agner reports as well.

2 years ago[MCA][X86] Fix duplicated cvtsi2ss/cvtsi2sd i32 + i64 folded tests
Simon Pilgrim [Sun, 12 Dec 2021 22:48:45 +0000 (22:48 +0000)]
[MCA][X86] Fix duplicated cvtsi2ss/cvtsi2sd i32 + i64 folded tests

Specify the integer width to ensure we're testing the correct instruction

2 years agoUse "new issue" label for tagging new issues
Anton Korobeynikov [Sun, 12 Dec 2021 21:38:26 +0000 (13:38 -0800)]
Use "new issue" label for tagging new issues

Apparently "help wanted" has some additional special meaning

2 years ago[LV] Use info from State in some helper functions (NFC).
Florian Hahn [Sun, 12 Dec 2021 20:48:38 +0000 (20:48 +0000)]
[LV] Use info from State in some helper functions (NFC).

This updates several helper functions to use information provided by
VPTransformState instead of ILV directly, to help with the transition
out of ILV.

2 years ago[amdgpu] Increase alignment of all LDS variables
Jon Chesterfield [Sun, 12 Dec 2021 19:30:32 +0000 (19:30 +0000)]
[amdgpu] Increase alignment of all LDS variables

Currently the superalign option only increases the alignment of
variables that are moved into the module.lds block. Change that to all LDS
variables. Also only increase the alignment once, instead of once per function.

Reviewed By: rampitec

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

2 years agoEnsure newlines at the end of files (NFC)
Kazu Hirata [Sun, 12 Dec 2021 19:04:44 +0000 (11:04 -0800)]
Ensure newlines at the end of files (NFC)

2 years ago[ELF][test] Remove unused/incorrect .got check line
Fangrui Song [Sun, 12 Dec 2021 18:51:05 +0000 (10:51 -0800)]
[ELF][test] Remove unused/incorrect .got check line

2 years ago[NFC][X86] Precommit tests for memset with minsize being present
Daniil Seredkin [Sun, 12 Dec 2021 17:52:19 +0000 (00:52 +0700)]
[NFC][X86] Precommit tests for memset with minsize being present

2 years ago[X86] Update MMX opname test changes that were lost
Simon Pilgrim [Sun, 12 Dec 2021 18:21:34 +0000 (18:21 +0000)]
[X86] Update MMX opname test changes that were lost

I stupidly lost these in a temp git stash :(

2 years ago[X86][MMX] Remove superfluous 'i' from MMX cvt opnames. NFCI.
Simon Pilgrim [Sun, 12 Dec 2021 17:58:42 +0000 (17:58 +0000)]
[X86][MMX] Remove superfluous 'i' from MMX cvt opnames. NFCI.

This is a very old copy+paste typo - none of these cvt ops have an immediate operand.

Noticed while trying to merge MMX instructions into some existing SSE instruction scheduler instregex patterns.

2 years ago[X86][MMX] Remove superfluous 'i' from MMX binop opnames. NFCI.
Simon Pilgrim [Sun, 12 Dec 2021 17:09:40 +0000 (17:09 +0000)]
[X86][MMX] Remove superfluous 'i' from MMX binop opnames. NFCI.

This is a very old copy+paste typo - none of these binops have an immediate operand.

Noticed while trying to merge MMX instructions into some existing SSE instruction scheduler instregex patterns.

2 years ago[gn build] Port abb5dd6e99df
Nico Weber [Sun, 12 Dec 2021 17:39:32 +0000 (12:39 -0500)]
[gn build] Port abb5dd6e99df

(This reverts commit 7d9f11be81850d6c0625fd97b38d0933ef5cb716,
to reland the Ryu code: ae53d02f557c relanded in abb5dd6e99df).

2 years ago[clang-format] [PR49298] Sort includes pass will sort inside raw strings
mydeveloperday [Sun, 12 Dec 2021 17:00:43 +0000 (17:00 +0000)]
[clang-format] [PR49298] Sort includes pass will sort inside raw strings

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

clang-format does not respect raw string literals when sorting includes

```
const char *RawStr = R"(
)";
```

Running clang-format over with SortIncludes enabled transforms this code to:

```
const char *RawStr = R"(
)";
```
The following code tries to minimize this impact during IncludeSorting, by treating R"( and )" as equivalent of // clang-format off/on

Reviewed By: HazardyKnusperkeks, curdeius

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

Fixes #48642

2 years ago[OpenMP] Add "not" to test dependencies.
Michael Kruse [Sun, 12 Dec 2021 16:29:35 +0000 (10:29 -0600)]
[OpenMP] Add "not" to test dependencies.

The `not` program is used to test executions prefixed with `%libomptarget-run-fail-`. Currently `not` is not used for libomp tests, but might be used in the future and its dependency does not add any additional burden over the already established `FileCheck` dependency.

Required to add libomptarget testing to the Phabricator pre-merge check (see https://github.com/google/llvm-premerge-checks/issues/368)

Reviewed By: jdenny, JonChesterfield

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

2 years ago[Target] Use llvm::reverse (NFC)
Kazu Hirata [Sun, 12 Dec 2021 16:34:23 +0000 (08:34 -0800)]
[Target] Use llvm::reverse (NFC)

2 years ago[X86][AVX512] Remove xmm->xmm vpmovsx/vpmovzx rm overrides
Simon Pilgrim [Sun, 12 Dec 2021 16:08:01 +0000 (16:08 +0000)]
[X86][AVX512] Remove xmm->xmm vpmovsx/vpmovzx rm overrides

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

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