7 months ago[CMake][compiler-rt][AArch64] Avoid preprocessing LSE builtins separately
Raul Tambre [Sun, 13 Dec 2020 14:48:26 +0000 (16:48 +0200)]
[CMake][compiler-rt][AArch64] Avoid preprocessing LSE builtins separately

Invoking the preprocessor ourselves is fragile and would require us to replicate CMake's handling of definitions, compiler flags, etc for proper compatibility.
In my toolchain builds this notably resulted in a bunch of warnings from unused flags as my CMAKE_C_FLAGS includes CPU-specific optimization options.
Notably this part was already duplicating the logic for VISIBILITY_HIDDEN define.

Instead, symlink the files and set the proper set of defines on each.
This should also be faster as we avoid invoking the compiler multiple times.

Fixes https://llvm.org/PR48494

Reviewed By: ilinpv

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

7 months agoFix test expectation to cope with custom version namespaces.
Richard Smith [Mon, 14 Dec 2020 06:41:19 +0000 (22:41 -0800)]
Fix test expectation to cope with custom version namespaces.

7 months agoConsider reference, pointer, and pointer-to-member TemplateArguments to be different...
Richard Smith [Sun, 15 Nov 2020 01:37:25 +0000 (17:37 -0800)]
Consider reference, pointer, and pointer-to-member TemplateArguments to be different if they have different types.

For the Itanium ABI, this implements the mangling rule suggested in
https://github.com/itanium-cxx-abi/cxx-abi/issues/47, namely mangling
such template arguments as being cast to the parameter type in the case
where the template name is overloadable. This can cause a mangling
change for rare cases, where

 * the template argument declaration is converted from its declared type
   to the type of the template parameter, and
 * the template parameter either has a deduced type or is a parameter of
   a function template.

However, such changes are necessary to avoid mangling collisions. The
ABI changes can be reversed with -fclang-abi-compat=11 or earlier.

Re-commit with a fix for the regression introduced last time: don't
expect parameters and arguments to line up inside an <unresolved-name>

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

7 months agoFactor out and centralize repeated 'getExpandedPackSize'.
Richard Smith [Sun, 13 Dec 2020 08:50:01 +0000 (00:50 -0800)]
Factor out and centralize repeated 'getExpandedPackSize'.

7 months ago[SLP][Test] Precommit test for D93192
Anton Afanasyev [Sun, 13 Dec 2020 11:00:08 +0000 (14:00 +0300)]
[SLP][Test] Precommit test for D93192

This test shows failure of combined stores chains vectorization

7 months ago[MachineCombiner][NFC] Add MustReduceRegisterPressure goal
Chen Zheng [Wed, 25 Nov 2020 02:33:13 +0000 (21:33 -0500)]
[MachineCombiner][NFC] Add MustReduceRegisterPressure goal

add a new goal MustReduceRegisterPressure for machine combiner pass.

PowerPC will use this new goal to do some register pressure related optimization.

Reviewed By: spatel

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

7 months ago[CodeGen] Use llvm::erase_value (NFC)
Kazu Hirata [Mon, 14 Dec 2020 04:05:47 +0000 (20:05 -0800)]
[CodeGen] Use llvm::erase_value (NFC)

7 months ago[Target] Use llvm::is_contained (NFC)
Kazu Hirata [Mon, 14 Dec 2020 03:35:10 +0000 (19:35 -0800)]
[Target] Use llvm::is_contained (NFC)

7 months ago[opt][NPM] Pin -lower-amx-type to legacy PM
Arthur Eubanks [Mon, 14 Dec 2020 03:13:48 +0000 (19:13 -0800)]
[opt][NPM] Pin -lower-amx-type to legacy PM

This is part of the codegen pipeline.

7 months agoRe-apply 8904ee8ac7e with missing header included this time.
Lang Hames [Mon, 14 Dec 2020 02:38:00 +0000 (13:38 +1100)]
Re-apply 8904ee8ac7e with missing header included this time.

7 months agoRevert "[JITLink] Add JITLinkDylib type, thread through JITLinkMemoryManager APIs."
Nico Weber [Mon, 14 Dec 2020 02:30:38 +0000 (21:30 -0500)]
Revert "[JITLink] Add JITLinkDylib type, thread through JITLinkMemoryManager APIs."

This reverts commit 8904ee8ac7ebcc50a60de0914abc6862e28b6664.
Didn't `git add` llvm/ExecutionEngine/JITLink/JITLinkDylib.h and hence doesn't
build anywhere.

7 months ago[JITLink] Add JITLinkDylib type, thread through JITLinkMemoryManager APIs.
Lang Hames [Mon, 14 Dec 2020 00:14:25 +0000 (11:14 +1100)]
[JITLink] Add JITLinkDylib type, thread through JITLinkMemoryManager APIs.

JITLinkDylib represents a target dylib for a JITLink link. By representing this
explicitly we can:
  - Enable JITLinkMemoryManagers to manage allocations on a per-dylib basis
    (e.g by maintaining a seperate allocation pool for each JITLinkDylib).
  - Enable new features and diagnostics that require information about the
    target dylib (not implemented in this patch).

7 months ago[JITLink] Fix include guard end comment.
Lang Hames [Sun, 13 Dec 2020 23:41:07 +0000 (10:41 +1100)]
[JITLink] Fix include guard end comment.

7 months ago[ORC] Prefer preincrement on iterator.
Lang Hames [Sun, 13 Dec 2020 08:53:18 +0000 (19:53 +1100)]
[ORC] Prefer preincrement on iterator.

