platform/upstream/llvm.git
2 years ago[profile] Remove emitting symbolizer markup
Gulfem Savrun Yeniceri [Tue, 12 Oct 2021 17:56:42 +0000 (17:56 +0000)]
[profile] Remove emitting symbolizer markup

Fuchsia Clang code coverage pipeline started to use binary ids that are
embedded in profiles. This patch removes emitting symbolizer markup,
which is not necessary in the coverage pipeline anymore.

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

2 years ago[flang] Fix Windows build (take 2)
peter klausler [Wed, 13 Oct 2021 01:10:33 +0000 (18:10 -0700)]
[flang] Fix Windows build (take 2)

Remove the offending "operator=()" member functions.  This should
silence the MSVC warnings that persist in uint128.h.

2 years ago[RISCV] Optimize immediate materialisation with BCLRI
Ben Shi [Mon, 11 Oct 2021 14:01:37 +0000 (14:01 +0000)]
[RISCV] Optimize immediate materialisation with BCLRI

Do the following optimization for immediate materialisation:

1. For values in range 0xffffffff 7fffffff ~ 0xffffffff 00000000, first
   generate the lower 32-bit with Val|0x80000000 (which is expected be an
   int32), then emit (BCLRI r, 31).

2. For values in range 0x80000000 ~ 0xffffffff, first generate the lower
   32-bit with Val&~0x80000000 (which is expected to be an int32), then
   emit (BSETI r, 31).

Reviewed By: craig.topper

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

2 years ago[mlir][linalg][bufferize][NFC] Remove InSpaceSpec from bufferizesToMemoryWrite
Matthias Springer [Wed, 13 Oct 2021 00:50:43 +0000 (09:50 +0900)]
[mlir][linalg][bufferize][NFC] Remove InSpaceSpec from bufferizesToMemoryWrite

Move functionality into a separate function `isInplaceMemoryWrite`.

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

2 years ago[mlir][linalg][bufferize][NFC] Simplify getAliasingOpOperand signature
Matthias Springer [Wed, 13 Oct 2021 00:38:50 +0000 (09:38 +0900)]
[mlir][linalg][bufferize][NFC] Simplify getAliasingOpOperand signature

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

2 years ago[flang] Fix "latest-clang" build warnings
peter klausler [Wed, 13 Oct 2021 00:40:28 +0000 (17:40 -0700)]
[flang] Fix "latest-clang" build warnings

A recent patch to fix warnings from a Windows build regarding
inconsistent "struct" vs "class" usage missed a few code sites
and now the "latest-clang" build bot is also failing.  This
patch should resolve those failing builds.

2 years ago[mlir][linalg][bufferize][NFC] Simplify allocateBuffersForResults
Matthias Springer [Wed, 13 Oct 2021 00:31:06 +0000 (09:31 +0900)]
[mlir][linalg][bufferize][NFC] Simplify allocateBuffersForResults

Reuse `getResultBuffer`.

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

2 years ago[mlir][linalg][bufferize] Put buffer copying in separate function
Matthias Springer [Wed, 13 Oct 2021 00:23:59 +0000 (09:23 +0900)]
[mlir][linalg][bufferize] Put buffer copying in separate function

This is to avoid code duplication.

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

2 years ago[mlir][linalg][bufferize][NFC] Conflict detection funcs take OpOperand and OpResult
Matthias Springer [Wed, 13 Oct 2021 00:16:29 +0000 (09:16 +0900)]
[mlir][linalg][bufferize][NFC] Conflict detection funcs take OpOperand and OpResult

By doing so, it is not necessary to get the OpOperand a second time via
getAliasingOpOperand. Also, code slightly more readable because we do
not have to deal with Optional<> return value.

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

2 years ago[flang] Fix Windows build
peter klausler [Wed, 13 Oct 2021 00:14:14 +0000 (17:14 -0700)]
[flang] Fix Windows build

A recently added class constructor needs to be "explicit" to
prevent it from being available for use as a conversion, which
is breaking the MSVC build of flang.

2 years ago[mlir][linalg][bufferize][NFC] Reduce code duplication around bufferizableInPlaceAnalysis
Matthias Springer [Wed, 13 Oct 2021 00:08:20 +0000 (09:08 +0900)]
[mlir][linalg][bufferize][NFC] Reduce code duplication around bufferizableInPlaceAnalysis

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

2 years ago[X86] Remove little support we had for MPX
Fangrui Song [Tue, 12 Oct 2021 23:18:51 +0000 (16:18 -0700)]
[X86] Remove little support we had for MPX

GCC 9.1 removed Intel MPX support. Linux kernel removed MPX in 2019.
glibc 2.35 will remove MPX.

Our support is limited: we support assembling of bndmov but not bnd.
Just remove it.

Reviewed By: pengfei, skan

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

2 years ago[lldb][test] Remove Intel MPX tests
Fangrui Song [Tue, 12 Oct 2021 23:16:58 +0000 (16:16 -0700)]
[lldb][test] Remove Intel MPX tests

Intel MPX failed to gain wide adoption and has been deprecated for a while.
GCC 9.1 removed Intel MPX support. Linux kernel removed MPX in 2019.
glibc 2.35 will remove the support.

2 years ago[mlir] update new linalg vectorization tests after vectorization fix
thomasraoux [Tue, 12 Oct 2021 23:09:49 +0000 (16:09 -0700)]
[mlir] update new linalg vectorization tests after vectorization fix

