platform/upstream/llvm.git
2 years ago[gn build] Port dd71b65ca85d
LLVM GN Syncbot [Wed, 13 Oct 2021 14:58:13 +0000 (14:58 +0000)]
[gn build] Port dd71b65ca85d

2 years ago[llvm-reduce] Introduce operands-to-args pass.
Michael Kruse [Wed, 13 Oct 2021 14:05:54 +0000 (09:05 -0500)]
[llvm-reduce] Introduce operands-to-args pass.

Instead of setting operands to undef as the "operands" pass does,
convert the operands to a function argument. This avoids having to
introduce undef values into the IR which have some unpredictability
during optimizations.

For instance,

    define void @func() {
    entry:
      %val = add i32 32, 21
      store i32 %val, i32* null
      ret void
    }

is reduced to

    define void @func(i32 %val) {
    entry:
      %val1 = add i32 32, 21
      store i32 %val, i32* null
      ret void
    }

(note that the instruction %val is renamed to %val1 when printing
the IR to avoid ambiguity; ideally %val1 would be removed by dce or the
instruction reduction pass)

Any call to @func is replaced with a call to the function with the
new signature and filled with undef. This is not ideal for IPA passes,
but those out-of-scope for now.

Reviewed By: aeubanks

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

2 years ago[InstCombine] improve code comments; NFC
Sanjay Patel [Wed, 13 Oct 2021 14:40:44 +0000 (10:40 -0400)]
[InstCombine] improve code comments; NFC

2 years ago[PowerPC][Builtin] Allowing __rlwnm to accept a variable as a shift parameter
Kamau Bridgeman [Wed, 6 Oct 2021 13:33:26 +0000 (08:33 -0500)]
[PowerPC][Builtin] Allowing __rlwnm to accept a variable as a shift parameter

The builtin __rlwnm is currently constrained to accept only constants
for the shift parameter but the instructions emitted for it have no such
constraint, this patch allows the builtins to accept variable shift.

Reviewed By: NeHuang, amyk

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

2 years ago[InstCombine] allow matching vector splat constants in foldLogOpOfMaskedICmps()
Sanjay Patel [Wed, 13 Oct 2021 14:15:26 +0000 (10:15 -0400)]
[InstCombine] allow matching vector splat constants in foldLogOpOfMaskedICmps()

This is NFC-intended for scalar code. There are still unnecessary
m_ConstantInt restrictions in surrounding code, so this is not a
complete fix.

This prevents regressions seen with a planned follow-on to D111410.

2 years ago[InstCombine] add vector splat tests for foldLogOpOfMaskedICmps(); NFC
Sanjay Patel [Wed, 13 Oct 2021 13:39:16 +0000 (09:39 -0400)]
[InstCombine] add vector splat tests for foldLogOpOfMaskedICmps(); NFC

There's a substantial pile of scalar tests for transforms that
depend on this code, but zero vector coverage. This patch adds
a vector test next to the first scalar test in each file that
is affected by foldLogOpOfMaskedICmps.

The code that handles these transforms is artificially limited
from working with vector splat constants.

2 years ago[lldb][NFC] for-range loop when iterating over delayed_properties
Raphael Isemann [Wed, 13 Oct 2021 12:05:25 +0000 (14:05 +0200)]
[lldb][NFC] for-range loop when iterating over delayed_properties

2 years ago[mlir] Fix typos in the Python bindings doc
Alex Zinenko [Wed, 13 Oct 2021 12:40:49 +0000 (14:40 +0200)]
[mlir] Fix typos in the Python bindings doc

2 years ago[mlir][python] Provide some methods and properties for API completeness
Alex Zinenko [Mon, 11 Oct 2021 16:24:48 +0000 (18:24 +0200)]
[mlir][python] Provide some methods and properties for API completeness

When writing the user-facing documentation, I noticed several inconsistencies
and asymmetries in the Python API we provide. Fix them by adding:

- the `owner` property to regions, similarly to blocks;
- the `isinstance` method to any class derived from `PyConcreteAttr`,
  `PyConcreteValue` and `PyConreteAffineExpr`, similar to `PyConcreteType` to
  enable `isa`-like calls without having to handle exceptions;
- a mechanism to create the first block in the region as we could only create
  blocks relative to other blocks, with is impossible in an empty region.

Reviewed By: gysit

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

2 years agoFollow up a3936a6c19c to work around an old compiler bug
Jeremy Morse [Wed, 13 Oct 2021 12:27:25 +0000 (13:27 +0100)]
Follow up a3936a6c19c to work around an old compiler bug

