platform/upstream/llvm.git
4 years ago[DebugInfo] Ensure that a demanded bits optimisation in
Chris Jackson [Mon, 30 Mar 2020 14:08:26 +0000 (15:08 +0100)]
[DebugInfo]  Ensure that a demanded bits optimisation in
InstCombine does not result in an incorrect debuginfo variable
value

- Add an additional salvage and a test.

Reviewers: aprantl, djtodoro

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

Bugzilla:  https://bugs.llvm.org/show_bug.cgi?id=44371

4 years agoRevert "[Darwin] Respect -fno-unroll-loops during LTO."
Florian Hahn [Mon, 30 Mar 2020 14:20:30 +0000 (15:20 +0100)]
Revert "[Darwin] Respect -fno-unroll-loops during LTO."

As per post-commit comment at https://reviews.llvm.org/D76916, this
should better be done at the TU level.

This reverts commit 9ce198d6ed371399e9bd9ba8b48fbab0f4e60240.

4 years ago[LLDB] Initialize temporary token
Benjamin Kramer [Mon, 30 Mar 2020 14:12:14 +0000 (16:12 +0200)]
[LLDB] Initialize temporary token

Found by msan.

4 years ago[lldb] Fix TestSettings.test_pass_host_env_vars on windows
Pavel Labath [Wed, 25 Mar 2020 12:39:05 +0000 (13:39 +0100)]
[lldb] Fix TestSettings.test_pass_host_env_vars on windows

Summary:
A defensive check in ProcessLauncherWindows meant that we would never
attempt to launch a process with a completely empty environment -- the
host environment would be used instead. Instead, I make the function add
an extra null wchar_t at the end of an empty environment. The
documentation on this is a bit fuzzy, but it seems to be what is needed
to make windows accept these kinds of environments.

Reviewers: amccarth, friss

Subscribers: lldb-commits

Tags: #lldb

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

4 years ago[analyzer][MallocChecker][NFC] Split checkPostCall up, deploy CallDescriptionMap
Louis Dionne [Thu, 26 Mar 2020 15:04:24 +0000 (11:04 -0400)]
[analyzer][MallocChecker][NFC] Split checkPostCall up, deploy CallDescriptionMap

Since its important to know whether a function frees memory (even if its a
reallocating function!), I used two CallDescriptionMaps to merge all
CallDescriptions into it. MemFunctionInfoTy no longer makes sense, it may never
have, but for now, it would be more of a distraction then anything else.

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

4 years ago[lldb] Fix another crash in covariant type handling
Pavel Labath [Thu, 26 Mar 2020 12:23:51 +0000 (13:23 +0100)]
[lldb] Fix another crash in covariant type handling

Summary:
D73024 seems to have fixed one set crash, but it introduced another.
Namely, if a class contains a covariant method returning itself, the
logic in MaybeCompleteReturnType could cause us to attempt a recursive
import, which would result in an assertion failure in
clang::DeclContext::removeDecl.

For some reason, this only manifested itself if the class contained at
least two member variables, and the class itself was imported as a
result of a recursive covariant import.

This patch fixes the crash by not attempting to import classes which are
already completed in MaybeCompleteReturnType. However, it's not clear to
me if this is the right fix, or if this should be handled automatically
by functions lower in the stack.

Reviewers: teemperor, shafik

Subscribers: lldb-commits

Tags: #lldb

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

4 years ago[DebugInfo] Ensure dead store elimination can mark an operand
Chris Jackson [Mon, 30 Mar 2020 13:18:01 +0000 (14:18 +0100)]
[DebugInfo] Ensure dead store elimination can mark an operand
value as undefined

    - Correct a debug info salvage and add a test

    Reviewers: aprantl, vsk

    Differential Revision: https://reviews.llvm.org/D76930
    Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=45080

4 years agoRemove legacy CMake targets for libcxx and libcxxabi
Louis Dionne [Wed, 11 Mar 2020 21:03:00 +0000 (17:03 -0400)]
Remove legacy CMake targets for libcxx and libcxxabi

We've been meaning to remove those targets for a while, and the fix is
simple enough cause they're all just aliases to other targets.

This is a re-application of f383fb40b17, wich was reverted in 04d48111b
because the build bots had not been updated yet. The build bot configurations
have now been updated not to use the deprecated targets, and I verified
that they were using the non-deprecated targets, so we should be good
unless I missed a bot.

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

4 years ago[InstCombine] add test for trunc-extelt; NFC
Sanjay Patel [Mon, 30 Mar 2020 13:42:25 +0000 (09:42 -0400)]
[InstCombine] add test for trunc-extelt; NFC

Goes with D76983

4 years ago[OPENMP50]Add basic support for array-shaping operation.
Alexey Bataev [Wed, 5 Feb 2020 14:33:05 +0000 (09:33 -0500)]
[OPENMP50]Add basic support for array-shaping operation.

Summary:
Added basic representation and parsing/sema handling of array-shaping
operations. Array shaping expression is an expression of form ([s0]..[sn])base,
where s0, ..., sn must be a positive integer, base - a pointer. This
expression is a kind of cast operation that converts pointer expression
into an array-like kind of expression.

Reviewers: rjmccall, rsmith, jdoerfert

Subscribers: guansong, arphaman, cfe-commits, caomhin, kkwli0