2 years ago[flang] runtime: fix output B/O/Z editing of "negative" values
peter klausler [Mon, 11 Oct 2021 22:41:14 +0000 (15:41 -0700)]
[flang] runtime: fix output B/O/Z editing of "negative" values

B/O/Z integer output editing must not reflect any sign extension
of scalar output values.  Add more size-dependent OutputInteger
I/O APIs and kind instantiations of EditIntegerOutput.

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

2 years ago[flang][NFC] Document extension: scalars are trivially contiguous
peter klausler [Tue, 12 Oct 2021 17:17:02 +0000 (10:17 -0700)]
[flang][NFC] Document extension: scalars are trivially contiguous

The Fortran 2018 standard defines the concept of simple contiguity
in subclause 9.5.4 as a characteristic of arrays.  So that scalars
may also be used in contexts where simply contiguous arrays are
allowed, f18 treats them as single-element arrays that are trivially
contiguous.  This patch documents this semantic extension and
also adds comments to the predicate that implements the concept.

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

2 years ago[flang][NFC] Address warnings from Windows build
peter klausler [Tue, 12 Oct 2021 20:35:28 +0000 (13:35 -0700)]
[flang][NFC] Address warnings from Windows build

An LLVM Flang build bot for Windows recently failed with a
bunch of warning messages.  None were from recent changes to
the Fortran compiler; I suspect that a newer (or maybe older)
version of MSVC was being used, or perhaps a different set of
compiler options were temporarily applied to the build, since
the buildbot status went back to green shortly thereafter.

Most of the warnings looked bogus to me, but some are legitimate
concerns and we might as well clean them up.  This patch does so.

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

2 years ago[sanitizer] Remove StackDepotReverseMap
Vitaly Buka [Tue, 12 Oct 2021 05:18:00 +0000 (22:18 -0700)]
[sanitizer] Remove StackDepotReverseMap

Now StackDepotGet can retrive the stack in O(1).

Depends on D111612.

Reviewed By: dvyukov

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

2 years ago[sanitizer] Remove id and replace link with u32
Vitaly Buka [Tue, 12 Oct 2021 02:44:09 +0000 (19:44 -0700)]
[sanitizer] Remove id and replace link with u32

This lets us reduce size of Node, similar to D111183 proposal.

Depends on D111610.

Reviewed By: dvyukov

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

2 years ago[mlir][linalg] Fix generic reduction vectorization
thomasraoux [Tue, 12 Oct 2021 22:42:02 +0000 (15:42 -0700)]
[mlir][linalg] Fix generic reduction vectorization

We shouldn't broadcast the original value when doing reduction. Instead
we compute the reduction and then combine it with the original value.

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

2 years ago[NFC] Rename EmitAssemblyHelper new/legacy PM methods
Arthur Eubanks [Tue, 12 Oct 2021 21:18:31 +0000 (14:18 -0700)]
[NFC] Rename EmitAssemblyHelper new/legacy PM methods

To reflect the fact that the new PM is the default now.

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

2 years ago[sanitizer] Fix test on Windows
Vitaly Buka [Tue, 12 Oct 2021 22:33:21 +0000 (15:33 -0700)]
[sanitizer] Fix test on Windows

2 years ago[NFC][sanitizer] Add a few consts
Vitaly Buka [Tue, 12 Oct 2021 01:37:25 +0000 (18:37 -0700)]
[NFC][sanitizer] Add a few consts

Depends on D111609.

Reviewed By: dvyukov

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

2 years ago[ORC] Call ExecutorProcessControl::disconnect in unit tests that require it.
Lang Hames [Tue, 12 Oct 2021 21:55:49 +0000 (14:55 -0700)]
[ORC] Call ExecutorProcessControl::disconnect in unit tests that require it.

Another follow-up to 2815ed57e3c and 19b4e3cfc6a. For unit tests that don't use
an ExecutionSession we need to call ExecutorProcessControl::disconnect directly
to wait for the dispatcher to shut down.

https://llvm.org/PR52153

2 years ago[CUDA] Provide address space conversion builtins.
Artem Belevich [Tue, 12 Oct 2021 18:18:30 +0000 (11:18 -0700)]
[CUDA] Provide address space conversion builtins.

CUDA-11 headers rely on these NVCC builtins.
Despite having `__nv` previx, those are *not* provided by libdevice.

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

2 years ago[ORC] Call ExecutionSession::endSession in unit tests.
Lang Hames [Tue, 12 Oct 2021 21:27:39 +0000 (14:27 -0700)]
[ORC] Call ExecutionSession::endSession in unit tests.

2815ed57e3c added calls from ExecutorProcessControl::disconnect implementations
to shut down the TaskDispatcher. We still need to call endSession to trigger
disconnection though. This commit adds the necessary calls to the failing unit
tests.

https://llvm.org/PR52153

2 years ago[clang] Teardown new PM data structures before running codegen pipeline
Arthur Eubanks [Mon, 11 Oct 2021 20:29:58 +0000 (13:29 -0700)]
[clang] Teardown new PM data structures before running codegen pipeline

Do this by refactoring the optimization and codegen pipelines into separate functions.

This saves a tiny bit of memory in non-LTO builds [1].

[1] https://llvm-compile-time-tracker.com/compare.php?from=fbddf22ef72d3c2e9b14e1501841b03380eef12b&to=cd276df52eb6f2b84a8e1efe5318460c6debf82d&stat=max-rss

Reviewed By: dblaikie

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