7 months ago[clangd] Fix locateMacroAt() for macro definition outside preamble
Nathan Ridge [Sun, 8 Nov 2020 07:58:17 +0000 (02:58 -0500)]
[clangd] Fix locateMacroAt() for macro definition outside preamble

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

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

7 months ago[NFC][AMDGPU] Reformat AMD GPU targets in cuda.cpp
Tony [Sun, 13 Dec 2020 00:38:40 +0000 (00:38 +0000)]
[NFC][AMDGPU] Reformat AMD GPU targets in cuda.cpp

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

7 months ago[X86] Add ExeDomain = SSEPackedSingle to cvtss2sd and cvtsd2ss instrutions.
Craig Topper [Sun, 13 Dec 2020 20:35:24 +0000 (12:35 -0800)]
[X86] Add ExeDomain = SSEPackedSingle to cvtss2sd and cvtsd2ss instrutions.

Prep for D92993

7 months ago[X86] Add isel patterns to form VPDPWSSD from (add (vpmaddwd X, Y), Z) when AVXVNNI...
Craig Topper [Sun, 13 Dec 2020 19:44:38 +0000 (11:44 -0800)]
[X86] Add isel patterns to form VPDPWSSD from (add (vpmaddwd X, Y), Z) when AVXVNNI is enabled.

We already have these patterns for AVX512VNNI.

7 months ago[AC] Handle (X+C1)<C2 assumes (PR48408)
Nikita Popov [Sun, 13 Dec 2020 19:56:20 +0000 (20:56 +0100)]
[AC] Handle (X+C1)<C2 assumes (PR48408)

InstCombine canonicalizes X>C && X<C' style comparisons into
(X+C1)<C2. This type of expression is recognized by some analyses
like LVI, but currently not when used inside assumptions, because
AssumptionCache does not track affected values for it.

7 months ago[X86] Extend varargs test
Harald van Dijk [Sun, 13 Dec 2020 18:33:10 +0000 (18:33 +0000)]
[X86] Extend varargs test

This extends the existing x86-64-varargs test by passing enough
arguments that they need to be passed in memory, and by passing them in
reverse order, using va_arg for each argument to retrieve them and
restoring them to the correct order, and by using va_copy to have two
va_lists to use with va_arg.

7 months ago[Analysis] Remove unused declaration replaceEdgeKey (NFC)
Kazu Hirata [Sun, 13 Dec 2020 18:03:45 +0000 (10:03 -0800)]
[Analysis] Remove unused declaration replaceEdgeKey (NFC)

The declaration was introduced without a corresponding definition on
Feb 9, 2017 in commit aaad9f84be2a6a3eb8202ed4eaa5e5e2021d055e.

7 months ago[Transforms] Use llvm::erase_value (NFC)
Kazu Hirata [Sun, 13 Dec 2020 17:48:47 +0000 (09:48 -0800)]
[Transforms] Use llvm::erase_value (NFC)

7 months ago[NFC]{AMDGPU] Update AMDGPUUsage with AMD RDNA 2 reference
Tony [Sun, 13 Dec 2020 01:06:18 +0000 (01:06 +0000)]
[NFC]{AMDGPU] Update AMDGPUUsage with AMD RDNA 2 reference

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

7 months ago[X86][SSE] combineX86ShufflesRecursively - add basic handling for combining shuffles...
Simon Pilgrim [Sun, 13 Dec 2020 17:18:07 +0000 (17:18 +0000)]
[X86][SSE] combineX86ShufflesRecursively - add basic handling for combining shuffles of different widths (PR45974)

If a faux shuffle uses smaller shuffle inputs, try to recursively combine with those inputs directly instead of widening them immediately. Then widen all smaller inputs at the bottom of the recursion.

This will still mean we're generating nodes on the fly (PR45974) even if we don't combine to a new shuffle but it does help AVX2+ targets combine across xmm/ymm/zmm types, mainly as variable shuffles.

7 months ago[X86][AVX] Add additional X86ISD::SUBV_BROADCAST_LOAD test case for D92645
Simon Pilgrim [Sun, 13 Dec 2020 16:43:17 +0000 (16:43 +0000)]
[X86][AVX] Add additional X86ISD::SUBV_BROADCAST_LOAD test case for D92645

Suggested by @yubing - to check whether we can reuse a single subvector broadcast for 128/256/512-bit vectors.

7 months ago[VPlan] Use interleaveComma in printOperands() (NFC).
Florian Hahn [Sun, 13 Dec 2020 16:28:22 +0000 (16:28 +0000)]
[VPlan] Use interleaveComma in printOperands() (NFC).

7 months agoRecommit "[AArch64] Lower calls with rv_marker attribute."
Florian Hahn [Sun, 13 Dec 2020 15:46:13 +0000 (15:46 +0000)]
Recommit "[AArch64] Lower calls with rv_marker attribute."

This recommits a87fccb3ff9c with a fix to mark the destination operand
of the marker instruction as def, to fix a machine verifier failure.

This reverts the revert commit c0f2cea7c0afc7c9688e1633f2a9b25c8ea4a9bd.

7 months ago[X86] Convert fadd/fmul _mm_reduce_* intrinsics to emit llvm.reduction intrinsics...
Simon Pilgrim [Sun, 13 Dec 2020 15:37:35 +0000 (15:37 +0000)]
[X86] Convert fadd/fmul _mm_reduce_* intrinsics to emit llvm.reduction intrinsics (PR47506)

Followup to D87604, having confirmed on PR47506 that we can use the llvm codegen expansion for fadd/fmul as well.

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