Tags: #clang

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

4 years ago[Alignment][NFC] Provide tightened up functions in SelectionDAG, MachineFunction...
Guillaume Chatelet [Mon, 30 Mar 2020 09:38:44 +0000 (09:38 +0000)]
[Alignment][NFC] Provide tightened up functions in SelectionDAG, MachineFunction and MachineMemOperand

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: hiraditya, jfb, llvm-commits

Tags: #llvm

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

4 years ago[AST] Fix crashes on decltype(recovery-expr).
Haojian Wu [Fri, 27 Mar 2020 15:21:36 +0000 (16:21 +0100)]
[AST] Fix crashes on decltype(recovery-expr).

Summary: We mark these decls as invalid.

Reviewers: sammccall

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[llvm-readobj] - Improve test of --elf-hash-histogram option.
Georgii Rymar [Fri, 27 Mar 2020 12:35:10 +0000 (15:35 +0300)]
[llvm-readobj] - Improve test of --elf-hash-histogram option.

This test missed the check of histograms printed for .hash sections.
It was removed by mistake in D71606 where I tried to get rid of precompiled objects
and did not realize that time that both SHT_GNU_HASH and SHT_HASH sections
were tested and not just GNU version.

Also it never tested aliases for the --elf-hash-histogram option.

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

4 years ago[SystemZ] Allow configuring default CLANG_SYSTEMZ_ARCH
Ulrich Weigand [Mon, 30 Mar 2020 12:20:48 +0000 (14:20 +0200)]
[SystemZ] Allow configuring default CLANG_SYSTEMZ_ARCH

On Ubuntu, we want to raise default CLANG_SYSTEMZ_ARCH to z13,
thus allow configuring this via CMake.
On Debian, we want to raise it to z196.

Author: Dimitri John Ledkov
Differential Revision: https://reviews.llvm.org/D75914

4 years ago[lldb][NFC] Refactor Fix-It filter for warnings
Raphael Isemann [Mon, 30 Mar 2020 09:52:20 +0000 (11:52 +0200)]
[lldb][NFC] Refactor Fix-It filter for warnings

LLDB only automatically applies Fix-Its from errors, but not from warnings.

Currently we only store Fix-Its from errors and then later apply all Fix-Its
we stored. This moves the filter to the application phase, so that we now
store *all* Fix-Its but only apply Fix-Its from errors later on.

This is NFC preparation for an upcoming patch.

4 years agoFix unused-variable error when assertions are disabled
scentini [Mon, 30 Mar 2020 11:38:40 +0000 (13:38 +0200)]
Fix unused-variable error when assertions are disabled

4 years ago[lldb] Make TestExprDiagnostics.py pass again after enabling Fix-Its in test
Raphael Isemann [Mon, 30 Mar 2020 11:48:26 +0000 (13:48 +0200)]
[lldb] Make TestExprDiagnostics.py pass again after enabling Fix-Its in test

Commit 83c81c0a469482888482983c302c09c02680ae7c enabled Fix-Its for top-level
expressions which change the error message of this test here as Clang comes
up with a strange Fix-It for this expression. This patch just changes the
test to declare a void variable so that Clang doesn't see a way to
recover with a Fix-It and change the error message.

4 years ago[llvm-readobj][test] - Simplify hash-symbols test.
Georgii Rymar [Fri, 27 Mar 2020 13:57:32 +0000 (16:57 +0300)]
[llvm-readobj][test] - Simplify hash-symbols test.

We are able to reduce `-DBITS=32/64` to reduce this test case.
I've rewrote the comments we had to generalize them and
fix wrong computations they contained.

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

4 years ago[X86][AVX] lowerV4X128Shuffle - attempt to widen to 2x256 to simplify shuffles
Simon Pilgrim [Mon, 30 Mar 2020 11:22:06 +0000 (12:22 +0100)]
[X86][AVX] lowerV4X128Shuffle - attempt to widen to 2x256 to simplify shuffles

If we are lowering to X86ISD::SHUF128 we are going to lose track of individual 128-bit lanes that are UNDEF, so if we can widen these to guarantee that they are sequential with their neighbour we should. This helps with later shuffle combines.

4 years ago[clang-format] only parse C# generic type constraints in C#
Krasimir Georgiev [Mon, 30 Mar 2020 11:13:07 +0000 (13:13 +0200)]
[clang-format] only parse C# generic type constraints in C#

Commit "[clang-format] Handle C# generic type constraints",
https://github.com/llvm/llvm-project/commit/dcbcec4822f47ec5b638dd9c20dcebd464569dae
regressed the formatting of code containing `where` as an identifier in other
languages.

4 years ago[Matrix] Rename emitChainedMatrixMultiply to emitMatrixMultiply (NFC).
Florian Hahn [Mon, 30 Mar 2020 10:13:41 +0000 (11:13 +0100)]
[Matrix] Rename emitChainedMatrixMultiply to emitMatrixMultiply (NFC).

The Chained in the name potentially leads to confusion. Also updated the
comment to drop the unnecessary mention of tile-sized.

4 years ago[AMDGPU] Drop const for value that is copied (NFC).
Florian Hahn [Mon, 30 Mar 2020 09:59:54 +0000 (10:59 +0100)]
[AMDGPU] Drop const for value that is copied (NFC).