2 years ago[NFC][sanitizer] Clang-format a line
Vitaly Buka [Tue, 12 Oct 2021 01:33:48 +0000 (18:33 -0700)]
[NFC][sanitizer] Clang-format a line

Depends on D111608.

Reviewed By: dvyukov

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

2 years ago[sanitizer] Re-enable test on Windows
Vitaly Buka [Tue, 12 Oct 2021 21:09:49 +0000 (14:09 -0700)]
[sanitizer] Re-enable test on Windows

It's likely missdiagnosed issue fixed with 336e88636a99c18a4747cb06ad1bc9b590901482

2 years ago[mlir][Linalg] Enable vectorization of 'mul', 'and', 'or' and 'xor' reductions
Diego Caballero [Tue, 12 Oct 2021 20:46:08 +0000 (20:46 +0000)]
[mlir][Linalg] Enable vectorization of 'mul', 'and', 'or' and 'xor' reductions

This patch adds support for vectorizing 'mul', 'and', 'or' anx 'xor' reductions
to Linalg.

Reviewed By: pifon2a, ThomasRaoux, aartbik

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

2 years ago[mlir][Linalg] Enable vectorization of explicit broadcasts
Diego Caballero [Tue, 12 Oct 2021 20:58:06 +0000 (20:58 +0000)]
[mlir][Linalg] Enable vectorization of explicit broadcasts

This patch teaches `isProjectedPermutation` and `inverseAndBroadcastProjectedPermutation`
utilities to deal with maps representing an explicit broadcast, e.g., (d0, d1) -> (d0, 0).
This extension is needed to enable vectorization of such explicit broadcast in Linalg.

Reviewed By: pifon2a, nicolasvasilache

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

2 years ago[lld] fix typos to cycle bots
Nico Weber [Tue, 12 Oct 2021 21:03:22 +0000 (17:03 -0400)]
[lld] fix typos to cycle bots

2 years ago[fir] Add cfg conversion pass
Jean Perier [Tue, 12 Oct 2021 21:00:23 +0000 (23:00 +0200)]
[fir] Add cfg conversion pass

This patch upstream the cfg conversion pass. This pass
rewrite FIR loop-like operation to a CFG.

This patch is part of the upstreaming effort from fir-dev branch.

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
Reviewed By: schweitz

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

2 years ago[NFC][sanitizer] Move consts into on top of the class
Vitaly Buka [Tue, 12 Oct 2021 18:41:45 +0000 (11:41 -0700)]
[NFC][sanitizer] Move consts into on top of the class

2 years ago[sanitizer] Switch StackDepot to TwoLevelMap
Vitaly Buka [Mon, 11 Oct 2021 08:35:43 +0000 (01:35 -0700)]
[sanitizer] Switch StackDepot to TwoLevelMap

Depends on D111607.

Reviewed By: dvyukov

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

2 years ago[instcombine] propagate freeze through single use poison producing flag instruction
Philip Reames [Tue, 12 Oct 2021 20:45:11 +0000 (13:45 -0700)]
[instcombine] propagate freeze through single use poison producing flag instruction

If we have an instruction which produces poison only when flags are specified on the instruction, then we know that freezing the operands and dropping flags is equivalent to freezing the result. If we know those flags don't result in any undefined behavior being executed, then there's no point in preserving the flags as we gain no knowledge by having them.

This patch extends the existing propagation logic which sinks freeze to single potential non-poison operands to allow dropping of flags when we know the freeze is the sole use of the instruction with poison flags.

The main value is that we tend to sink freezes towards the phi in IV cycles where the incoming value to the phi is the freeze of an IV increment. This will in turn (in a future patch), let us fold the freeze through the phi into the loop preheader. Motivated by eliminating need for CanonicalizeFreezeInLoops for the clearly profitable cases from onephi.ll test case in the test directory.

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

2 years ago[sanitizer] Remove SpinMutexLock from stat function
Vitaly Buka [Sun, 10 Oct 2021 06:27:39 +0000 (23:27 -0700)]
[sanitizer] Remove SpinMutexLock from stat function

Mapped size is more appropriate for most users.

Depends on D111605.

Reviewed By: dvyukov

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

2 years ago[PowerPC] Emit dcbt and dcbtst in place of their extended mnemonics on AIX
Albion Fung [Tue, 12 Oct 2021 20:47:44 +0000 (15:47 -0500)]
[PowerPC] Emit dcbt and dcbtst in place of their extended mnemonics on AIX

On AIX, the system assembler does not support the extended mnemonics
dcbtt and dcbtstt. This patch stops them from being emitted on
AIX and emits the base mnemonics instead, dcbt X, X, 16 and
dcbtstt X, X, 16 respectively.

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

2 years ago[ORC] Shut down dispatcher in ExecutorProcessControl implementations.
Lang Hames [Tue, 12 Oct 2021 20:24:54 +0000 (13:24 -0700)]
[ORC] Shut down dispatcher in ExecutorProcessControl implementations.

f3411616896 added a task dispatcher for async handlers, but didn't add a
TaskDispatcher::shutdown call to SelfExecutorProcessControl or SimpleRemoteEPC.
This patch adds the missing call, which ensures that we don't destroy the
dispatcher while tasks are still running.

This should fix the use-after-free crash seen in
https://lab.llvm.org/buildbot/#/builders/5/builds/13063

2 years ago[NFC][sanitizer] Refactor Maps into templates
Vitaly Buka [Mon, 11 Oct 2021 03:15:45 +0000 (20:15 -0700)]
[NFC][sanitizer] Refactor Maps into templates