7 months ago[X86][SSE] combineReductionToHorizontal - add vXi8 ISD::MUL reduction handling (PR39709)
Simon Pilgrim [Sun, 13 Dec 2020 15:16:21 +0000 (15:16 +0000)]
[X86][SSE] combineReductionToHorizontal - add vXi8 ISD::MUL reduction handling (PR39709)

Default expansion leads to repeated extensions/truncations to/from vXi16 which shuffle combining and demanded elts can't completely unravel.

Better just to promote (any_extend) the input and perform a vXi16 reduction.

We'll be able to remove a lot of this if we ever get decent legalization support for reduction intrinsics in SelectionDAG.

7 months agoDon't emit on op diagnostic in reproducer emission
Jacques Pienaar [Sun, 13 Dec 2020 15:21:32 +0000 (07:21 -0800)]
Don't emit on op diagnostic in reproducer emission

This avoids dumping the module post emitting a reproducer, which results in
many MB logs where a reproducer has already been neatly generated.

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

7 months ago[MLIR][SPIRV] Add support for GLSL F/U/SClamp.
ergawy [Sun, 13 Dec 2020 14:56:37 +0000 (09:56 -0500)]
[MLIR][SPIRV] Add support for GLSL F/U/SClamp.

Adds support for 3 ternary ops from SPIR-V extended instructions for
GLSL. Namely, adds support for FClamp, UClamp, and SClamp.

Reviewed By: antiagainst

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

7 months ago[X86] Regenerate vector-reduce-mul.ll with common check prefixes. NFC.
Simon Pilgrim [Wed, 9 Dec 2020 18:18:50 +0000 (18:18 +0000)]
[X86] Regenerate vector-reduce-mul.ll with common check prefixes. NFC.

Try to merge AVX1/AVX2/AVX512 codegen checks where possible

7 months ago[clang-format] Remove double trim
Björn Schäpers [Sat, 28 Nov 2020 04:58:58 +0000 (05:58 +0100)]
[clang-format] Remove double trim

Lines[i] is already trimmed 3 lines before

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

7 months ago[BasicAA] Handle known non-zero variable index
Nikita Popov [Thu, 10 Dec 2020 21:29:33 +0000 (22:29 +0100)]
[BasicAA] Handle known non-zero variable index

BasicAA currently handles cases like Scale*V0 + (-Scale)*V1 where
V0 != V1, but does not handle the simpler case of Scale*V with
V != 0. Add it based on an isKnownNonZero() call.

I'm not passing a context instruction for now, because the existing
approach of always using GEP1 for context could result in symmetry

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

7 months ago[VE] Optimize toolchain regression test
Kazushi (Jam) Marukawa [Thu, 10 Dec 2020 08:53:07 +0000 (17:53 +0900)]
[VE] Optimize toolchain regression test

Optimize toolchain regression test for VE by removing not a useful test
(-fuse-init-array test) and merge several tests to one test which checks
default behavior of driver.  Also add sysroot to reduce conflicts.

These are suggested in https://reviews.llvm.org/D92996.
Thank you so much.

Reviewed By: MaskRay

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

7 months ago[lldb] [Process/FreeBSD] Add more 'override' keywords
Michał Górny [Sun, 13 Dec 2020 08:18:41 +0000 (09:18 +0100)]
[lldb] [Process/FreeBSD] Add more 'override' keywords

7 months ago[mlir] Use mlir::OpState::operator->() to get to methods of mlir::Operation.
Christian Sigg [Sat, 12 Dec 2020 09:50:41 +0000 (10:50 +0100)]
[mlir] Use mlir::OpState::operator->() to get to methods of mlir::Operation.

This is a preparation step to remove those methods from OpState.

Reviewed By: mehdi_amini

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

7 months ago[AsmParser] Fix support for zero bit integer types.
Chris Lattner [Sun, 13 Dec 2020 05:24:18 +0000 (21:24 -0800)]
[AsmParser] Fix support for zero bit integer types.

Zero bit integer types are supported by IntegerType for consistency,
but the asmparser never got updated. Allow them to be parsed, as
required to fix CIRCT issue #316

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

7 months ago[mlir] Add Python binding for MLIR Dict Attribute
kweisamx [Sun, 13 Dec 2020 03:06:32 +0000 (03:06 +0000)]
[mlir] Add Python binding for MLIR Dict Attribute

Reviewed By: mehdi_amini

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

7 months ago[mac/arm] Deflake 3 check-llvm tests
Nico Weber [Sun, 13 Dec 2020 02:10:52 +0000 (21:10 -0500)]
[mac/arm] Deflake 3 check-llvm tests