This fixes

    warning: loop variable 'Def' of type 'const llvm::Register' creates a copy from type 'const llvm::Register' [-Wrange-loop-analysis]

llvm::Register just contains a single unsigned and should be copied.

Reviewers: rampitec

Reviewed By: rampitec

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

4 years ago[CVP] Add additional icmp for ranges with undef to test.
Florian Hahn [Sun, 29 Mar 2020 18:17:16 +0000 (19:17 +0100)]
[CVP] Add additional icmp for ranges with undef to test.

4 years ago[lldb] Make Fix-Its also apply to top-level expressions
Raphael Isemann [Mon, 30 Mar 2020 09:50:55 +0000 (11:50 +0200)]
[lldb] Make Fix-Its also apply to top-level expressions

Summary:
Currently top-level expressions won't automatically get Fix-Its applied. The reason
for that is that we only set the `m_fixed_text` member if we have a wrapping
source code (I.e. `m_source_code` is not zero and is wrapping some expressions).

This patch just always sets `m_fixed_text` to get this working.

Reviewers: labath, jingham

Reviewed By: labath

Subscribers: JDevlieghere

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

4 years ago[NFC] [PowerPC] Update and add tests for ori
Qiu Chaofan [Mon, 30 Mar 2020 09:46:12 +0000 (17:46 +0800)]
[NFC] [PowerPC] Update and add tests for ori

Use script to update test for ori with 32-bit imms, and add test for
ori with 64-bit imms.

4 years ago[lldb][NFC] Cleanup Fix-It code
Raphael Isemann [Mon, 30 Mar 2020 08:46:18 +0000 (10:46 +0200)]
[lldb][NFC] Cleanup Fix-It code

4 years ago[ARM][LowOverheadLoops] Add horizontal reduction support
Sam Parker [Mon, 30 Mar 2020 08:54:25 +0000 (09:54 +0100)]
[ARM][LowOverheadLoops] Add horizontal reduction support

Add a bit more logic into the 'FalseLaneZeros' tracking to enable
horizontal reductions and also make the VADDV variants
validForTailPredication.

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

4 years ago[AST] Fix a crash on invalid bitwidth exprs when preserving the recoveryexprs.
Haojian Wu [Fri, 27 Mar 2020 20:40:30 +0000 (21:40 +0100)]
[AST] Fix a crash on invalid bitwidth exprs when preserving the recoveryexprs.

Summary:
If the bitwith expr contains errors, we mark the field decl invalid.

This patch also tweaks the behavior of ObjCInterfaceDecl to be consistent with
existing RecordDecl -- getObjCLayout method is only called with valid decls.

Reviewers: sammccall

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[Analyzer][MallocChecker] No warning for kfree of ZERO_SIZE_PTR.
Balázs Kéri [Mon, 30 Mar 2020 07:23:07 +0000 (09:23 +0200)]
[Analyzer][MallocChecker] No warning for kfree of ZERO_SIZE_PTR.

Summary:
The kernel kmalloc function may return a constant value ZERO_SIZE_PTR
if a zero-sized block is allocated. This special value is allowed to
be passed to kfree and should produce no warning.

This is a simple version but should be no problem. The macro is always
detected independent of if this is a kernel source code or any other
code.

Reviewers: Szelethus, martong

Reviewed By: Szelethus, martong

Subscribers: rnkovacs, xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, gamesh411, Charusso, martong, ASDenysPetrov, cfe-commits

Tags: #clang

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

4 years ago[mlir] Fix typos in DeclarativeRewrites.md
Hanhan Wang [Mon, 30 Mar 2020 08:20:08 +0000 (01:20 -0700)]
[mlir] Fix typos in DeclarativeRewrites.md

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

4 years ago[lldb] Run TestFixIts on non-Darwin platforms
Raphael Isemann [Mon, 30 Mar 2020 07:41:06 +0000 (09:41 +0200)]
[lldb] Run TestFixIts on non-Darwin platforms

This test also passes on my Linux machine, so this seems too strict.

4 years ago[lldb][NFC] Cleanup TestFixIts.py
Raphael Isemann [Mon, 30 Mar 2020 07:19:59 +0000 (09:19 +0200)]
[lldb][NFC] Cleanup TestFixIts.py

4 years ago[Alignment][NFC] Return Align for SelectionDAGNodes::getOriginalAlignment/getAlignment
Guillaume Chatelet [Fri, 27 Mar 2020 16:09:31 +0000 (16:09 +0000)]
[Alignment][NFC] Return Align for SelectionDAGNodes::getOriginalAlignment/getAlignment

Summary:
Also deprecate getOriginalAlignment, getAlignment will take much more time as it is pervasive through the codebase (including TableGened files).

This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[Analyzer] Rename test `iterator-modelling.cpp` to `iterator-modeling.cpp`
Adam Balogh [Mon, 30 Mar 2020 07:22:10 +0000 (09:22 +0200)]
[Analyzer] Rename test `iterator-modelling.cpp` to `iterator-modeling.cpp`

Typo fix.

4 years ago[Analyzer] Fix for incorrect use of container and iterator checkers
Adam Balogh [Thu, 5 Mar 2020 19:09:15 +0000 (20:09 +0100)]
[Analyzer] Fix for incorrect use of container and iterator checkers