Depends on D111599.

Reviewed By: dvyukov

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

2 years agoAdd extra tests for D111675
Philip Reames [Tue, 12 Oct 2021 20:37:04 +0000 (13:37 -0700)]
Add extra tests for D111675

2 years ago[sanitizer] Fix test on Windows
Vitaly Buka [Tue, 12 Oct 2021 20:17:55 +0000 (13:17 -0700)]
[sanitizer] Fix test on Windows

UL suffix on MSVC is 32bit.

2 years ago[sanitizer] Fix typo in test
Vitaly Buka [Tue, 12 Oct 2021 19:48:12 +0000 (12:48 -0700)]
[sanitizer] Fix typo in test

2 years ago[PowerPC] Simplify PPC codegen test pre-inc-disable.ll
Roland Froese [Tue, 12 Oct 2021 20:11:34 +0000 (20:11 +0000)]
[PowerPC] Simplify PPC codegen test pre-inc-disable.ll

Simplify the test case to make it easier to look at. Change from auto-generated
checks to targeted manual checks to reduce sensitivity to register allocation
and scheduling changes.

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

2 years ago[mlir][tosa] Fix tosa average_pool2d to linalg type issue
Rob Suderman [Tue, 12 Oct 2021 20:02:29 +0000 (13:02 -0700)]
[mlir][tosa] Fix tosa average_pool2d to linalg type issue

Average pool assumed the same input/output type. Result type for integers
is always an i32, should be updated appropriately.

Reviewed By: GMNGeoffrey

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

2 years agoDebugInfo: Add test coverage for non-zero addrx in DW_FORM_LLVM_addrx_offset
David Blaikie [Tue, 12 Oct 2021 19:26:24 +0000 (12:26 -0700)]
DebugInfo: Add test coverage for non-zero addrx in DW_FORM_LLVM_addrx_offset

Noticed in code review
https://github.com/llvm/llvm-project/commit/4318028cd2d7633a0cdeb0b5d4d2ed81fab87864#commitcomment-57738034

But the issue had already been fixed in
943b3048484b7e3cf04f4d51c23c82fcece2185d due to a code checking tool
(PVS studio) identification, but that lacked test coverage.

Refactor this test a little bit too by using more CHECK-SAME to help the
checks fail sooner (rather than, if the addrx or sizes are wrong, having
that check bind to a much later output line - and then fail due to the
implicit-check-nots, which don't provide a lot of information about
where the intended check was likely to land) & more informatively.

2 years agoDebugInfo: Update ranges_always.ll to include more details about how to generate...
David Blaikie [Mon, 11 Oct 2021 19:59:26 +0000 (12:59 -0700)]
DebugInfo: Update ranges_always.ll to include more details about how to generate the IR

Also modify the test to be more robust (current IR generation doesn't
include call sites for callees that are only declared but not defined -
so the test case couldn't be regenerated - add a function definition (&
optnone attribute) so it doesn't depend on call sites for
declared-but-not-defined functions)

2 years ago[flang] Fix build on FreeBSD (need size_t)
peter klausler [Tue, 12 Oct 2021 18:50:26 +0000 (11:50 -0700)]
[flang] Fix build on FreeBSD (need size_t)

Add #include <cstddef> to time-intrinsic.h so std::size_t is
guaranteed to be available.

2 years ago[mlir][python] Add nameloc getter
Jacques Pienaar [Tue, 12 Oct 2021 19:45:57 +0000 (12:45 -0700)]
[mlir][python] Add nameloc getter

Expose the nameloc getter to Python API.

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

2 years ago[tests] Add coverage for cases we can drop flags to propagate freeze without cost
Philip Reames [Tue, 12 Oct 2021 19:01:36 +0000 (12:01 -0700)]
[tests] Add coverage for cases we can drop flags to propagate freeze without cost

2 years ago[LV] Fix 2nd crash for reverse interleaved groups under mask/fold-tail.
Ayal Zaks [Sun, 29 Aug 2021 22:24:21 +0000 (01:24 +0300)]
[LV] Fix 2nd crash for reverse interleaved groups under mask/fold-tail.

This patch fixes another crash revealed by PR51614:
when *deciding* to vectorize with masked interleave groups, check if the access
is reverse (which is currently not supported).

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

2 years ago[GlobalISel] Add support for constant vector folding of binops in CSEMIRBuilder.
Amara Emerson [Mon, 11 Oct 2021 06:38:34 +0000 (23:38 -0700)]
[GlobalISel] Add support for constant vector folding of binops in CSEMIRBuilder.

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

2 years agoRemove checks for old gcc versions for LLVM_ATTRIBUTE_*
Arthur Eubanks [Mon, 11 Oct 2021 21:45:34 +0000 (14:45 -0700)]
Remove checks for old gcc versions for LLVM_ATTRIBUTE_*

According to [1] we only support gcc 5.1+. So these checks for older gcc versions are not supported.

Some gcc 5.1+ versions still don't support __has_builtin, so just check __GNUC__ in those cases.

Add a missing #endif for LLVM_ATTRIBUTE_UNREACHABLE.

[1] https://llvm.org/docs/GettingStarted.html#host-c-toolchain-both-compiler-and-standard-library

Reviewed By: MaskRay

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

2 years ago[libc] Add strncat and fix strcat
Michael Jones [Mon, 11 Oct 2021 22:11:39 +0000 (22:11 +0000)]
[libc] Add strncat and fix strcat