Old versions of gcc want template specialisations to happen within the
namespace where the template lives; this is still present in gcc 5.1, which
we officially support, so it has to be worked around.

2 years ago[libc++abi][ci] Add a from-scratch config for libc++abi on Apple/system
Louis Dionne [Tue, 12 Oct 2021 21:45:45 +0000 (17:45 -0400)]
[libc++abi][ci] Add a from-scratch config for libc++abi on Apple/system

I came across an issue where since we build the library for Apple with
the install name directory being /usr/lib, which means that if we don't
run the tests with DYLD_LIBRARY_PATH, we'll end up loading the
system-provided libc++abi when running the tests. That wreaks havoc.

Instead of fixing it in the legacy config file, this commit introduces
an Apple libc++abi config file that does the right thing.

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

2 years ago[libc++abi] Change LIBCXXABI_NO_TIMER to LIBCXXABI_USE_TIMER
Louis Dionne [Tue, 12 Oct 2021 18:15:33 +0000 (14:15 -0400)]
[libc++abi] Change LIBCXXABI_NO_TIMER to LIBCXXABI_USE_TIMER

Instead of always defining LIBCXXABI_NO_TIMER to run the tests, only
define LIBCXXABI_USE_TIMER when we want to enable the timer. This makes
the libc++abi testing configuration simpler.

As a fly-by fix, remove the unused LIBUNWIND_NO_TIMER macro from libunwind.

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

2 years ago[DebugInfo][InstrRef] Use PHI placement utilities for machine locations
Jeremy Morse [Wed, 13 Oct 2021 11:35:35 +0000 (12:35 +0100)]
[DebugInfo][InstrRef] Use PHI placement utilities for machine locations

InstrRefBasedLDV used to try and determine which values are in which
registers using a lattice approach; however this is hard to understand, and
broken in various ways. This patch replaces that approach with a standard
SSA approach using existing LLVM utilities. PHIs are placed at dominance
frontiers; value propagation then eliminates un-necessary PHIs.

This patch also adds a bunch of unit tests that should cover many of the
weirder forms of control flow.

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

2 years ago[RISCV] After reverting _mt builtins, add `ta` argument for LLVM IR.
Hsiangkai Wang [Wed, 13 Oct 2021 06:35:56 +0000 (14:35 +0800)]
[RISCV] After reverting _mt builtins, add `ta` argument for LLVM IR.

Previous patch only reverts C builtins for tail policy. In order to keep
LLVM IR intact, add the `ta` argument in vector builtins.

2 years agoRevert "[RISCV] (2/2) Add the tail policy argument to builtins/intrinsics."
Hsiangkai Wang [Wed, 13 Oct 2021 06:50:45 +0000 (14:50 +0800)]
Revert "[RISCV] (2/2) Add the tail policy argument to builtins/intrinsics."

This reverts commit 7afa61e71877a5b7892ffe4992f804cd84807240.

2 years ago[clang][NFC] Correct doc markup
Nathan Sidwell [Wed, 13 Oct 2021 11:19:39 +0000 (04:19 -0700)]
[clang][NFC] Correct doc markup

Spotted when implementing an extension.

2 years ago[clangd] TargetFinder: Fix assert-crash on TemplateExpansion args.
Adam Czachorowski [Tue, 12 Oct 2021 14:52:09 +0000 (16:52 +0200)]
[clangd] TargetFinder: Fix assert-crash on TemplateExpansion args.

Previously we would call getAsTemplate() when kind == TemplateExpansion,
which triggers an assertion. The call is now replaced with
getAsTemplateOrTemplatePattern(), which is exactly the same as
getAsTemplate(), except it allows calls when kind == TemplateExpansion.

No change in behavior for no-assert builds.

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

2 years ago[lldb][NFC] Split out DW_TAG_inheritance parsing into own function
Raphael Isemann [Tue, 12 Oct 2021 13:03:31 +0000 (15:03 +0200)]
[lldb][NFC] Split out DW_TAG_inheritance parsing into own function

Just moving that block inside DWARFASTParserClang::ParseChildMembers into
its own function. Also early-exiting instead of a large if when
num_attributes is 0.

2 years ago[doc][clang] correct version for p0388 implementation
Nathan Sidwell [Wed, 13 Oct 2021 11:07:58 +0000 (04:07 -0700)]
[doc][clang] correct version for p0388 implementation

The p0388 patch series took so long, the clang version was incorrect,
and I failed to realize that.