Iterator checkers (and planned container checkers) need the option
aggressive-binary-operation-simplification to be enabled. Without this
option they may cause assertions. To prevent such misuse, this patch adds
a preventive check which issues a warning and denies the registartion of
the checker if this option is disabled.

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

4 years ago[ARM] MVE VMOV.i64
David Green [Sat, 28 Mar 2020 16:22:05 +0000 (16:22 +0000)]
[ARM] MVE VMOV.i64

In the original batch of MVE VMOVimm code generation VMOV.i64 was left
out due to the way it was done downstream. It turns out that it's fairly
simple though. This adds the codegen for it, similar to NEON.

Bigendian is technically incorrect in this version, which John is fixing
in a Neon patch.

4 years ago[TTI][X86] Fix the value passed to IsUnsigned for cost modeling of experimental.vecto...
Craig Topper [Mon, 30 Mar 2020 03:19:04 +0000 (20:19 -0700)]
[TTI][X86] Fix the value passed to IsUnsigned for cost modeling of experimental.vector.reduce.smin/smax/umin/umax.

We were passing true for smax/smin and false for umax/umin.

4 years ago[NFC] Remove obsolete checks followed by fix of isGuaranteedToTransferExecutionToSucc...
Max Kazantsev [Mon, 30 Mar 2020 05:13:02 +0000 (12:13 +0700)]
[NFC] Remove obsolete checks followed by fix of isGuaranteedToTransferExecutionToSuccessor

In past, isGuaranteedToTransferExecutionToSuccessor contained some weird logic
for volatile loads/stores that was ultimately removed by patch D65375. It's time to
remove a piece of dependent logic that used to be a workaround for the code which
is now deleted.

Reviewed By: uenoku
Differential Revision: https://reviews.llvm.org/D76918

4 years ago[mlir][NFC] Update dialect/op documentation to be consistent
River Riddle [Mon, 30 Mar 2020 05:00:26 +0000 (22:00 -0700)]
[mlir][NFC] Update dialect/op documentation to be consistent

Summary:
This revision performs a lot of different cleanups on operation documentation to ensure that they are consistent, e.g. using mlir code blocks, formatting, etc.

This revision also includes the auto-generated documentation into the hand-written documentation for the dialects that have a specific top-level dialect file. This updates the documentation for all dialects aside from SPIRV and STD. These dialects will be updated in a followup.

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

4 years ago[mlir][NFC] Use the auto-generated op documentation in the standard dialect documentation
River Riddle [Mon, 30 Mar 2020 04:49:44 +0000 (21:49 -0700)]
[mlir][NFC] Use the auto-generated op documentation in the standard dialect documentation

Summary: This revision updates the dialect documentation to use the auto-generated markdown for operations. This allows for updating some out-of-date bits of documentation, and allows for displaying a large of number of newly added operations that did not have a counter part in Standard.md.

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

4 years ago[mlir][Diagnostics] Don't print note source line if it is the same as the previous...
River Riddle [Mon, 30 Mar 2020 04:38:11 +0000 (21:38 -0700)]
[mlir][Diagnostics] Don't print note source line if it is the same as the previous diagnostic

Summary: This revision updates the SourceMgrDiagnosticHandler to not print the source location of a note if it is the same location as the previously printed diagnostic. This helps avoid redundancy, and potential confusion, when looking at the diagnostic output.

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

4 years ago[LangRef] Clarify the semantics of branch on undef
Juneyoung Lee [Sat, 28 Mar 2020 06:11:09 +0000 (15:11 +0900)]
[LangRef] Clarify the semantics of branch on undef

Summary:
This patch clarifies the semantics of branching on undef value.

Defining `br undef` as undefined behavior explains optimizations that use branch conditions, such as CVP (D76931) and GVN (propagateEquality).

For `switch cond`, it is defined to raise UB if cond is an expression containing undef && cond is not frozen &&
it may yield different values.
This allows that at the destination block the branch condition can be assumed to be frozen already (otherwise UB was already triggered).
This condition is slightly stricter than MemorySanitizer, which allows undef-y condition if it always leads to the same destination,
but it does not break MemorySanitizer because we are giving stricter constraint.

Reviewers: efriedma, fhahn, nikic, spatel, jdoerfert, nlopes

Reviewed By: nlopes

Subscribers: regehr, llvm-commits

Tags: #llvm

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

4 years agoPR45350: Handle unsized array CXXConstructExprs in constant evaluation
Richard Smith [Mon, 30 Mar 2020 02:31:21 +0000 (19:31 -0700)]
PR45350: Handle unsized array CXXConstructExprs in constant evaluation
of array new expressions with runtime bound.

4 years ago[Coroutines 2/2] Improve symmetric control transfer feature
Jun Ma [Fri, 27 Mar 2020 07:27:05 +0000 (15:27 +0800)]
[Coroutines 2/2] Improve symmetric control transfer feature

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

4 years ago[Coroutines 1/2] Improve symmetric control transfer feature
Jun Ma [Fri, 27 Mar 2020 07:15:28 +0000 (15:15 +0800)]
[Coroutines 1/2] Improve symmetric control transfer feature

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