This adds strncat to llvm libc. In addition, an error was found with
strcat and that was fixed.

Reviewed By: lntue

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

2 years ago[mlir][linalg] Enable the vector transfer lowering by default.
Tobias Gysi [Tue, 12 Oct 2021 17:43:47 +0000 (17:43 +0000)]
[mlir][linalg] Enable the vector transfer lowering by default.

Adapt CodegenStartegy to used the vector transfer lowering patterns by default.

Reviewed By: nicolasvasilache

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

2 years ago[sanitizer] Fix StackDepotPrintAll
Vitaly Buka [Tue, 12 Oct 2021 04:29:06 +0000 (21:29 -0700)]
[sanitizer] Fix StackDepotPrintAll

unlock corrupted backets by using s set by loop to nullptr.
Also StackDepot supports iterating without locking.

Reviewed By: dvyukov

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

2 years ago[docs] [NFC] Clarify the datalayout documentation
William Woodruff [Tue, 12 Oct 2021 17:47:10 +0000 (23:17 +0530)]
[docs] [NFC] Clarify the datalayout documentation

This patch fixes a couple of small oversights in the documentation for
the datalayout specification:

* The v and f specifications are subject to the same constraints on <size>
as i is.
* The p[n] specification didn't mark <idx> as optional, despite
being documented and parsed as such.
* Similarly, none of the alignment specifications require <pref>.

2 years ago[FPEnv][InstSimplify] Precommit tests: Enable more folds for constrained fsub
Kevin P. Neal [Tue, 12 Oct 2021 17:42:58 +0000 (13:42 -0400)]
[FPEnv][InstSimplify] Precommit tests: Enable more folds for constrained fsub

Precommit tests for D107285 as requested. TODO notes left at individual
functions also as requested.

2 years ago[Inline] Make sure the InlineAdvisor is correctly cleared.
Mircea Trofin [Mon, 11 Oct 2021 23:43:28 +0000 (16:43 -0700)]
[Inline] Make sure the InlineAdvisor is correctly cleared.

If another inlining session came after a ModuleInlinerWrapperPass, the
advisor alanysis would still be cached, but its Result would be cleared.
We need to clear both.

This addresses PR52118

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

2 years ago[analyzer] Fix non-obvious analyzer warning: Use of zero-allocated memory.
Artem Dergachev [Tue, 12 Oct 2021 17:19:35 +0000 (10:19 -0700)]
[analyzer] Fix non-obvious analyzer warning: Use of zero-allocated memory.

Clarify the message provided when the analyzer catches the use of memory
that is allocated with size zero.

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

2 years ago[gn build] Port 9cf995be6bb7
LLVM GN Syncbot [Tue, 12 Oct 2021 17:32:05 +0000 (17:32 +0000)]
[gn build] Port 9cf995be6bb7

2 years ago[gn build] Port 838b4a533e68
LLVM GN Syncbot [Tue, 12 Oct 2021 17:32:04 +0000 (17:32 +0000)]
[gn build] Port 838b4a533e68

2 years ago[gn build] (manually) port 67f94e5a9745
Nico Weber [Tue, 12 Oct 2021 17:31:50 +0000 (13:31 -0400)]
[gn build] (manually) port 67f94e5a9745

2 years ago[clang/CFG] Don't explicitly add AttributedStmtClass to AlwaysAddList
Nico Weber [Mon, 11 Oct 2021 18:26:09 +0000 (14:26 -0400)]
[clang/CFG] Don't explicitly add AttributedStmtClass to AlwaysAddList

CFGBuilder::addStmt() implicitly passes AddStmtChoice::AlwaysAdd
to Visit() already, so this should have no behavior change.

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

2 years ago[X86] `detectAVGPattern()`: don't require zext in the with-constant case
Roman Lebedev [Tue, 12 Oct 2021 17:24:17 +0000 (20:24 +0300)]
[X86] `detectAVGPattern()`: don't require zext in the with-constant case

2 years ago[NFC][X86] Add another test case for PR52131
Roman Lebedev [Tue, 12 Oct 2021 17:19:18 +0000 (20:19 +0300)]
[NFC][X86] Add another test case for PR52131

2 years ago[Support][ORC] Add an explicit release operation to OwningMemoryBlock.
Lang Hames [Tue, 12 Oct 2021 16:48:29 +0000 (09:48 -0700)]
[Support][ORC] Add an explicit release operation to OwningMemoryBlock.

This gives OwningMemoryBlock clients a way to check for errors on release.

rdar://84127175

2 years ago[NFC][X86] `detectAVGPattern()`: rely on `AVGSplitter()` to perform truncation
Roman Lebedev [Tue, 12 Oct 2021 17:11:45 +0000 (20:11 +0300)]
[NFC][X86] `detectAVGPattern()`: rely on `AVGSplitter()` to perform truncation

2 years ago[mlir][Shape] Add a pattern to turn extract from shape_of into tensor.dim
Benjamin Kramer [Tue, 12 Oct 2021 16:01:54 +0000 (18:01 +0200)]
[mlir][Shape] Add a pattern to turn extract from shape_of into tensor.dim

If I remember correctly this wasn't done previously because dim used to
be in the memref dialect.

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

2 years ago[AMDGPU] Promote generic pointer kernel arguments into global
Stanislav Mekhanoshin [Fri, 8 Oct 2021 20:04:32 +0000 (13:04 -0700)]
[AMDGPU] Promote generic pointer kernel arguments into global