2 years ago[SVE][CodeGen] Add patterns for ADD/SUB + element count
Kerry McLaughlin [Wed, 13 Oct 2021 09:24:43 +0000 (10:24 +0100)]
[SVE][CodeGen] Add patterns for ADD/SUB + element count

This patch adds patterns to match the following with INC/DEC:
 - @llvm.aarch64.sve.cnt[b|h|w|d] intrinsics + ADD/SUB
 - vscale + ADD/SUB

For some implementations of SVE, INC/DEC VL is not as cheap as ADD/SUB and
so this behaviour is guarded by the "use-scalar-inc-vl" feature flag, which for SVE
is off by default. There are no known issues with SVE2, so this feature is
enabled by default when targeting SVE2.

Reviewed By: david-arm

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

2 years ago[NFC] Added test for PR50339
Dávid Bolvanský [Wed, 13 Oct 2021 10:15:44 +0000 (12:15 +0200)]
[NFC] Added test for PR50339

2 years ago[NFC] Added test for PR49927
Dávid Bolvanský [Wed, 13 Oct 2021 09:46:37 +0000 (11:46 +0200)]
[NFC] Added test for PR49927

2 years ago[X86][SSE] Add X86ISD::AVG to isCommutativeBinOp to support folding shuffles through...
Simon Pilgrim [Wed, 13 Oct 2021 09:47:20 +0000 (10:47 +0100)]
[X86][SSE] Add X86ISD::AVG to isCommutativeBinOp to support folding shuffles through the binop