4 years ago[LLD][ELF] Put back rounding which was lost in 8404aeb56a73ab24f9b295111de3b37a37f0b841
Alexandre Ganea [Mon, 30 Mar 2020 01:51:45 +0000 (21:51 -0400)]
[LLD][ELF] Put back rounding which was lost in 8404aeb56a73ab24f9b295111de3b37a37f0b841

4 years agoRevert "[libc++] NFC: Simplify substitutions by using lit recursive substitutions"
David Zarzycki [Sun, 29 Mar 2020 01:25:07 +0000 (21:25 -0400)]
Revert "[libc++] NFC: Simplify substitutions by using lit recursive substitutions"

This reverts commit cd7f9751c30092033a5e97591876f972daf61989 which has
unintended breakage to non-libcxx projects when using the documented way
of building LLVM. (See the Getting Started guide. I.e. one big CMake setup.)

4 years ago[X86] Add sse4.1 RUNs lines to the min/max reduction cost model tests.
Craig Topper [Sun, 29 Mar 2020 22:54:34 +0000 (15:54 -0700)]
[X86] Add sse4.1 RUNs lines to the min/max reduction cost model tests.

Mostly this matches the sse4.2 we already had command lines for.
Except in the i64 case since sse4.1 doesn't have pcmpgtq.

4 years ago[InstCombine] Add tests for trunc (extelt x); (NFC)
Daan Sprenkels [Sun, 29 Mar 2020 21:25:39 +0000 (17:25 -0400)]
[InstCombine] Add tests for trunc (extelt x); (NFC)
Baseline tests for D76983 (PR45314)

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

4 years ago[X86] Add sse4.2 command lines to min/max reduction tests.
Craig Topper [Sun, 29 Mar 2020 07:27:33 +0000 (00:27 -0700)]
[X86] Add sse4.2 command lines to min/max reduction tests.

SSE4.2 has the pcmpgtq instruction which we will use in
vXi64 reductions when its available.

4 years ago[ARMMVE] Create fewer temporary SmallVectors
Benjamin Kramer [Sun, 29 Mar 2020 20:30:06 +0000 (22:30 +0200)]
[ARMMVE] Create fewer temporary SmallVectors

Shrinks clang by 40k.

4 years agoDon't claim template names that name non-templates are undeclared.
Richard Smith [Sun, 29 Mar 2020 20:13:57 +0000 (13:13 -0700)]
Don't claim template names that name non-templates are undeclared.

4 years ago[ELF][test] Improve arm-exidx-output.s to test different output text sections
Fangrui Song [Thu, 19 Mar 2020 05:28:21 +0000 (22:28 -0700)]
[ELF][test] Improve arm-exidx-output.s to test different output text sections

Delete arm-exidx-link.s which is now covered by arm-exidx-output.s

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

4 years ago[ARM] VMOV.64 immediate tests. NFC
David Green [Sat, 28 Mar 2020 16:11:37 +0000 (16:11 +0000)]
[ARM] VMOV.64 immediate tests. NFC

4 years ago[gn build] Port 854f268ca62
LLVM GN Syncbot [Sun, 29 Mar 2020 19:24:34 +0000 (19:24 +0000)]
[gn build] Port 854f268ca62

4 years ago[MC] Move deprecation infos from MCTargetDesc to MCInstrInfo
Benjamin Kramer [Sun, 29 Mar 2020 19:09:07 +0000 (21:09 +0200)]
[MC] Move deprecation infos from MCTargetDesc to MCInstrInfo

This allows emitting it only when the feature is used by a target.
Shrinks Release+Asserts clang by 900k.

4 years ago[clangd] Handle clang-tidy suppression comments for diagnostics inside macro expansions
Nathan Ridge [Sun, 29 Mar 2020 19:13:13 +0000 (15:13 -0400)]
[clangd] Handle clang-tidy suppression comments for diagnostics inside macro expansions

Summary:
Not handling this was a side-effect of being overly cautious when trying
to avoid reading files for which clangd doesn't have the source mapped.

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

Reviewers: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet,
usaxena95, cfe-commits

Tags: #clang

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

4 years agoclang-format fixes in ClangTidyDiagnosticConsumer.cpp and DiagnosticsTets.cpp
Nathan Ridge [Sun, 29 Mar 2020 19:12:58 +0000 (15:12 -0400)]
clang-format fixes in ClangTidyDiagnosticConsumer.cpp and DiagnosticsTets.cpp

Subscribers: jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[X86][AVX] Combine 128/256-bit lane shuffles with zeroable upper subvectors to EXTRAC...
Simon Pilgrim [Sun, 29 Mar 2020 18:44:39 +0000 (19:44 +0100)]
[X86][AVX] Combine 128/256-bit lane shuffles with zeroable upper subvectors to EXTRACT_SUBVECTOR (PR40720)

As explained on PR40720, EXTRACTF128 is always as good/better than VPERM2F128/SHUF128, and we can use the implicit zeroing of the uppers.

4 years agoFix -Wdocumentation warning. NFC.
Simon Pilgrim [Sun, 29 Mar 2020 18:40:42 +0000 (19:40 +0100)]
Fix -Wdocumentation warning. NFC.

gcc was misinterpreting the template code snippet as html.

4 years ago[X86] Add isAnyZero shuffle mask helper
Simon Pilgrim [Sun, 29 Mar 2020 17:48:02 +0000 (18:48 +0100)]
[X86] Add isAnyZero shuffle mask helper