The new pass walks kernel's pointer arguments, then loads from them.
If a loaded value is a pointer and loaded pointer is unmodified in
the kernel before the load, then promote loaded pointer to global.
Then recursively continue.

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

2 years ago[InstCombine] propagate no-wrap flag through select-of-mul fold
Sanjay Patel [Tue, 12 Oct 2021 16:18:29 +0000 (12:18 -0400)]
[InstCombine] propagate no-wrap flag through select-of-mul fold

This may not be obvious, but Alive2 agrees:
https://alive2.llvm.org/ce/z/Ld9qNT

If the mul has "nsw", then -1 * INT_MIN is poison, so the
negate can also have "nsw" because 0 - INT_MIN is poison.

If the mul has "nuw", then that means the "OtherOp" can only
be 0 or 1 (anything else multiplied by 0xfff... would wrap).
So the replacement negate must be "nsw" because it is either
"0-0" or "0-1".

This is another regression noticed with a planned follow-up
to D111410.

2 years ago[InstCombine] add tests with nsw/nuw for mul-of-select; NFC
Sanjay Patel [Tue, 12 Oct 2021 15:47:03 +0000 (11:47 -0400)]
[InstCombine] add tests with nsw/nuw for mul-of-select; NFC

2 years ago[X86] `detectAVGPattern()`: support basic case of PAVG chaining (PR52131)
Roman Lebedev [Tue, 12 Oct 2021 16:43:51 +0000 (19:43 +0300)]
[X86] `detectAVGPattern()`: support basic case of PAVG chaining (PR52131)

As noted in https://github.com/halide/Halide/pull/6302,
we hilariously fail to match PAVG if we even as much
as look at it the wrong way.

In this particular case, the problem stems from the fact that
`PAVG` root (def) is a `trunc`, and leafs (uses) are `zext`'s,
and InstCombine really loves to get rid of both of these,
for example replace them with a bit mask. So we may not have
said `zext`.

Instead of checking for that + type match,
i think we should rely on the actual active type,
as per the knownbits.

Reviewed By: RKSimon

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

2 years ago[X86] `detectAVGPattern()`: small preparatory NFC refactor
Roman Lebedev [Tue, 12 Oct 2021 16:42:24 +0000 (19:42 +0300)]
[X86] `detectAVGPattern()`: small preparatory NFC refactor

2 years agoAdded OpenMP 5.0 specification based semantic checks for CRITICAL construct name...
Nimish Mishra [Tue, 12 Oct 2021 16:44:21 +0000 (22:14 +0530)]
Added OpenMP 5.0 specification based semantic checks for CRITICAL construct name resolution

As reported in https://bugs.llvm.org/show_bug.cgi?id=48145, name resolution for omp critical construct was failing. This patch adds functionality to help that name resolution as well as implementation to catch name mismatches.

The following semantic restrictions are therefore handled here:

- If a name is specified on a critical directive, the same name must also be specified on the end critical directive

- If no name appears on the critical directive, no name can appear on the end critical directive

- If a name appears on either the start critical directive or the end critical directive

Reviewed By: kiranchandramohan

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

2 years ago[CSSPGO] Unblock optimizations with pseudo probe instrumentation part 3.
Hongtao Yu [Thu, 30 Sep 2021 16:13:41 +0000 (09:13 -0700)]
[CSSPGO] Unblock optimizations with pseudo probe instrumentation part 3.

This patch continues unblocking optimizations that are blocked by pseudo probe instrumentation.

Not exactly like DbgIntrinsics, PseudoProbe intrinsic has other attributes (such as mayread, maywrite, mayhaveSideEffect) that can block optimizations. The issues fixed are:
- Flipped default param of getFirstNonPHIOrDbg API to skip pseudo probes
- Unblocked CSE by avoiding pseudo probe from clobbering memory SSA
- Unblocked induction variable simpliciation
- Allow empty loop deletion by treating probe intrinsic isDroppable
- Some refactoring.

Reviewed By: wenlei

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

2 years ago[flang] More work on SYSTEM_CLOCK runtime API and implementation
peter klausler [Wed, 6 Oct 2021 21:03:48 +0000 (14:03 -0700)]
[flang] More work on SYSTEM_CLOCK runtime API and implementation

To get proper wrap-around behavior for the various kind parameter
values of the optional COUNT= and COUNT_MAX= dummy arguments to
the intrinsic subroutine SYSTEM_CLOCK, add an extra argument to
the APIs for lowering to pass the integer kind of the actual argument.
Avoid confusion by requiring that both actual arguments have the same
kind when both are present.  The results of the runtime functions
remain std::int64_t and lowering should still convert them before
storing to the actual argument variables.

Rework the implementation a bit to accomodate the dynamic
specification of the kind parameter, and to clean up some coding
issues with preprocessing and templates.

Use the kind of the COUNT=/COUNT_MAX= actual arguments to determine
the clock's resolution, where possible, in conformance with other
Fortran implementations.

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

2 years ago[AST, CodeGen, Driver] Use llvm::is_contained (NFC)
Kazu Hirata [Tue, 12 Oct 2021 16:19:48 +0000 (09:19 -0700)]
[AST, CodeGen, Driver] Use llvm::is_contained (NFC)

2 years ago[TableGen] Fix both sides of '&&' are same
Craig Topper [Tue, 12 Oct 2021 15:46:08 +0000 (08:46 -0700)]
[TableGen] Fix both sides of '&&' are same