2 years ago[X86][SSE] Add tests showing missing shuffle(avg(shuffle(),shuffle())) -> avg(shuffle...
Simon Pilgrim [Wed, 13 Oct 2021 09:25:18 +0000 (10:25 +0100)]
[X86][SSE] Add tests showing missing shuffle(avg(shuffle(),shuffle())) -> avg(shuffle(),shuffle()) fold

X86ISD::AVG needs to be added to isCommutativeBinOp to use these folds.

2 years ago[clang][modules] Avoid using uninitialized SourceLocation
Jan Svoboda [Wed, 13 Oct 2021 09:23:46 +0000 (11:23 +0200)]
[clang][modules] Avoid using uninitialized SourceLocation

At this point, `F.ImportLoc` has not been initialized by the `ASTReader` yet and using it leads to an assertion failure.

Introduced in 638c673a8c3e27b6532049ac17ac9bc96640fc45 and 444513510999e4c1ea23253654196793834d53bf.

2 years agoAvoid one branch in Operation::getOpOperand()/getOperand() (NFC)
Mehdi Amini [Wed, 13 Oct 2021 09:06:59 +0000 (09:06 +0000)]
Avoid one branch in Operation::getOpOperand()/getOperand() (NFC)

Skip the check on "hasOperandStorage" since the array will be indexed anyway.

Reviewed By: rriddle

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

2 years ago[NFC][CSKY] Remove unneeded MC test case
Zi Xuan Wu [Wed, 13 Oct 2021 08:51:46 +0000 (16:51 +0800)]
[NFC][CSKY] Remove unneeded MC test case

2 years ago[analyzer] Introduce the assume-controlled-environment config option
Balazs Benics [Wed, 13 Oct 2021 08:50:26 +0000 (10:50 +0200)]
[analyzer] Introduce the assume-controlled-environment config option

If the `assume-controlled-environment` is `true`, we should expect `getenv()`
to succeed, and the result should not be considered tainted.
By default, the option will be `false`.

Reviewed By: NoQ, martong

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

2 years ago[analyzer] Bifurcate on getenv() calls
Balazs Benics [Wed, 13 Oct 2021 08:50:26 +0000 (10:50 +0200)]
[analyzer] Bifurcate on getenv() calls

The `getenv()` function might return `NULL` just like any other function.
However, in case of `getenv()` a state-split seems justified since the
programmer should expect the failure of this function.

`secure_getenv(const char *name)` behaves the same way but is not handled
right now.
Note that `std::getenv()` is also not handled.

Reviewed By: martong

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

2 years ago[flang] Implement GET_ENVIRONMENT_VARIABLE(LENGTH)
Diana Picus [Thu, 7 Oct 2021 13:44:14 +0000 (13:44 +0000)]
[flang] Implement GET_ENVIRONMENT_VARIABLE(LENGTH)

Search for the environment variable in the envp string passed to
ProgramStart. This doesn't work if the main program isn't Fortran.

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

2 years ago[fir][NFC] Remove unused variable
Valentin Clement [Wed, 13 Oct 2021 08:37:56 +0000 (01:37 -0700)]
[fir][NFC] Remove unused variable

2 years ago[mlir][python] Expose CallSiteLoc Python side
Jacques Pienaar [Wed, 13 Oct 2021 08:02:12 +0000 (10:02 +0200)]
[mlir][python] Expose CallSiteLoc Python side

This exposes creating a CallSiteLoc with a callee & list of frames for
callers. Follows the creation approach in C++ side where a list of
frames may be provided.

Reviewed By: ftynse

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

2 years agoRevert "[fir] Update clang-tidy for the Optimizer directory"
Valentin Clement [Wed, 13 Oct 2021 07:29:54 +0000 (09:29 +0200)]
Revert "[fir] Update clang-tidy for the Optimizer directory"

This reverts commit edec659f480f02642461cebd422ab35152cdfd23.

2 years ago[mlir] Make OpResult usable with DenseSet etc.
Matthias Springer [Wed, 13 Oct 2021 06:22:49 +0000 (15:22 +0900)]
[mlir] Make OpResult usable with DenseSet etc.

`DenseSet<Value>` works but `DenseSet<OpResult>` currently results in a compile error.

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

2 years ago[WebAssembly] Make EH work with dynamic linking
Heejin Ahn [Wed, 29 Sep 2021 21:17:14 +0000 (14:17 -0700)]
[WebAssembly] Make EH work with dynamic linking

This makes Wasm EH work with dynamic linking. So far we were only able
to handle destructors, which do not use any tags or LSDA info.

1. This uses `TargetExternalSymbol` for `GCC_except_tableN` symbols,
   which points to the address of per-function LSDA info. It is more
   convenient to use than `MCSymbol` because it can take additional
   target flags.

2. When lowering `wasm_lsda` intrinsic, if PIC is enabled, make the
   symbol relative to `__memory_base` and generate the `add` node. If
   PIC is disabled, continue to use the absolute address.

3. Make tag symbols (`__cpp_exception` and `__c_longjmp`) undefined in
   the backend, because it is hard to make it work with dynamic
   linking's loading order. Instead, we make all tag symbols undefined
   in the LLVM backend and import it from JS.

4. Add support for undefined tags to the linker.

Companion patches:
- https://github.com/WebAssembly/binaryen/pull/4223
- https://github.com/emscripten-core/emscripten/pull/15266

Reviewed By: sbc100

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

2 years ago[Polly] Fix unused variable in non-assert builds. NFC.
Michael Kruse [Wed, 13 Oct 2021 04:57:01 +0000 (23:57 -0500)]
[Polly] Fix unused variable in non-assert builds. NFC.

2 years ago[JITLink][MachO][arm64] Mask high bits out of immediate for LDRLiteral19.
Lang Hames [Wed, 13 Oct 2021 04:51:12 +0000 (21:51 -0700)]
[JITLink][MachO][arm64] Mask high bits out of immediate for LDRLiteral19.

Negative deltas for LDRLiteral19 have their high bits set. If these bits aren't
masked out then they will overwrite other instruction bits, leading to a bogus
encoding.

This long-standing relocation bug was exposed by e50aea58d59, "[JITLink][ORC]
Major JITLinkMemoryManager refactor.", which caused memory layouts to be
reordered, which in turn lead to a previously unseen negative delta. (Unseen
because LDRLiteral19s were only created in JITLink passes where they always
pointed at segments that were layed-out-after in the old layout).

No testcase yet: Our existing regression test infrastructure is good at checking
that operand bits are correct, but provides no easy way to test for bad opcode
bits. I'll have a think about the right way to approach this.

https://llvm.org/PR52153

2 years ago[Polly] Do not inline dumpIslObj methods. NFC.
Michael Kruse [Wed, 13 Oct 2021 03:17:01 +0000 (22:17 -0500)]
[Polly] Do not inline dumpIslObj methods. NFC.

Instead of being inline and having a neverCalled() workaround to make it
work in the debugger, define it as a regular exported function.

Also add overloads for the C API types isl_* so it works with managed as
well as unmanaged ISL objects.

2 years ago[Support][mips] Remove unnecessary includes from Memory.inc
Visa Hankala [Tue, 12 Oct 2021 19:24:58 +0000 (22:24 +0300)]
[Support][mips] Remove unnecessary includes from Memory.inc

The mips-specific includes have been unnecessary ever since the
__clear_cache() builtin replaced cacheflush().

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

2 years agoRevert "[RISCV] Define _m intrinsics as builtins, instead of macros."
Hsiangkai Wang [Wed, 13 Oct 2021 03:42:38 +0000 (11:42 +0800)]
Revert "[RISCV] Define _m intrinsics as builtins, instead of macros."

This reverts commit 97f0c63783f52389bd8842df205379ceade7a89d.

As discussed in https://reviews.llvm.org/D110684, it increased the
compile time and the binary size of clang more than 1%. I reverted
this patch first to think about a better way to do it.

2 years ago[mlir][python] Add a warning for cmake version < 3.15.
Stella Laurenzo [Wed, 13 Oct 2021 02:32:48 +0000 (19:32 -0700)]
[mlir][python] Add a warning for cmake version < 3.15.

As discussed on discord, we have never actually been able to build with the project-wide published min version of 3.14.3. The buildbot that tests the Python configuration is currently pinned to 3.19.1, and there are a number of non-version/policy controlled features that Python building relies on that makes it unreliable with older versions. Some of the issues are pretty fundamental and I don't know how to do them on the older version. I think that, as an optional feature, at least advertising the PSA as in this patch is a good middle ground until the next project-wide CMake version bump.

Also moves setup logic to a macro so that everyone can use it.

2 years ago[tests] Add coverage for follow ons to D111675
Philip Reames [Wed, 13 Oct 2021 03:35:27 +0000 (20:35 -0700)]
[tests] Add coverage for follow ons to D111675

2 years agoFix bug introduced with 6f34839 (poison flags on floating point ops)
Philip Reames [Wed, 13 Oct 2021 03:23:22 +0000 (20:23 -0700)]
Fix bug introduced with 6f34839 (poison flags on floating point ops)

The newly introduced API for checking whether poison comes solely from flags which can be dropped was out of sync.  This was noticed by a reviewer post commit.

For the moment, disable the floating point flags.  In a follow up change, I plan to add support in dropPoisonGeneratingFlags, but that deserves to be a change of it's own.

2 years ago[MLIR] Replace std ops with arith dialect ops
Mogball [Tue, 12 Oct 2021 23:14:57 +0000 (23:14 +0000)]
[MLIR] Replace std ops with arith dialect ops

Precursor: https://reviews.llvm.org/D110200

Removed redundant ops from the standard dialect that were moved to the
`arith` or `math` dialects.

Renamed all instances of operations in the codebase and in tests.

Reviewed By: rriddle, jpienaar

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

2 years ago[compiler-rt][profile] Enable profile tests for AIX
Jinsong Ji [Wed, 13 Oct 2021 02:20:27 +0000 (02:20 +0000)]
[compiler-rt][profile] Enable profile tests for AIX

This patch enable profile test for supported options on AIX.

Reviewed By: w2yehia

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

2 years ago[libc++][docs] Mark LWG3274 as complete
Joe Loser [Wed, 13 Oct 2021 02:30:58 +0000 (22:30 -0400)]
[libc++][docs] Mark LWG3274 as complete

Mark LWG3274 as complete. The feature test macro `__cpp_lib_span` was added in
`6d2599e4f776d0cd88438cb82a00c4fc25cc3f67`.

https://wg21.link/p1024 mentions marking `span:::empty()` with
`[[nodiscard]]` which is not done yet. So, do that and add tests.

Reviewed By: ldionne, Quuxplusone, Mordante, #libc

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

2 years agoImprove printing of const variable sized arrays
David Blaikie [Tue, 12 Oct 2021 22:24:05 +0000 (15:24 -0700)]
Improve printing of const variable sized arrays

Follow-on from 40acc0adad59ac39e9a7a02fcd93161298500c00 with help from
Richard Smith on how to provoke this particular case.

2 years ago[mlir][SPIRVToLLVM] Solve ExecutionModeOp redefinition and add OpTypeSampledImage...
Weiwei Li [Wed, 13 Oct 2021 01:59:38 +0000 (09:59 +0800)]
[mlir][SPIRVToLLVM] Solve ExecutionModeOp redefinition and add OpTypeSampledImage into SPV_Type

1. To avoid two ExecutionModeOp using the same name, adding the value of execution mode in name when converting to LLVM dialect.
2. To avoid syntax error in spv.OpLoad, add OpTypeSampledImage into SPV_Type.

Reviewed by:antiagainst

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

2 years ago[flang] Fixing Windows build (take 3)
peter klausler [Wed, 13 Oct 2021 01:57:58 +0000 (18:57 -0700)]
[flang] Fixing Windows build (take 3)

Add explicit casts to replace implicit conversions and
recently deleted assignment operators from uint128.h
used in runtime/edit-output.cpp.

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