4 years ago[InstCombine] Erase old mul when creating umulo
Nikita Popov [Sun, 29 Mar 2020 17:20:11 +0000 (19:20 +0200)]
[InstCombine] Erase old mul when creating umulo

As we don't return the result of replaceInstUsesWith(), we are
responsible for erasing the instruction.

There is a small subtlety here in that we need to do this after
the other uses of Builder, which uses the original multiply as
the insertion point.

NFC apart from worklist order changes.

4 years ago[InstCombine] Use replaceOperand() in demanded elements simplification
Nikita Popov [Sun, 29 Mar 2020 18:07:46 +0000 (20:07 +0200)]
[InstCombine] Use replaceOperand() in demanded elements simplification

To make sure that dead operands get DCEd. This fixes the largest
source of leftover dead operands we see in tests.

NFC apart from worklist changes.

4 years ago[MLIR] Add missing asserts in interchangeLoops util, doc comment update
Uday Bondhugula [Sat, 28 Mar 2020 18:36:10 +0000 (00:06 +0530)]
[MLIR] Add missing asserts in interchangeLoops util, doc comment update

Add missing assert checks for input to mlir::interchangeLoops utility.
Rename interchangeLoops -> permuteLoops; update doc comments to clarify
inputs / return val. Other than the assert checks, this is NFC.

Signed-off-by: Uday Bondhugula <uday@polymagelabs.com>
Differential Revision: https://reviews.llvm.org/D77003

4 years ago[InstCombine] Use replaceOperand() in assoc cast simplification
Nikita Popov [Sun, 29 Mar 2020 17:59:00 +0000 (19:59 +0200)]
[InstCombine] Use replaceOperand() in assoc cast simplification

To make sure the old operands are DCEd.

NFC apart from worklist order.

4 years ago[InstCombine] Erase old add when optimizing add overflow
Nikita Popov [Sun, 29 Mar 2020 17:50:23 +0000 (19:50 +0200)]
[InstCombine] Erase old add when optimizing add overflow

We don't return the replaceInstUsesWith() result, so we're
responsible for cleaning up.

NFC apart from worklist order changes.

4 years agoIntroduce support for lib function aligned_alloc in TLI / memory builtins
Uday Bondhugula [Sat, 28 Mar 2020 05:59:52 +0000 (11:29 +0530)]
Introduce support for lib function aligned_alloc in TLI / memory builtins

Aligned_alloc is a standard lib function and has been in glibc since
2.16 and in the C11 standard. It has semantics similar to malloc/calloc
for several analyses/transforms. This patch introduces aligned_alloc
in target library info and memory builtins. Subsequent ones will
make other passes aware and fix https://bugs.llvm.org/show_bug.cgi?id=44062

This change will also be useful to LLVM generators that need to allocate
buffers of vector elements larger than 16 bytes (for eg. 256-bit ones),
element boundary alignment for which is not typically provided by glibc malloc.

Signed-off-by: Uday Bondhugula <uday@polymagelabs.com>
Differential Revision: https://reviews.llvm.org/D76970

4 years agoGlobalISel: Add matcher for G_SHL
Matt Arsenault [Sun, 29 Mar 2020 17:07:43 +0000 (13:07 -0400)]
GlobalISel: Add matcher for G_SHL

4 years agoAMDGPU/GlobalISel: Remove redundant virtual
Matt Arsenault [Sat, 28 Mar 2020 23:04:47 +0000 (19:04 -0400)]
AMDGPU/GlobalISel: Remove redundant virtual

4 years agoAMDGPU: Fix using wrong instruction for FP conversion
Matt Arsenault [Sun, 29 Mar 2020 14:40:12 +0000 (10:40 -0400)]
AMDGPU: Fix using wrong instruction for FP conversion

This was was never actually hit, but FTRUNC was clearly not the intent
here.

4 years agoAMDGPU: Add some additional tests for v_cvt_ubyte* formation
Matt Arsenault [Sun, 29 Mar 2020 14:10:28 +0000 (10:10 -0400)]
AMDGPU: Add some additional tests for v_cvt_ubyte* formation

Use functions now that we have them for less boilerplate in the
output.

4 years agoAMDGPU: Fix typo
Matt Arsenault [Sun, 29 Mar 2020 14:29:04 +0000 (10:29 -0400)]
AMDGPU: Fix typo

4 years ago[VectorCombine] skip debug intrinsics first for efficiency
Sanjay Patel [Sun, 29 Mar 2020 17:58:04 +0000 (13:58 -0400)]
[VectorCombine] skip debug intrinsics first for efficiency

4 years ago[InstCombine] make test independent of branch undef/UB; NFC
Sanjay Patel [Sun, 29 Mar 2020 17:31:44 +0000 (13:31 -0400)]
[InstCombine] make test independent of branch undef/UB; NFC

4 years ago[X86][AVX] Add tests for 512-bit shuffle patterns that could reduce to subvector...
Simon Pilgrim [Sun, 29 Mar 2020 17:26:56 +0000 (18:26 +0100)]
[X86][AVX] Add tests for 512-bit shuffle patterns that could reduce to subvector extractions