The operand of the second any_of in EnforceSmallerThan should be
B not S like the FP code in the if below.

Unfortunately, fixing that causes an infinite loop in the build
of RISCV. So I've added a workaround for that as well.

Fixes PR44768.

Reviewed By: RKSimon

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

2 years ago[Clang][clang-nvlink-wrapper] Pass nvlink path to the wrapper
Saiyedul Islam [Sat, 9 Oct 2021 12:06:11 +0000 (12:06 +0000)]
[Clang][clang-nvlink-wrapper] Pass nvlink path to the wrapper

Added support of a "--nvlink-path" option in clang-nvlink-wrapper which
takes the path of nvlink binary.

Static Device Library support for OpenMP (D105191) now searches for
nvlink binary and passes its location via this option. In absence
of this option, nvlink binary is searched in locations in PATH.

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

2 years ago[libc++] Use addressof to fix debug tests.
Mark de Wever [Sun, 10 Oct 2021 13:18:46 +0000 (15:18 +0200)]
[libc++] Use addressof to fix debug tests.

Fixes the tests added in D110852 for the debug iterators.

Similar issues with hijacking `operator&` still exist, they will be
addressed separately.

Reviewed By: #libc, ldionne, Quuxplusone

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

2 years agoScatter NDEBUG to fix after 838b4a533e6
Jeremy Morse [Tue, 12 Oct 2021 16:05:51 +0000 (17:05 +0100)]
Scatter NDEBUG to fix after 838b4a533e6

These "dump" methods call into MachineOperand::dump, which doesn't exist
with NDEBUG, thus we croak. Disable LiveDebugValues dump methods when
NDEBUG is turned on to avoid this.

2 years ago[libcxx][AIX] Explicitly include localedef.h in locale.cpp
David Tenty [Tue, 12 Oct 2021 15:53:12 +0000 (11:53 -0400)]
[libcxx][AIX] Explicitly include localedef.h in locale.cpp

This header was transitively included to provide the definition of
__lc_ctype_ptr that we use on AIX, but that is fragile as it depends on
the settings of compatibility macros, so we explicitly include it here
to avoid that scenario.

Reviewed By: #libc, ldionne

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

2 years ago[mlir][sparse] add action enum, group enums together, few asserts
Aart Bik [Tue, 12 Oct 2021 00:11:13 +0000 (17:11 -0700)]
[mlir][sparse] add action enum, group enums together, few asserts

Some random changes that were hanging around in my workspace. Also,
a tiny step towards creating a header file for the sparse utils lib.

Reviewed By: bixia

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

2 years ago[mlir][vector] Add folder for no-op InsertStridedSliceOp
Lei Zhang [Tue, 12 Oct 2021 15:39:56 +0000 (11:39 -0400)]
[mlir][vector] Add folder for no-op InsertStridedSliceOp

Reviewed By: nicolasvasilache

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

2 years ago[mlir] Limit Python dependency to Development.Module when possible.
Mike Urbach [Mon, 11 Oct 2021 23:23:42 +0000 (16:23 -0700)]
[mlir] Limit Python dependency to Development.Module when possible.

After CMake 3.18, we are able to limit the scope of the search to just
Development.Module. Searching for Development will fail in situations
where the Python libraries are not available. When possible, limit to
just Development.Module. See:
https://pybind11.readthedocs.io/en/stable/compiling.html#findpython-mode

Reviewed By: stellaraccident

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

2 years ago[libc++] Update atomic synopsis and tests.
Mark de Wever [Sun, 6 Jun 2021 12:48:08 +0000 (14:48 +0200)]
[libc++] Update atomic synopsis and tests.

While looking at LWG-2988 and P0558 it seems the issues were already
implemented, but the synopsis wasn't updated. Some of the tests didn't
validate the `noexcept` status. A few tests were missing completely:
- `atomic_wait_explicit`
- `atomic_notify_one`
- `atomic_notify_all`

Mark P0558 as complete, didn't investigate which version of libc++ first
includes this. It seems the paper has been retroactively applied. I
couldn't find whether this is correct, but looking at cppreference it
seems intended.

Completes
- LWG-2988 Clause 32 cleanup missed one typename
- P0558 Resolving atomic<T> named base class inconsistencies

Reviewed By: #libc, ldionne

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

2 years ago[libcxx] [test] Make windows triples in XFAILs less specific
Martin Storsjö [Fri, 27 Aug 2021 10:09:19 +0000 (10:09 +0000)]
[libcxx] [test] Make windows triples in XFAILs less specific

This allows picking up on mingw triples that often use 'w64' instead
of 'pc' as the vendor part.

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

2 years agoRevert "[AMDGPU] Enable load clustering in the post-RA scheduler"
Jay Foad [Tue, 12 Oct 2021 15:19:35 +0000 (16:19 +0100)]
Revert "[AMDGPU] Enable load clustering in the post-RA scheduler"

This reverts commit 66e13c7f439cf162d7ed1d25883e71a5755ac7ec.

It was committed by accident.

2 years ago[TwoAddressInstruction] Remove ad hoc machine verification
Jay Foad [Tue, 12 Oct 2021 08:15:07 +0000 (09:15 +0100)]
[TwoAddressInstruction] Remove ad hoc machine verification

With the -early-live-intervals command line flag,
TwoAddressInstructionPass::runOnMachineFunction would call
MachineFunction::verify before returning to check the live intervals.
But there was not much benefit to doing this since -verify-machineinstrs
and LLVM_ENABLE_EXPENSIVE_CHECKS provide a more general way of
scheduling machine verification after every pass.