On macOS/arm, signature verification has kill semantics by default.
Signature verification is cached with a file's inode (actually, vnode),
and if a new executable is copied over an existing file (which reuses
the inode), the cache isn't invalidated. So when the new executable
is executed, the kernel still has the old content's signature cached
and the kills the executable because the old signatue doesn't match
the new contents (https://openradar.appspot.com/FB8914243).

As workaround, rm the desitnation files first, to ensure they have
a fresh vnode (and hence no stale cached signature) after the copy.

Part of PR46647. See also e0e334a9c1ac for a similar change.

7 months agoX86: Correcting X86OutgoingValueHandler typo (NFC)
Chris Sears [Sat, 12 Dec 2020 15:23:55 +0000 (10:23 -0500)]
X86: Correcting X86OutgoingValueHandler typo (NFC)


7 months agofix typos to cycle bots
Nico Weber [Sun, 13 Dec 2020 01:19:33 +0000 (20:19 -0500)]
fix typos to cycle bots

7 months agofix typo to cycle bots
Nico Weber [Sun, 13 Dec 2020 01:16:14 +0000 (20:16 -0500)]
fix typo to cycle bots

7 months agomac/arm: XFAIL the last 2 failing check-llvm tests
Nico Weber [Sun, 13 Dec 2020 01:11:14 +0000 (20:11 -0500)]
mac/arm: XFAIL the last 2 failing check-llvm tests

We should fix them, but let's XFAIL them for now so that we can start
running check-llvm on bots and lock in the passing tests.

Part of PR46647.

7 months ago[ELF][test] Rewrite st_value=0 copy relocation tests
Fangrui Song [Sun, 13 Dec 2020 00:50:25 +0000 (16:50 -0800)]
[ELF][test] Rewrite st_value=0 copy relocation tests

The original tests have unneeded symbols and copy-relocation-zero-abs-addr.s
does not actually test anything.

Rewrite them and add copy-relocation-zero-addr.s instead.

Add --soname=b so that the address 0x203400 will be stable.  (When linking an
executable with %t.so, the path %t.so will be recorded in the DT_NEEDED entry if
%t.so doesn't have DT_SONAME. .dynstr will have varying lengths on different

7 months ago[mac/arm] skip MappedMemoryTest that try to map w+x
Nico Weber [Sun, 13 Dec 2020 00:44:10 +0000 (19:44 -0500)]
[mac/arm] skip MappedMemoryTest that try to map w+x

macOS/arm is w^x, so these tests don't work. Fixes these failures:

  LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.AllocAndRelease/5
  LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.AllocAndReleaseHuge/5
  LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.BasicWrite/5
  LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.DuplicateNear/5
  LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.EnabledWrite/3
  LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.EnabledWrite/4
  LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.EnabledWrite/5
  LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.MultipleAllocAndRelease/5
  LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.MultipleWrite/5
  LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.SuccessiveNear/5
  LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.UnalignedNear/5
  LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroNear/5
  LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroSizeNear/5

Part of PR46647.

7 months ago[X86] Autogenerate complete checks. NFC
Craig Topper [Sun, 13 Dec 2020 00:37:28 +0000 (16:37 -0800)]
[X86] Autogenerate complete checks. NFC

7 months ago[[GlobalISel][IRTranslator] Fix a crash when the use of an extractvalue is a non...
Amara Emerson [Sat, 12 Dec 2020 22:57:36 +0000 (14:57 -0800)]
[[GlobalISel][IRTranslator] Fix a crash when the use of an extractvalue is a non-dominated metadata use.

We don't expect uses to come before defs in the CFG, so allocateVRegs() asserted.

Fixes PR48211

7 months ago[SimplifyCFG] FoldBranchToCommonDest(): bonus instrns must only be used by PHI nodes...
Roman Lebedev [Sat, 12 Dec 2020 12:48:58 +0000 (15:48 +0300)]
[SimplifyCFG] FoldBranchToCommonDest(): bonus instrns must only be used by PHI nodes in successors (PR48450)

In particular, if the successor block, which is about to get a new
predecessor block, currently only has a single predecessor,
then the bonus instructions will be directly used within said successor,
which is fine, since the block with bonus instructions dominates that
successor. But once there's a new predecessor, the IR is no longer valid,
and we don't fix it, because we only update PHI nodes.

Which means, the live-out bonus instructions must be exclusively used
by the PHI nodes in successor blocks. So we have to form trivial PHI nodes.
which will then be successfully updated to recieve cloned bonus instns.

This all works fine, except for the fact that we don't have access to
the dominator tree, and we don't ignore unreachable code,
so we sometimes do end up having to deal with some weird IR.

Fixes https://bugs.llvm.org/show_bug.cgi?id=48450

7 months ago[PPC] Check for PPC64 when emitting 64bit specific VSX nodes when pattern matching...
Zarko Todorovski [Sat, 12 Dec 2020 20:22:57 +0000 (15:22 -0500)]
[PPC] Check for PPC64 when emitting 64bit specific VSX nodes when pattern matching built vectors

Some of the pattern matching in PPCInstrVSX.td and node lowering involving vectors assumes 64bit mode.  This patch disables some of the unsafe pattern matching and lowering of BUILD_VECTOR in 32bit mode.

Reviewed By: Xiangling_L

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

7 months ago[CodeGen][AMDGPU] Fix ICE for static initializer IR generation
Alexey Bader [Mon, 7 Dec 2020 19:47:48 +0000 (22:47 +0300)]
[CodeGen][AMDGPU] Fix ICE for static initializer IR generation

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

7 months ago[mac/arm] XFAIL two more tests on arm64-apple
Nico Weber [Sat, 12 Dec 2020 20:19:50 +0000 (15:19 -0500)]
[mac/arm] XFAIL two more tests on arm64-apple

Part of PR46644

7 months ago[CVP] Simplify and generalize switch handling
Nikita Popov [Sat, 12 Dec 2020 19:34:45 +0000 (20:34 +0100)]
[CVP] Simplify and generalize switch handling

CVP currently handles switches by checking an equality predicate
on all edges from predecessor blocks. Of course, this can only
work if the value being switched over is defined in a different block.

Replace this implementation with a call to getPredicateAt(), which
also does the predecessor edge predicate check (if not defined in
the same block), but can also do quite a bit more: It can reason
about phi-nodes by checking edge predicates for incoming values,
it can reason about assumes, and it can reason about block values.

As such, this makes the implementation both simpler and more
powerful. The compile-time impact on CTMark is in the noise.

7 months agomac/arm: XFAIL the last 3 failing tests
Nico Weber [Sat, 12 Dec 2020 20:08:19 +0000 (15:08 -0500)]
mac/arm: XFAIL the last 3 failing tests

We should fix them, but let's XFAIL them for now so that we can start
running check-clang on bots and lock in the passing tests.

Part of 46644.

7 months ago[CVP] Add additional switch tests (NFC)
Nikita Popov [Sat, 12 Dec 2020 19:47:23 +0000 (20:47 +0100)]
[CVP] Add additional switch tests (NFC)

These cover cases handled by getPredicateAt(), but not by the
current implementation:

 * Assumes based on context instruction.
 * Value from phi node in same block (using per-pred reasoning).
 * Value from non-phi node in same block (using block-val reasoning).

7 months ago[Hexagon] Reconsider getMask fix, return original mask, convert later
Krzysztof Parzyszek [Sat, 12 Dec 2020 19:19:36 +0000 (13:19 -0600)]
[Hexagon] Reconsider getMask fix, return original mask, convert later

The getPayload/getMask/getPassThrough functions should return values
that could be composed into a masked load/store without any additional
type casts. The previous fix violated that.
Instead, convert scalar mask to a vector right before rescaling.

7 months ago[AMDGPU] Add missing targets to target-invalid-cpu-note.c
Tony [Thu, 10 Dec 2020 10:01:14 +0000 (10:01 +0000)]
[AMDGPU] Add missing targets to target-invalid-cpu-note.c

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

7 months ago[AMDGPU] Add missing targets to amdgpu-features.cl
Tony [Thu, 10 Dec 2020 09:59:16 +0000 (09:59 +0000)]
[AMDGPU] Add missing targets to amdgpu-features.cl

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

7 months ago[NFC][AMDGPU] AMDGPUUsage updates
Tony [Thu, 10 Dec 2020 03:38:32 +0000 (03:38 +0000)]
[NFC][AMDGPU] AMDGPUUsage updates

- Document which processors are supported by which runtimes.
- Add missing mappings for code object V2 note records

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

7 months ago[mlir] Print bad size in AttrSizedOperandSegments
Brian Gesiak [Fri, 11 Dec 2020 22:57:34 +0000 (17:57 -0500)]
[mlir] Print bad size in AttrSizedOperandSegments

When printing verification errors for ops with the incorrect number of
operand segments, print the required number as well as the actual
number. Split off from D93005.

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

7 months ago[Analysis/Interval] Remove isLoop (NFC)
Kazu Hirata [Sat, 12 Dec 2020 18:09:35 +0000 (10:09 -0800)]
[Analysis/Interval] Remove isLoop (NFC)

The last use of isLoop was removed on Apr 29, 2002 in commit
09bbb5c015c6e40b3d45da057f955ddb7c8f8485 as part of an effort to
remove "old induction varaible cannonicalization pass built on top of
interval analysis".

7 months ago[Transforms] Use is_contained (NFC)
Kazu Hirata [Sat, 12 Dec 2020 17:37:49 +0000 (09:37 -0800)]
[Transforms] Use is_contained (NFC)

7 months ago[Hexagon] Create vector masks for scalar loads/stores
Krzysztof Parzyszek [Sat, 12 Dec 2020 16:05:30 +0000 (10:05 -0600)]
[Hexagon] Create vector masks for scalar loads/stores

AlignVectors treats all loaded/stored values as vectors of bytes,
and masks as corresponding vectors of booleans, so make getMask
produce a 1-element vector for scalars from the start.

7 months ago[UpdateTestChecks] Add --(no-)x86_scrub_sp option.
Harald van Dijk [Sat, 12 Dec 2020 17:11:13 +0000 (17:11 +0000)]
[UpdateTestChecks] Add --(no-)x86_scrub_sp option.

This makes it possible to use update_llc_test_checks to manage tests
that check for incorrect x86 stack offsets. It does not yet modify any
test to make use of this new option.

7 months ago[X86] Avoid data16 prefix for lea in x32 mode
Harald van Dijk [Sat, 12 Dec 2020 17:05:24 +0000 (17:05 +0000)]
[X86] Avoid data16 prefix for lea in x32 mode

The ABI demands a data16 prefix for lea in 64-bit LP64 mode, but not in
64-bit ILP32 mode. In both modes this prefix would ordinarily be
ignored, but the instructions may be changed by the linker to
instructions that are affected by the prefix.

Reviewed By: RKSimon

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

7 months ago[ARM] Add basic masked load/store costs
David Green [Sat, 12 Dec 2020 15:26:32 +0000 (15:26 +0000)]
[ARM] Add basic masked load/store costs

This adds some basic MVE masked load/store costs, notably changing the
cost of legal loads/stores to the MVECostFactor and the cost of
scalarized instructions to 8*NumElts.

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

7 months ago[LV] Fix scalar cost for tail predicated loops
David Green [Sat, 12 Dec 2020 14:21:40 +0000 (14:21 +0000)]
[LV] Fix scalar cost for tail predicated loops

When it comes to the scalar cost of any predicated block, the loop
vectorizer by default regards this predication as a sign that it is
looking at an if-conversion and divides the scalar cost of the block by
2, assuming it would only be executed half the time. This however makes
no sense if the predication has been introduced to tail predicate the

Original patch by Anna Welker

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

7 months ago[BasicAA] Make non-equal index handling simpler to extend (NFC)
Nikita Popov [Sat, 12 Dec 2020 12:23:49 +0000 (13:23 +0100)]
[BasicAA] Make non-equal index handling simpler to extend (NFC)

7 months ago[BasicAA] Add tests for non-zero var index (NFC)
Nikita Popov [Sat, 12 Dec 2020 12:19:23 +0000 (13:19 +0100)]
[BasicAA] Add tests for non-zero var index (NFC)

7 months agoCreate SPIRABIInfo to enable SPIR_FUNC calling convention.
Melanie Blower [Sat, 12 Dec 2020 13:18:00 +0000 (05:18 -0800)]
Create SPIRABIInfo to enable SPIR_FUNC calling convention.

Background: Call to library arithmetic functions for div is emitted by the
compiler and it set wrong “C” calling convention for calls to these functions,
whereas library functions are declared with `spir_function` calling convention.
InstCombine optimization replaces such calls with “unreachable” instruction.
It looks like clang lacks SPIRABIInfo class which should specify default
calling conventions for “system” function calls. SPIR supports only
SPIR_FUNC and SPIR_KERNEL calling convention.

Reviewers: Erich Keane, Anastasia

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

7 months ago[lldb] Make CommandInterpreter's execution context the same as debugger's one.
Tatyana Krasnukha [Thu, 10 Dec 2020 16:30:04 +0000 (19:30 +0300)]
[lldb] Make CommandInterpreter's execution context the same as debugger's one.

Currently, the interpreter's context is not updated until a command is executed.
This has resulted in the behavior of SB-interface functions and some commands
depends on previous user actions. The interpreter's context can stay uninitialized,
point to a currently selected target, or point to one of previously selected targets.

This patch removes any usages of CommandInterpreter::UpdateExecutionContext.
CommandInterpreter::HandleCommand* functions still may override context temporarily,
but now they always restore it before exiting. CommandInterpreter saves overriden
contexts to the stack, that makes nesting commands possible.

Added test reproduces one of the issues. Without this fix, the last assertion fails
because interpreter's execution context is empty until running "target list", so,
the value of the global property was updated instead of process's local instance.

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

7 months ago[lldb] Modernize TargetList for-loops, NFC
Tatyana Krasnukha [Wed, 2 Dec 2020 15:52:50 +0000 (18:52 +0300)]
[lldb] Modernize TargetList for-loops, NFC

Replace loops with standard algorithms or range-based loops.

7 months ago[lldb] "target create" shouldn't save target if the command failed
Tatyana Krasnukha [Fri, 11 Dec 2020 08:09:39 +0000 (11:09 +0300)]
[lldb] "target create" shouldn't save target if the command failed

TargetList::CreateTarget automatically adds created target to the list, however,
CommandObjectTargetCreate does some additional preparation after creating a target
and which can fail. The command should remove created target if it failed. Since
the function has many ways to return, scope guard does this work safely.

Changes to the TargetList make target adding and selection more transparent.

Other changes remove unnecessary SetSelectedTarget after CreateTarget.

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

7 months ago[X86] Add chain in ISel for x86_tdpbssd_internal intrinsic.
Luo, Yuanke [Sat, 12 Dec 2020 12:21:43 +0000 (20:21 +0800)]
[X86] Add chain in ISel for x86_tdpbssd_internal intrinsic.

7 months ago[YAML] Support extended spellings when parsing bools.
Nathan James [Sat, 12 Dec 2020 12:50:33 +0000 (12:50 +0000)]
[YAML] Support extended spellings when parsing bools.

Support all the spellings of boolean datatypes according to https://yaml.org/type/bool.html

Reviewed By: silvas

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

7 months ago[ARM] Test for showing scalar vector costs. NFC
David Green [Sat, 12 Dec 2020 11:43:14 +0000 (11:43 +0000)]
[ARM] Test for showing scalar vector costs. NFC

7 months ago[clang][cli] Revert accidental access-control flag rename
Jan Svoboda [Fri, 11 Dec 2020 14:43:05 +0000 (15:43 +0100)]
[clang][cli] Revert accidental access-control flag rename

This commit <https://reviews.llvm.org/rGe5158b52730d323bb8cd2cba6dc6c89b90cba452> introduced an accidental change, which renames `-faccess-control` and `-fno-access-control` to `-fno-access-control` and `-fno-no-access-control`.

Reviewed By: dexonsmith, MaskRay

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

7 months ago[clang][cli] Add flexible TableGen multiclass for boolean options
Jan Svoboda [Tue, 8 Dec 2020 17:15:21 +0000 (18:15 +0100)]
[clang][cli] Add flexible TableGen multiclass for boolean options

This introduces more flexible multiclass for declaring two flags controlling the same boolean keypath.

Compared to existing Opt{In,Out}FFlag multiclasses, the new syntax makes it easier to read option declarations and reason about the keypath.

This also makes specifying common properties of both flags possible.

I'm open to suggestions on the class names. Not 100% sure the benefits are worth the added complexity.

Depends on D92774.

Reviewed By: dexonsmith

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

7 months ago[clang][cli] Don't always emit -f[no-]legacy-pass-manager
Jan Svoboda [Tue, 8 Dec 2020 17:15:21 +0000 (18:15 +0100)]
[clang][cli] Don't always emit -f[no-]legacy-pass-manager

We don't need to always generate `-f[no-]experimental-new-pass-manager`.

This patch does not change the behavior of any other command line flag. (For example `-triple` is still being always generated.)

Reviewed By: dexonsmith, Bigcheese

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

7 months agoReland "[clang][cli] CompilerInvocationTest: add tests for boolean options"
Jan Svoboda [Fri, 11 Dec 2020 13:22:21 +0000 (14:22 +0100)]
Reland "[clang][cli] CompilerInvocationTest: add tests for boolean options"

Add more tests of the command line marshalling infrastructure.

The new tests now make a "round-trip": from arguments, to CompilerInvocation instance to arguments again in a single test case.

The TODOs are resolved in a follow-up patch.

Depends on D92830.

Reviewed By: dexonsmith

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

7 months ago[Analysis] Use is_contained (NFC)
Kazu Hirata [Sat, 12 Dec 2020 05:19:31 +0000 (21:19 -0800)]
[Analysis] Use is_contained (NFC)

7 months ago[MLGO] Fix build break as result of new InstructionCost (D91174)
Mircea Trofin [Sat, 12 Dec 2020 04:28:39 +0000 (20:28 -0800)]
[MLGO] Fix build break as result of new InstructionCost (D91174)

7 months ago[OpenMP] Add time profiling for libomptarget
Giorgis Georgakoudis [Thu, 10 Dec 2020 19:24:27 +0000 (11:24 -0800)]
[OpenMP] Add time profiling for libomptarget

Reviewed By: jdoerfert

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

7 months ago[llvm-cov gcov] Replace Donald B. Johnson's cycle enumeration with iterative cycle...
Fangrui Song [Sat, 12 Dec 2020 02:28:16 +0000 (18:28 -0800)]
[llvm-cov gcov] Replace Donald B. Johnson's cycle enumeration with iterative cycle finding

gcov computes the line execution count as the sum of (a) counts from
predecessors on other lines and (b) the sum of loop execution counts of blocks
on the same line (think of loops on one line).

For (b), we use Donald B. Johnson's cycle enumeration algorithm and perform
cycle cancelling for each cycle. This number of candidate cycles were
exponential and D93036 made it polynomial by skipping zero count cycles.  The
time complexity is high (O(V*E^2) (it could be O(E^2) but the linear `Blocks`
check made it higher) and the implementation is complex.

We could just identify loops and sum all back edges. However, this requires a
dominator tree construction which is more complex. The time complexity can be
decreased to almost linear, though.

This patch just performs cycle cancelling iteratively. Add two members
`traversable` and `incoming` to GCOVArc. There are 3 states:

* `!traversable`: blocks not on this line or explored blocks
* `traversable && incoming == nullptr`: unexplored blocks
* `traversable && incoming != nullptr`: blocks which are being explored (on the stack)

If an arc points to a block being explored, a cycle has been found.

Let E be the number of arcs. Every time a cycle is found, at least one arc is
saturated (`edgeCount` reduced to 0), so there are at most E cycles. Finding one
cycle takes O(E) time, so the overall time complexity is O(E^2). Note that we
always augment through a back edge and never need to augment its reverse edge so
reverse edges in traditional flow networks are not needed.

Reviewed By: xinhaoyuan

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

7 months ago[Kaleidoscope] Migrate DebugInfo::get to DILocation::get
Fangrui Song [Sat, 12 Dec 2020 02:01:04 +0000 (18:01 -0800)]
[Kaleidoscope] Migrate DebugInfo::get to DILocation::get

7 months ago[mlir][docs] Tidy up the pass infrastructure documentation
River Riddle [Sat, 12 Dec 2020 01:52:56 +0000 (17:52 -0800)]
[mlir][docs] Tidy up the pass infrastructure documentation

The doc has grown stale and is missing some recent changes to the infrastructure.

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

7 months agoFixup for 8c86197de3cba4257f26133e837d64e5f8ece210 to avoid making it platform-dependent
Duncan P. N. Exon Smith [Sat, 12 Dec 2020 01:33:07 +0000 (17:33 -0800)]
Fixup for 8c86197de3cba4257f26133e837d64e5f8ece210 to avoid making it platform-dependent

7 months agoclang-import-test: Clean up error output for files that cannot be found
Duncan P. N. Exon Smith [Wed, 9 Dec 2020 21:54:56 +0000 (13:54 -0800)]
clang-import-test: Clean up error output for files that cannot be found

Pass on the filesystem error string `FileManager::getFileRef` in
`clang-import-test`'s `ParseSource` function. Also include "error:" and
a newline in the output. As a side effect, migrate to the `FileEntryRef`
overload of `SourceManager::createFileID`.

No real functionality change here, just slightly better output on error.

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

7 months agoFrontend: Migrate to FileEntryRef in TextDiagnosticTest, NFC
Duncan P. N. Exon Smith [Wed, 9 Dec 2020 21:41:17 +0000 (13:41 -0800)]
Frontend: Migrate to FileEntryRef in TextDiagnosticTest, NFC

Migrate over to the `FileEntryRef` overloads of
`SourceManager::createFileID` and `overrideFileContents` (using
`getVirtualFileRef`) in `TextDiagnostic`'s `ShowLine` test.

No functionality change.

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

7 months agoReapply "[SystemZFrameLowering] Don't overrwrite R1D (backchain) when probing."
Jonas Paulsson [Fri, 11 Dec 2020 00:26:16 +0000 (01:26 +0100)]
Reapply "[SystemZFrameLowering] Don't overrwrite R1D (backchain) when probing."

Fixed to properly compute the live-in lists of new blocks.

Review: Ulrich Weigand

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

7 months ago[SystemZTTIImpl] Allow some non-prefetched accesses in getMinPrefetchStride().
Jonas Paulsson [Thu, 10 Dec 2020 00:56:45 +0000 (01:56 +0100)]
[SystemZTTIImpl] Allow some non-prefetched accesses in getMinPrefetchStride().

The performance improvement on LBM previously achieved with improved software
prefetching (36d4421) have gone lost recently with e00f189. There now is one
memory access in the loop that LoopDataPrefetch cannot handle (while before
there was none) which the heuristic rejects.

This patch adds a small margin by allowing 1 non-prefetched memory access for
every 32 prefetched ones, so that the heuristic doesn't bail in this type of

Review: Ulrich Weigand

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

7 months ago[AIX] Fixed a link error.
diggerlin [Fri, 11 Dec 2020 23:53:10 +0000 (18:53 -0500)]
[AIX] Fixed a link error.


link: http://lab.llvm.org:8011/#/builders/57/builds/2307/steps/6/logs/stdio".
PPCAsmPrinter.cpp:(.text._ZN12_GLOBAL__N_116PPCAIXAsmPrinter19emitFunctionBodyEndEv+0x2f8): undefined reference to `llvm::XCOFF::getNameForTracebackTableLanguageId(llvm::XCOFF::TracebackTable::LanguageID)'
PPCAsmPrinter.cpp:(.text._ZN12_GLOBAL__N_116PPCAIXAsmPrinter19emitFunctionBodyEndEv+0x2170): undefined reference to `llvm::XCOFF::parseParmsType(unsigned int, unsigned int)'

7 months ago[LoopIdiomRecognize] Autogenerate complete checks for the X86 ctlz/cttz tests. NFC
Craig Topper [Fri, 11 Dec 2020 23:24:18 +0000 (15:24 -0800)]
[LoopIdiomRecognize] Autogenerate complete checks for the X86 ctlz/cttz tests. NFC

Preparation for D92745 which will add more tests to these files.

7 months agoRevert "Consider reference, pointer, and pointer-to-member TemplateArguments to be...
Nikita Popov [Fri, 11 Dec 2020 23:04:10 +0000 (00:04 +0100)]
Revert "Consider reference, pointer, and pointer-to-member TemplateArguments to be different if they have different types."

This reverts commit 7b3470baf8bab1919e3ad4c18e2b776c1f7be2d5.

Causes a crash while building tramp3d-v4 from test-suite.

7 months ago[AIX][XCOFF] emit traceback table for function in aix
diggerlin [Fri, 11 Dec 2020 22:50:25 +0000 (17:50 -0500)]
[AIX][XCOFF] emit traceback table for function in aix

 1. added a new option -xcoff-traceback-table to control whether generate traceback table for function.
 2. implement the functionality of emit traceback table of a function.

Reviewers: hubert.reinterpretcast, Jason Liu
Differential Revision: https://reviews.llvm.org/D92398

7 months agoStore a MlirIdentifier instead of a MlirStringRef in MlirNameAttribute
Mehdi Amini [Fri, 11 Dec 2020 18:50:04 +0000 (18:50 +0000)]
Store a MlirIdentifier instead of a MlirStringRef in MlirNameAttribute

This mirror the C++ API for NamedAttribute, and has the advantage or
internalizing earlier in the Context and not requiring the caller to
keep the StringRef alive beyong this call.

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

7 months ago[libc] Let wrappergen pick LLVM libc mangled name from aliasee file.
Siva Chandra Reddy [Fri, 11 Dec 2020 21:17:33 +0000 (13:17 -0800)]
[libc] Let wrappergen pick LLVM libc mangled name from aliasee file.

Along the way, made a change to run tool unittests when the target
"check-libc" is run by introducing a libc testsuite for tool unittests.

Reviewed By: michaelrj

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

7 months agoRevert "Revert "[mlir] Start splitting the `tensor` dialect out of `std`.""
Sean Silva [Fri, 11 Dec 2020 22:20:03 +0000 (14:20 -0800)]
Revert "Revert "[mlir] Start splitting the `tensor` dialect out of `std`.""

This reverts commit 0d48d265db6633e4e575f81f9d3a52139b1dc5ca.

This reapplies the following commit, with a fix for CAPI/ir.c:

[mlir] Start splitting the `tensor` dialect out of `std`.

This starts by moving `std.extract_element` to `tensor.extract` (this
mirrors the naming of `vector.extract`).

Curiously, `std.extract_element` supposedly works on vectors as well,
and this patch removes that functionality. I would tend to do that in
separate patch, but I couldn't find any downstream users relying on
this, and the fact that we have `vector.extract` made it seem safe
enough to lump in here.

This also sets up the `tensor` dialect as a dependency of the `std`
dialect, as some ops that currently live in `std` depend on
`tensor.extract` via their canonicalization patterns.

Part of RFC: https://llvm.discourse.group/t/rfc-split-the-tensor-dialect-from-std/2347/2

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

7 months ago[InstCombine][x86] fix insertion point bug in vector demanded elts fold (PR48476)
Sanjay Patel [Fri, 11 Dec 2020 21:18:56 +0000 (16:18 -0500)]
[InstCombine][x86] fix insertion point bug in vector demanded elts fold (PR48476)

This transform was added at:

From what I see, it's the first demanded elements transform that adds
a new instruction using the IRBuilder. There are similar folds in
the generic demanded bits chunk of instcombine that also use the
InsertPointGuard code pattern.

The tests here would assert/crash because the new instruction was
being added at the start of the demanded elements analysis rather
than at the instruction that is being replaced.

7 months agoRevert "[mlir] Start splitting the `tensor` dialect out of `std`."
Sean Silva [Fri, 11 Dec 2020 22:15:41 +0000 (14:15 -0800)]
Revert "[mlir] Start splitting the `tensor` dialect out of `std`."

This reverts commit cab8dda90f48e15ee94b0d55ceac5b6a812e4743.

I mistakenly thought that CAPI/ir.c failure was unrelated to this
change. Need to debug it.