4 years agoRemove unnecessary empty comments from test check lines. NFC.
Simon Pilgrim [Sun, 29 Mar 2020 17:17:09 +0000 (18:17 +0100)]
Remove unnecessary empty comments from test check lines. NFC.

4 years ago[InstCombine] Simplify select of cmpxchg transform
Nikita Popov [Sun, 29 Mar 2020 16:55:59 +0000 (18:55 +0200)]
[InstCombine] Simplify select of cmpxchg transform

Rather than converting to a dummy select with equal true and false
ops, just directly return the resulting value.

As a side-effect, this fixes missing DCE of the previously replaced
operand.

4 years ago[OpenMP] set_bits iterator yields unsigned elements, no reference (NFC).
Florian Hahn [Sun, 29 Mar 2020 16:05:29 +0000 (17:05 +0100)]
[OpenMP] set_bits iterator yields unsigned elements, no reference (NFC).

BitVector::set_bits() returns an iterator range yielding unsinged
elements, which always will be copied while const & gives the impression
that there will be no copy. Newer version of clang complain:

    warning: loop variable 'SetBitsIt' is always a copy because the range of type 'iterator_range<llvm::BitVector::const_set_bits_iterator>' (aka 'iterator_range<const_set_bits_iterator_impl<llvm::BitVector> >') does not return a reference [-Wrange-loop-analysis]

Reviewers: jdoerfert, rnk

Reviewed By: rnk

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

4 years ago[InstCombine] Fix worklist management in varargs transform
Nikita Popov [Sun, 29 Mar 2020 15:38:23 +0000 (17:38 +0200)]
[InstCombine] Fix worklist management in varargs transform

Add a replaceUse() helper to mirror replaceOperand() for the
rare cases where we're working directly on uses.

NFC apart from worklist order changes.

4 years ago[InstCombine] Erase original add when creating saddo
Nikita Popov [Sun, 29 Mar 2020 15:25:42 +0000 (17:25 +0200)]
[InstCombine] Erase original add when creating saddo

Usually when we replaceInstUsesWith() we also return the original
instruction, and InstCombine will take care of erasing it. Here
we don't do that, so we need to manually erase it.

NFC apart from worklist order changes.

4 years ago[InstCombine] Use replaceOperand() in a few more places
Nikita Popov [Sun, 29 Mar 2020 15:08:04 +0000 (17:08 +0200)]
[InstCombine] Use replaceOperand() in a few more places

To make sure the old operands get DCEd.

NFC apart from worklist order changes.

4 years ago[X86][AVX] Combine 128-bit lane shuffles with a zeroable upper half to EXTRACT_SUBVEC...
Simon Pilgrim [Sun, 29 Mar 2020 15:41:37 +0000 (16:41 +0100)]
[X86][AVX] Combine 128-bit lane shuffles with a zeroable upper half to EXTRACT_SUBVECTOR (PR40720)

As explained on PR40720, EXTRACTF128 is always as good/better than VPERM2F128, and we can use the implicit zeroing of the upper half.

I've added some extra tests to vector-shuffle-combining-avx2.ll to make sure we don't lose coverage.

4 years ago[X86] Rename matchShuffleAsByteRotate to matchShuffleAsElementRotate. NFC.
Simon Pilgrim [Sun, 29 Mar 2020 11:51:52 +0000 (12:51 +0100)]
[X86] Rename matchShuffleAsByteRotate to matchShuffleAsElementRotate. NFC.

This was an inner helper function for the real matchShuffleAsByteRotate function, but it is more generic and is used directly for VALIGN lowering which doesn't work at the byte level.

4 years ago[X86][AVX] Add X86ISD::VALIGN target shuffle decode support
Simon Pilgrim [Sun, 29 Mar 2020 11:41:14 +0000 (12:41 +0100)]
[X86][AVX] Add X86ISD::VALIGN target shuffle decode support

Allows us to combine VALIGN instructions with other shuffles - the combiner doesn't create VALIGN yet though.

4 years ago[mlir] NFC: fix trivial typo in documents
Kazuaki Ishizaki [Sat, 28 Mar 2020 18:20:02 +0000 (03:20 +0900)]
[mlir] NFC: fix trivial typo in documents

Reviewers: mravishankar, antiagainst, nicolasvasilache, herhut, aartbik, mehdi_amini, bondhugula

Reviewed By: mehdi_amini, bondhugula

Subscribers: bondhugula, jdoerfert, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, csigg, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, Joonsoo, bader, llvm-commits

Tags: #llvm

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

4 years ago[VPlan] Use one VPWidenRecipe per original IR instruction. (NFC).
Florian Hahn [Sun, 29 Mar 2020 10:35:17 +0000 (11:35 +0100)]
[VPlan] Use one VPWidenRecipe per original IR instruction. (NFC).

This patch changes VPWidenRecipe to only store a single original IR
instruction. This is the first required step towards modeling it's
operands as VPValues and also towards breaking it up into a
VPInstruction.

Discussed as part of D74695.

Reviewers: Ayal, gilr, rengolin

Reviewed By: gilr

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

4 years ago[PostOrderIterator] Use SmallVector to store stack; NFC
Nikita Popov [Sun, 29 Mar 2020 09:36:30 +0000 (11:36 +0200)]
[PostOrderIterator] Use SmallVector to store stack; NFC