Also it caused problems on targets like Lanai which are marked as "not
machine verifier clean", since verification would fail for known
target-specific problems which are nothing to do with LiveIntervals.

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

2 years ago[AMDGPU] Enable load clustering in the post-RA scheduler
Jay Foad [Tue, 12 Oct 2021 14:39:43 +0000 (15:39 +0100)]
[AMDGPU] Enable load clustering in the post-RA scheduler

This has a couple of benefits:
1. It can sometimes fix clusters that got broken apart when the register
   allocator inserted a copy.
2. Post-RA scheduling does not have to worry about increasing register
   pressure, which in some cases gives it more freedom to reorder
   instructions.

Testing on a collection of 10,000 graphics shaders compiled for gfx1010
showed:
- The average length of each run of one or more load instructions
  increased by about 1%.
- The number of runs of two or more load instructions increased by
  about 4%.

2 years ago[DebugInfo][NFC] Move LiveDebugValues class to header
Jeremy Morse [Tue, 12 Oct 2021 14:55:46 +0000 (15:55 +0100)]
[DebugInfo][NFC] Move LiveDebugValues class to header

This patch shifts the InstrRefBasedLDV class declaration to a header.
Partially because it's already massive, but mostly so that I can start
writing some unit tests for it. This patch also adds the boilerplate for
said unit tests.

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

2 years ago[mlir][linalg] Add switch to disable/enable vector transfer lowering.
Tobias Gysi [Tue, 12 Oct 2021 14:53:33 +0000 (14:53 +0000)]
[mlir][linalg] Add switch to disable/enable vector transfer lowering.

Add a switch to code gen strategy to disable/enable the vector transfer lowering and disable it by default.

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

2 years ago[AArch64][SVE] Add fixed type lowering for EXTRACT_SUBVECTOR
Bradley Smith [Tue, 5 Oct 2021 12:20:58 +0000 (12:20 +0000)]
[AArch64][SVE] Add fixed type lowering for EXTRACT_SUBVECTOR

Depends on D111135

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

2 years ago[clang] p0388 array list initialization overloads
Nathan Sidwell [Fri, 21 May 2021 18:34:23 +0000 (11:34 -0700)]
[clang] p0388 array list initialization overloads

This is the second part of p0388, dealing with overloads of list
initialization to incomplete array types.  It extends the handling
added in D103088 to permit incomplete arrays.  We have to record that
the conversion involved an incomplete array, and so (re-add) a bit flag
into the standard conversion sequence object.  Comparing such
conversion sequences requires knowing (a) the number of array elements
initialized and (b) whether the initialization is of an incomplete array.

This also updates the web page to indicate p0388 is implemented (there
is no feature macro).

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

2 years ago[clang] p0388 conversion to incomplete array
Nathan Sidwell [Thu, 20 May 2021 20:31:31 +0000 (13:31 -0700)]
[clang] p0388 conversion to incomplete array

This implements the new implicit conversion sequence to an incomplete
(unbounded) array type.  It is mostly Richard Smith's work, updated to
trunk, testcases added and a few bugs fixed found in such testing.

It is not a complete implementation of p0388.

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

2 years ago[clang-tidy] Update documentation of check bugprone-unused-return-value [NFC].
Balázs Kéri [Tue, 12 Oct 2021 14:43:16 +0000 (16:43 +0200)]
[clang-tidy] Update documentation of check bugprone-unused-return-value [NFC].

The list of checked functions was incomplete in the description.

Reviewed By: aaron.ballman, steakhal

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

2 years ago[mlir][linalg] Add vector transfer lowering patters to codegen strategy.
Tobias Gysi [Tue, 12 Oct 2021 13:50:25 +0000 (13:50 +0000)]
[mlir][linalg] Add vector transfer lowering patters to codegen strategy.

Add the vector transfer patterns and introduce the max transfer rank option on the codegen strategy.

Reviewed By: nicolasvasilache

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

2 years ago[lldb/lua] Supplement Lua bindings for lldb module
Siger Yang [Tue, 12 Oct 2021 14:08:05 +0000 (22:08 +0800)]
[lldb/lua] Supplement Lua bindings for lldb module

Add necessary typemaps for Lua bindings, together with some other files.

Signed-off-by: Siger Yang <sigeryeung@gmail.com>
Reviewed By: tammela

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

2 years agoRemove 'IgnoreDestructors = true' from cppcoreguidelines-explicit-virtual-functions
Carlos Galvez [Tue, 12 Oct 2021 14:05:43 +0000 (10:05 -0400)]
Remove 'IgnoreDestructors = true' from cppcoreguidelines-explicit-virtual-functions

This requirement was introduced in the C++ Core guidelines in 2016:

https://github.com/isocpp/CppCoreGuidelines/commit/1894380d0abf4d7d49a983005647e0d41ecbf214

Then clang-tidy got updated to comply with the rule.

However in 2019 this decision was reverted:

https://github.com/isocpp/CppCoreGuidelines/commit/5fdfb20b760c5307bf86873798a146fcd7e912e6

Therefore we need to apply the correct configuration to
clang-tidy again.

This also makes this cppcoreguidelines check consistent
with the other 2 alias checks: hicpp-use-override and
modernize-use-override.

Additionally, add another RUN line to the unit test,
to make sure cppcoreguidelines-explicit-virtual-functions
is tested.