We use a SmallPtrSet to track visited nodes, use a SmallVector
of the same size for the stack.

4 years ago[X86] X86CallFrameOptimization - generalize slow push code path
Simon Pilgrim [Sun, 29 Mar 2020 10:01:42 +0000 (11:01 +0100)]
[X86] X86CallFrameOptimization - generalize slow push code path

Replace the explicit isAtom() || isSLM() test with the more general (and more specific) slowTwoMemOps() check to avoid the use of the PUSHrmm push from memory case.

This is actually very tricky to test in anything but quite complex code, but the atomic-idempotent.ll tests seem to be the most straightforward to use.

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

4 years ago[mlir] Add exp2 conversion to llvm.intr.exp2
Aaron Smith [Sun, 29 Mar 2020 08:23:08 +0000 (01:23 -0700)]
[mlir] Add exp2 conversion to llvm.intr.exp2

4 years ago[AlignmentFromAssumptions] Fix a SCEV assertion resulting from address space differences.
Richard Diamond [Mon, 2 Mar 2020 18:08:57 +0000 (12:08 -0600)]
[AlignmentFromAssumptions] Fix a SCEV assertion resulting from address space differences.

Summary:
On targets with different pointer sizes, -alignment-from-assumptions could attempt to create SCEV expressions which use different effective SCEV types. The provided test illustrates the issue.

In `getNewAlignment`, AASCEV would be the (only) alloca, which would have an effective SCEV type of i32. But PtrSCEV, the GEP in this case, due to being in the flat/default address space, will have an effective SCEV of i64.

This patch resolves the issue by truncating PtrSCEV to AASCEV's effective type.

Reviewers: hfinkel, jdoerfert

Reviewed By: jdoerfert

Subscribers: jvesely, nhaehnle, hiraditya, javed.absar, kerbowa, llvm-commits

Tags: #llvm

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

4 years ago[X86] Add cost model test cases for fmin/fmax reduction.
Craig Topper [Sat, 28 Mar 2020 22:30:13 +0000 (15:30 -0700)]
[X86] Add cost model test cases for fmin/fmax reduction.

4 years ago[MC][PowerPC] Make .reloc support arbitrary relocation types
Fangrui Song [Sat, 28 Mar 2020 23:48:59 +0000 (16:48 -0700)]
[MC][PowerPC] Make .reloc support arbitrary relocation types

Generalizes ad7199f3e60a49db023099dcb879fcc9cdf94a2e (R_PPC_NONE/R_PPC64_NONE).

4 years agoFix compatibility for __builtin_stdarg_start
Joerg Sonnenberger [Tue, 17 Mar 2020 23:39:54 +0000 (00:39 +0100)]
Fix compatibility for __builtin_stdarg_start

The __builtin_stdarg_start is the legacy spelling of __builtin_va_start.
It should behave exactly the same, but for the last 9 years it would
behave subtly different for diagnostics. Follow the change from
29ad95b23217 to require custom type checking.

4 years agoAMDGPU: Make use of default operands
Matt Arsenault [Sat, 7 Sep 2019 23:07:47 +0000 (19:07 -0400)]
AMDGPU: Make use of default operands

4 years agoPut back initializers that were dropped in 0ab5b5b8581d9f2951575f7245824e6e4fc57dec
Benjamin Kramer [Sat, 28 Mar 2020 21:06:12 +0000 (22:06 +0100)]
Put back initializers that were dropped in 0ab5b5b8581d9f2951575f7245824e6e4fc57dec

Found by msan.

4 years ago[COFF] Stabilize sort
Benjamin Kramer [Sat, 28 Mar 2020 20:38:50 +0000 (21:38 +0100)]
[COFF] Stabilize sort

Found by llvm::sort's expensive checks.

4 years ago[MDBuilder] Don't use stable sort for sorting integers.
Benjamin Kramer [Sat, 28 Mar 2020 20:16:51 +0000 (21:16 +0100)]
[MDBuilder] Don't use stable sort for sorting integers.

4 years ago[InstCombine] Remove unreachable blocks before DCE
Nikita Popov [Sat, 28 Mar 2020 20:16:48 +0000 (21:16 +0100)]
[InstCombine] Remove unreachable blocks before DCE

Dropping unreachable code may reduce use counts on other instructions,
so it's better to do this earlier rather than later.

NFC-ish, may only impact worklist order.

4 years ago[InstCombine] Merge two functions; NFC
Nikita Popov [Sat, 28 Mar 2020 20:13:33 +0000 (21:13 +0100)]
[InstCombine] Merge two functions; NFC

Merge AddReachableCodeToWorklist() into prepareICWorklistFromFunction().
It's one logical step, and this makes it easier to move code.

4 years ago[ADT] Automatically forward llvm::sort to array_pod_sort if safe
Benjamin Kramer [Sat, 28 Mar 2020 17:47:26 +0000 (18:47 +0100)]
[ADT] Automatically forward llvm::sort to array_pod_sort if safe

This is safe if the iterator type is a pointer and the comparator is
stateless. The enable_if pattern I'm adding here only uses
array_pod_sort for the default comparator (std::less).

Using array_pod_sort has a potential performance impact, but I didn't
notice anything when testing clang. Sorting doesn't seem to be on the
hot path anywhere in LLVM.

Shrinks Release+Asserts clang by 73k.