platform/upstream/llvm.git
3 years agoFix comment typos. NFC.
Kazu Hirata [Mon, 21 Sep 2020 23:12:55 +0000 (16:12 -0700)]
Fix comment typos. NFC.

3 years ago[AArch64][GlobalISel] Merge selection of vector-vector G_ASHR/G_LSHR and support...
Amara Emerson [Mon, 21 Sep 2020 22:28:04 +0000 (15:28 -0700)]
[AArch64][GlobalISel] Merge selection of vector-vector G_ASHR/G_LSHR and support more cases.

The vector-immediate cases are handled elsewhere in an earlier commit.

3 years ago[AArch64][GlobalISel] Add a post-legalize combine for lowering vector-immediate G_ASH...
Amara Emerson [Mon, 21 Sep 2020 22:03:29 +0000 (15:03 -0700)]
[AArch64][GlobalISel] Add a post-legalize combine for lowering vector-immediate G_ASHR/G_LSHR.

In order to select the immediate forms using the imported patterns, we need to
lower them into new G_VASHR/G_VLSHR target generic ops. Add a combine to do this
matching build_vector of constant operands.

With this, we get selection for free.

3 years ago[mlir] Add tutorial index.md pages
Jacques Pienaar [Mon, 21 Sep 2020 22:50:48 +0000 (15:50 -0700)]
[mlir] Add tutorial index.md pages

Sets the content for the section entry pages Hugo side.

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

3 years ago[AArch64][GlobalISel] Make <4 x s16> G_ASHR and G_LSHR legal.
Amara Emerson [Mon, 21 Sep 2020 18:17:53 +0000 (11:17 -0700)]
[AArch64][GlobalISel] Make <4 x s16> G_ASHR and G_LSHR legal.

Selection support for these is coming up.

3 years agoDon't build a StringLiteral expression with reference type when
Richard Smith [Mon, 21 Sep 2020 21:52:06 +0000 (14:52 -0700)]
Don't build a StringLiteral expression with reference type when
performing list-initialization of a char array reference from a braced
string literal of a smaller size.

3 years ago[NFC][regalloc] Use reverse iterator ranges for improved readability
Mircea Trofin [Mon, 21 Sep 2020 21:27:23 +0000 (14:27 -0700)]
[NFC][regalloc] Use reverse iterator ranges for improved readability

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

3 years ago[ASTImporter] Modifying ImportDeclContext(...) to ensure that we also handle the...
shafik [Mon, 21 Sep 2020 21:55:33 +0000 (14:55 -0700)]
[ASTImporter] Modifying ImportDeclContext(...) to ensure that we also handle the case when the FieldDecl is an ArrayType whose ElementType is a RecordDecl

When we fixed ImportDeclContext(...) in D71378 to make sure we complete each
FieldDecl of a RecordDecl when we are importing the definition we missed the
case where a FeildDecl was an ArrayType whose ElementType is a record.

This fix was motivated by a codegen crash during LLDB expression parsing. Since
we were not importing the definition we were crashing during layout which
required all the records be defined.

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

3 years agoRevert "[clang-cl] Always interpret the LIB env var as separated with semicolons"
Martin Storsjö [Mon, 21 Sep 2020 21:10:07 +0000 (00:10 +0300)]
Revert "[clang-cl] Always interpret the LIB env var as separated with semicolons"

This reverts commit 4d85444b317a00a3e15da63cdb693d272c99a0cc.

This commit broke building lldb's NativeProcessProtocolTest.cpp,
with errors like these:

In file included from include/llvm/Support/Process.h:32:0,
                 from tools/lldb/unittests/Host/NativeProcessProtocolTest.cpp:12:
include/llvm/Support/Program.h:39:11: error: reference to ‘pid_t’ is ambiguous
   typedef pid_t procid_t;

/usr/include/sched.h:38:17: note: candidates are: typedef __pid_t pid_t
 typedef __pid_t pid_t;

tools/lldb/include/lldb/lldb-types.h:85:18: note: typedef uint64_t lldb::pid_t
 typedef uint64_t pid_t;

3 years ago[EarlyCSE] Small refactoring changes, NFC
Krzysztof Parzyszek [Tue, 1 Sep 2020 22:31:12 +0000 (17:31 -0500)]
[EarlyCSE] Small refactoring changes, NFC

1. Store intrinsic ID in ParseMemoryInst instead of a boolean flag
   "IsTargetMemInst". This will make it easier to add support for
   target-independent intrinsics.
2. Extract the complex multiline conditions from EarlyCSE::processNode
   into a new function "getMatchingValue".

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

3 years ago[PowerPC] Remove unnecessary patterns and types
Baptiste Saleil [Mon, 21 Sep 2020 21:03:34 +0000 (16:03 -0500)]
[PowerPC] Remove unnecessary patterns and types

These patterns and type uses were added by mistake by commit
1372e23c7d4b25fd23689842246e66f70c949b46

3 years ago[Hexagon] Make HexagonVLCR compatibile with New PM
Pengxuan Zheng [Mon, 21 Sep 2020 20:43:42 +0000 (13:43 -0700)]
[Hexagon] Make HexagonVLCR compatibile with New PM

The patch modifies HexagonVectorLoopCarriedReuse pass to make it compatible with both Legacy Pass Manager through HexagonVectorLoopCarriedReuseLegacyPass and with New Pass Manager through HexagonVectorLoopCarriedReusePass.

Reviewed By: pzheng

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

3 years ago[CodeGen] [WinException] Only produce handler data at the end of the function if...
Martin Storsjö [Thu, 10 Sep 2020 10:33:00 +0000 (13:33 +0300)]
[CodeGen] [WinException] Only produce handler data at the end of the function if needed

If we are going to write handler data (that is written as variable
length data following after the unwind info in .xdata), we need to
emit the handler data immediately, but for cases where no such
info is going to be written, skip emitting it right away. (Unwind
info for all remaining functions that hasn't gotten it emitted
directly is emitted at the end.)

This does slightly change the ordering of sections (triggering a
bunch of updates to DebugInfo/COFF tests), but the change should be
benign.

This also matches GCC's assembly output, which doesn't output
.seh_handlerdata unless it actually is needed.

For ARM64, the unwind info can be packed into the runtime function
entry itself (leaving no data in the .xdata section at all), but
that can only be done if there's no follow-on data in the .xdata
section. If emission of the unwind info is triggered via
EmitWinEHHandlerData (or the .seh_handlerdata directive), which
implicitly switches to the .xdata section, there's a chance of the
caller wanting to pass further data there, so the packed format
can't be used in that case.

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

3 years ago[clang-cl] Always interpret the LIB env var as separated with semicolons
Martin Storsjö [Sun, 20 Sep 2020 20:19:12 +0000 (23:19 +0300)]
[clang-cl] Always interpret the LIB env var as separated with semicolons

When cross compiling with clang-cl, clang splits the INCLUDE env
variable around semicolons (clang/lib/Driver/ToolChains/MSVC.cpp,
MSVCToolChain::AddClangSystemIncludeArgs) and lld splits the
LIB variable similarly (lld/COFF/Driver.cpp,
LinkerDriver::addLibSearchPaths). Therefore, the consensus for
cross compilation with clang-cl and lld-link seems to be to use
semicolons, despite path lists normally being separated by colons
on unix and EnvPathSeparator being set to that.

Therefore, handle the LIB variable similarly in Clang, when
handling lib file arguments when driving linking via Clang.

This fixes commands like "clang-cl test.c -Fetest.exe kernel32.lib" in
a cross compilation setting. Normally, most users call (lld-)link
directly, but meson happens to use this command syntax for
has_function() tests.

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

3 years ago[clang] [MinGW] Add an implicit .exe suffix even when crosscompiling
Martin Storsjö [Tue, 15 Sep 2020 09:35:07 +0000 (12:35 +0300)]
[clang] [MinGW] Add an implicit .exe suffix even when crosscompiling

GCC 8 changed behaviour wrt this, and made it consistent for cross
compilation cases. While it's a change, it's a more sensible behaviour
going forward.

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

3 years ago[Analyzer] GNU named variadic macros in Plister
Chris Hamilton [Mon, 21 Sep 2020 20:37:39 +0000 (15:37 -0500)]
[Analyzer] GNU named variadic macros in Plister

Added support for GNU named variadic macros in
macro expansion for plist generation.

Fix for https://bugs.llvm.org/show_bug.cgi?id=44493

Reviewed By: Szelethus

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

3 years ago[SLP] use std::distance/find to reduce code; NFC
Sanjay Patel [Mon, 21 Sep 2020 20:04:31 +0000 (16:04 -0400)]
[SLP] use std::distance/find to reduce code; NFC

We were already using this code pattern right after
the loop, so this makes it consistent.

3 years agoAMDGPU: Don't add frame register to frame pseudos
Matt Arsenault [Fri, 18 Sep 2020 20:04:36 +0000 (16:04 -0400)]
AMDGPU: Don't add frame register to frame pseudos

We no longer treat the frame register like a function argument, so the
problem this avoided is no longer relevant.

3 years ago[mlir] Add missing space in debug message
Stephen Neuendorffer [Mon, 21 Sep 2020 19:53:58 +0000 (12:53 -0700)]
[mlir] Add missing space in debug message

3 years agoReapply Revert "RegAllocFast: Rewrite and improve"
Matt Arsenault [Mon, 21 Sep 2020 12:45:06 +0000 (08:45 -0400)]
Reapply Revert "RegAllocFast: Rewrite and improve"

This reverts commit dbd53a1f0c939a55e7719c39d08179468f9ad3dc.

Needed lldb test updates

3 years ago[Coverage] Add empty line regions to SkippedRegions
Zequan Wu [Wed, 2 Sep 2020 21:50:32 +0000 (14:50 -0700)]
[Coverage] Add empty line regions to SkippedRegions

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

3 years ago[InstCombine] use unary shuffle creator to reduce code duplication; NFC
Sanjay Patel [Mon, 21 Sep 2020 19:33:08 +0000 (15:33 -0400)]
[InstCombine] use unary shuffle creator to reduce code duplication; NFC

3 years ago[LoopVectorize] use unary shuffle creator to reduce code duplication; NFC
Sanjay Patel [Mon, 21 Sep 2020 18:01:52 +0000 (14:01 -0400)]
[LoopVectorize] use unary shuffle creator to reduce code duplication; NFC

3 years ago[libc++] Verify base substitutions earlier in the testing format
Louis Dionne [Mon, 21 Sep 2020 19:27:40 +0000 (15:27 -0400)]
[libc++] Verify base substitutions earlier in the testing format

This allows diagnosing missing substitution issues even when doing
availability feature detection in the DSL.

3 years ago[DIE] Remove DeadInstEliminationPass
Arthur Eubanks [Fri, 18 Sep 2020 19:55:00 +0000 (12:55 -0700)]
[DIE] Remove DeadInstEliminationPass

This pass is like DeadCodeEliminationPass, but only does one pass
through a function instead of iterating on users of eliminated
instructions.

DeadCodeEliminationPass should be used in all cases.

Reviewed By: asbirlea

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

3 years ago[NFC][SCEV] Cleanup lowering of @llvm.uadd.sat, (-1 - V) is just ~V
Roman Lebedev [Mon, 21 Sep 2020 19:09:59 +0000 (22:09 +0300)]
[NFC][SCEV] Cleanup lowering of @llvm.uadd.sat, (-1 - V) is just ~V

3 years ago[ELF][test] Delete large temporary files and make some temporary files smaller with...
Fangrui Song [Mon, 21 Sep 2020 19:08:41 +0000 (12:08 -0700)]
[ELF][test] Delete large temporary files and make some temporary files smaller with two text segments

Large files are cumbersome on some filesystems and can more easily trigger ENOSPC.

Some tests use two text sections with output section addresses to test branch ranges.
Use two text segments to prevent LLD from filling the gap and unnecessarily increasing the output size.

With this change, there is no test/ELF temporary file larger than 100MiB.

Reviewed By: psmith

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

3 years ago[AMDGPU] Fixed typo in intrinsic comment. NFC.
Stanislav Mekhanoshin [Mon, 21 Sep 2020 18:52:28 +0000 (11:52 -0700)]
[AMDGPU] Fixed typo in intrinsic comment. NFC.

3 years ago[MS] On x86_32, pass overaligned, non-copyable arguments indirectly
Reid Kleckner [Fri, 18 Sep 2020 18:22:15 +0000 (11:22 -0700)]
[MS] On x86_32, pass overaligned, non-copyable arguments indirectly

This updates the C++ ABI argument classification code to use the logic
from D72114, fixing an ABI incompatibility with MSVC.

Part of PR44395.

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

3 years ago[AMDGPU] Adding mutex to guard lld::elf::link interface use
jerryyin [Mon, 21 Sep 2020 18:22:56 +0000 (11:22 -0700)]
[AMDGPU] Adding mutex to guard lld::elf::link interface use

check-mlir target run tests simultaneously with multiple threads. This caused multiple threads to invoke the `lld::elf::link()` interface at the same time. Since the interface does not have a thread-safe implementation, add a metex to prevent multi-threaded access.

I discovered this by looking the the failure stack trace. lld/ELF/symbolTable.cpp, SymbolTable::insert() hit into an assert with related to Epoch Trackers. The root cause is to due to there is no protection around the symMap (update) which is implemented in non-thread safe data structure: denseMap.

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

3 years ago[ObjCARC] Initialize return value
Arthur Eubanks [Mon, 21 Sep 2020 18:02:37 +0000 (11:02 -0700)]
[ObjCARC] Initialize return value

Mistakenly removed initialization of `Changed` in https://reviews.llvm.org/D87806.

3 years ago[AIX][Clang][Driver] Add handling of shared option
David Tenty [Fri, 28 Aug 2020 18:38:59 +0000 (14:38 -0400)]
[AIX][Clang][Driver] Add handling of shared option

Reviewed By: jasonliu

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

3 years ago[SLP] use unary shuffle creator to reduce code duplication; NFC
Sanjay Patel [Mon, 21 Sep 2020 17:45:56 +0000 (13:45 -0400)]
[SLP] use unary shuffle creator to reduce code duplication; NFC

3 years ago[IRBuilder][VectorCombine] make and use a convenience function for unary shuffle...
Sanjay Patel [Mon, 21 Sep 2020 17:27:40 +0000 (13:27 -0400)]
[IRBuilder][VectorCombine] make and use a convenience function for unary shuffle; NFC

This reduces code duplication for common construct.
Follow-ups can use this in SLP, LoopVectorizer, and other passes.

3 years ago[OpenMP] Protect unrecogonized CUDA error code
Ye Luo [Mon, 21 Sep 2020 17:42:54 +0000 (13:42 -0400)]
[OpenMP] Protect unrecogonized CUDA error code

If an error code can not be recognized by cuGetErrorString, errStr remains null and causes crashing at DP() printing.
Protect this case.

Reviewed By: jhuber6, tianshilei1992

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

3 years ago[SCEV] Recognize @llvm.uadd.sat as `%y + umin(%x, (-1 - %y))`
Roman Lebedev [Mon, 21 Sep 2020 16:42:55 +0000 (19:42 +0300)]
[SCEV] Recognize @llvm.uadd.sat as `%y + umin(%x, (-1 - %y))`

----------------------------------------
define i32 @src(i32 %x, i32 %y) {
%0:
  %r = uadd_sat i32 %x, %y
  ret i32 %r
}
=>
define i32 @tgt(i32 %x, i32 %y) {
%0:
  %t0 = sub nsw nuw i32 4294967295, %y
  %t1 = umin i32 %x, %t0
  %r = add nuw i32 %t1, %y
  ret i32 %r
}
Transformation seems to be correct!

The alternative, naive, lowering could be the following,
although i don't think it's better,
thought it will likely be needed for sadd/ssub/*shl:

----------------------------------------
define i32 @src(i32 %x, i32 %y) {
%0:
  %r = uadd_sat i32 %x, %y
  ret i32 %r
}
=>
define i32 @tgt(i32 %x, i32 %y) {
%0:
  %t0 = zext i32 %x to i33
  %t1 = zext i32 %y to i33
  %t2 = add nuw i33 %t0, %t1
  %t3 = zext i32 4294967295 to i33
  %t4 = umin i33 %t2, %t3
  %r = trunc i33 %t4 to i32
  ret i32 %r
}
Transformation seems to be correct!

3 years ago[SCEV] Recognize @llvm.usub.sat as `%x - (umin %x, %y)`
Roman Lebedev [Mon, 21 Sep 2020 15:05:47 +0000 (18:05 +0300)]
[SCEV] Recognize @llvm.usub.sat as `%x - (umin %x, %y)`

----------------------------------------
define i32 @src(i32 %x, i32 %y) {
%0:
  %r = usub_sat i32 %x, %y
  ret i32 %r
}
=>
define i32 @tgt(i32 %x, i32 %y) {
%0:
  %t0 = umin i32 %x, %y
  %r = sub nuw i32 %x, %t0
  ret i32 %r
}
Transformation seems to be correct!

3 years ago[NFC][SCEV] Add tests for @llvm.*.sat intrinsics
Roman Lebedev [Mon, 21 Sep 2020 14:58:31 +0000 (17:58 +0300)]
[NFC][SCEV] Add tests for @llvm.*.sat intrinsics

3 years ago[SCEV] Recognize @llvm.abs as smax(x, -x)
Roman Lebedev [Mon, 21 Sep 2020 14:16:08 +0000 (17:16 +0300)]
[SCEV] Recognize @llvm.abs as smax(x, -x)

As per alive2 (ignoring undef):

----------------------------------------
define i32 @src(i32 %x, i1 %y) {
%0:
  %r = abs i32 %x, 0
  ret i32 %r
}
=>
define i32 @tgt(i32 %x, i1 %y) {
%0:
  %neg_x = mul i32 %x, 4294967295
  %r = smax i32 %x, %neg_x
  ret i32 %r
}
Transformation seems to be correct!

----------------------------------------
define i32 @src(i32 %x, i1 %y) {
%0:
  %r = abs i32 %x, 1
  ret i32 %r
}
=>
define i32 @tgt(i32 %x, i1 %y) {
%0:
  %neg_x = mul nsw i32 %x, 4294967295
  %r = smax i32 %x, %neg_x
  ret i32 %r
}
Transformation seems to be correct!

3 years ago[NFC][SCEV] Add tests for @llvm.abs intrinsic
Roman Lebedev [Mon, 21 Sep 2020 14:01:11 +0000 (17:01 +0300)]
[NFC][SCEV] Add tests for @llvm.abs intrinsic

3 years ago[SLP] Use for-range loops across ValueLists. NFCI.
Simon Pilgrim [Mon, 21 Sep 2020 17:24:08 +0000 (18:24 +0100)]
[SLP] Use for-range loops across ValueLists. NFCI.

Also rename some existing loops that used a 'j' iterator to consistently use 'V'.

3 years ago[cmake] Centralize LLVM_ENABLE_WARNINGS option
Dave Lee [Mon, 21 Sep 2020 17:22:51 +0000 (10:22 -0700)]
[cmake] Centralize LLVM_ENABLE_WARNINGS option

Configure default value of `LLVM_ENABLE_WARNINGS` in `HandleLLVMOptions.cmake`.

`LLVM_ENABLE_WARNINGS` is documented as ON by default, but `HandleLLVMOptions` assumes the default has been set somewhere else. If it has not been explicitly set, then `HandleLLVMOptions` implicitly uses OFF as a default.

This removes the various `option()` declarations in favor of a single declaration in `HandleLLVMOptions`. This will prevent the unwanted use of `-w` that is mentioned in a couple of the comments.

Reviewed By: DavidTruby, #libunwind, JDevlieghere, compnerd

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

3 years ago[lldb/Commands] Fix outdated `breakpoint command add` help string
Dave Lee [Wed, 16 Sep 2020 23:40:48 +0000 (16:40 -0700)]
[lldb/Commands] Fix outdated `breakpoint command add` help string

Update the some examples in the help string for `breakpoint command add`.

Python breakpoint commands have different output than what's shown in the help string.

Notes:
  * Removed an example containing an inner function, as it seems more about a Python technique than about `command script add`
  * Updated `print x` to `print(x)` to be python 2/3 agnostic

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

3 years agoThe wrong placement of add pass with optimizations led to -funique-internal-linkage...
Sriraman Tallam [Mon, 21 Sep 2020 16:53:09 +0000 (09:53 -0700)]
The wrong placement of add pass with optimizations led to -funique-internal-linkage-names being disabled.

Fixed the placement of the MPM.addpass for UniqueInternalLinkageNames to make
it work correctly with -O2 and new pass manager. Updated the tests to
explicitly check O0 and O2.

Previously, the addPass was placed before BackendUtil.cpp#L1373 which is wrong
as MPM gets assigned at this point and any additions to the pass vector before
this is wrong. This change just moves it after MPM is assigned and places it at
a point where O0 and O0+ can share it.

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

3 years ago[SLP] simplify interface for gather(); NFC
Sanjay Patel [Mon, 21 Sep 2020 16:54:07 +0000 (12:54 -0400)]
[SLP] simplify interface for gather(); NFC

The implementation of gather() should be reduced too,
but this change by itself makes things a little clearer:
we don't try to gather to a different type or
number-of-values than whatever is passed in as the value
list itself.

3 years agoImplicitNullChecks.cpp - use auto const& iterators in for-range loops to avoid copies...
Simon Pilgrim [Mon, 21 Sep 2020 16:38:23 +0000 (17:38 +0100)]
ImplicitNullChecks.cpp - use auto const& iterators in for-range loops to avoid copies. NFCI.

3 years ago[SCEV] Add additional max BTC tests with loop guards.
Florian Hahn [Mon, 21 Sep 2020 16:35:46 +0000 (17:35 +0100)]
[SCEV] Add additional max BTC tests with loop guards.

3 years ago[ObjCARC][NewPM] Port objc-arc-contract to NPM
Arthur Eubanks [Wed, 2 Sep 2020 23:22:24 +0000 (16:22 -0700)]
[ObjCARC][NewPM] Port objc-arc-contract to NPM

Similar to https://reviews.llvm.org/D86178.

This is a module pass instead of a function pass since
ARCRuntimeEntryPoints can lazily add function declarations.

Reviewed By: ahatanak

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

3 years ago[ARM][CMSE] Issue an error if passing arguments through memory across
Momchil Velikov [Mon, 21 Sep 2020 12:22:11 +0000 (13:22 +0100)]
[ARM][CMSE] Issue an error if passing arguments through memory across
security boundary

It was never supported and that part was accidentally omitted when
upstreaming D76518.

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

Change-Id: If6ba9506eb0431c87a1d42a38aa60e47ce263039

3 years agoTargetPassConfig.cpp - use auto const& iterator in for-range loop to avoid copies...
Simon Pilgrim [Mon, 21 Sep 2020 16:16:57 +0000 (17:16 +0100)]
TargetPassConfig.cpp - use auto const& iterator in for-range loop to avoid copies. NFCI.

3 years agoSLPVectorizer.cpp - fix include ordering. NFCI.
Simon Pilgrim [Mon, 21 Sep 2020 16:08:59 +0000 (17:08 +0100)]
SLPVectorizer.cpp - fix include ordering. NFCI.

3 years ago[Sema] Split special builtin type lookups into a separate function
Raul Tambre [Sun, 20 Sep 2020 08:14:20 +0000 (11:14 +0300)]
[Sema] Split special builtin type lookups into a separate function

In case further such cases appear in the future we've got a generic function to add them to.
Additionally changed the ObjC special case to check the language and the identifier builtin ID instead of the name.

Addresses the cleanup suggestion from D87917.

Reviewed By: rjmccall

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

3 years ago[clang] Fix a misleading variable name. NFC.
Igor Kudrin [Mon, 21 Sep 2020 15:59:34 +0000 (22:59 +0700)]
[clang] Fix a misleading variable name. NFC.

The variable is true when frame pointers should be omitted in leaf
functions, not kept.

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

3 years agoMachineCSE.cpp - use auto const& iterator in for-range loop to avoid copies. NFCI.
Simon Pilgrim [Mon, 21 Sep 2020 15:38:44 +0000 (16:38 +0100)]
MachineCSE.cpp - use auto const& iterator in for-range loop to avoid copies. NFCI.

3 years agoFix Wdocumentation unknown parameter warnings. NFCI.
Simon Pilgrim [Mon, 21 Sep 2020 15:28:57 +0000 (16:28 +0100)]
Fix Wdocumentation unknown parameter warnings. NFCI.

3 years agoProfileSummary.cpp - use auto const& iterator in for-range loop to avoid copies....
Simon Pilgrim [Mon, 21 Sep 2020 15:28:10 +0000 (16:28 +0100)]
ProfileSummary.cpp - use auto const& iterator in for-range loop to avoid copies. NFCI.

3 years ago[SVE][CodeGen] Mark ptrue/pfalse instructions as rematerializable
David Sherwood [Mon, 21 Sep 2020 12:59:35 +0000 (13:59 +0100)]
[SVE][CodeGen] Mark ptrue/pfalse instructions as rematerializable

3 years ago[TextAPI] clean up auto usages in tests, NFC
Cyndy Ishida [Fri, 18 Sep 2020 19:22:46 +0000 (12:22 -0700)]
[TextAPI] clean up auto usages in tests, NFC

3 years ago[LLD][ELF][test] Fix CHECKs in map-file test
Edd Dawson [Mon, 21 Sep 2020 15:24:47 +0000 (18:24 +0300)]
[LLD][ELF][test] Fix CHECKs in map-file test

A repeated typo in lld/test/ELF/map-file.s prevented a number of checks from being executed.

CHECk-NEXT -> CHECK-NEXT
    ^             ^

After correcting the typo, a small adjustment was needed to match the size of the synthetic .comment section (which always contains "LLD 1.0" in the test environment).

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

3 years ago[PowerPC] Add vector pair load/store instructions and vector pair register class
Baptiste Saleil [Mon, 21 Sep 2020 15:23:51 +0000 (10:23 -0500)]
[PowerPC] Add vector pair load/store instructions and vector pair register class

This patch adds support for the lxvp, lxvpx, plxvp, stxvp, stxvpx and pstxvp
instructions in the PowerPC backend. These instructions allow loading and
storing VSX register pairs. This patch also adds the VSRp register class
definition needed for these instructions.

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

3 years ago[LoopSimplifyCFG][NewPM] Rename simplify-cfg -> loop-simplifycfg
Arthur Eubanks [Fri, 18 Sep 2020 21:43:36 +0000 (14:43 -0700)]
[LoopSimplifyCFG][NewPM] Rename simplify-cfg -> loop-simplifycfg

This matches the legacy PM name and makes all tests in
Transforms/LoopSimplifyCFG pass under NPM.

Reviewed By: arsenm

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

3 years ago[mlir][openacc] Add attributes to parallel op async, wait and self clauses
Valentin Clement [Mon, 21 Sep 2020 15:24:43 +0000 (11:24 -0400)]
[mlir][openacc] Add attributes to parallel op async, wait and self clauses

Add attributes for the async, wait and self clauses. These clauses can be present without
values. When this is the case they are modelled with an attribute instead of operands.

Reviewed By: ftynse

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

3 years ago[CostModel][X86] Add some select shuffle costs tests for D87884
Simon Pilgrim [Mon, 21 Sep 2020 15:08:50 +0000 (16:08 +0100)]
[CostModel][X86] Add some select shuffle costs tests for D87884

3 years agoUpdate update_analyze_test_checks.py to support API changes from D83004
Simon Pilgrim [Mon, 21 Sep 2020 14:55:46 +0000 (15:55 +0100)]
Update update_analyze_test_checks.py to support API changes from D83004

3 years ago[analyzer][solver] Fix issue with symbol non-equality tracking
Gabor Marton [Mon, 21 Sep 2020 11:42:13 +0000 (13:42 +0200)]
[analyzer][solver] Fix issue with symbol non-equality tracking

We should track non-equivalency (disequality) in case of greater-then or
less-then assumptions.

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

3 years ago[SLP] Allow reordering of vectorization trees with reused instructions.
Alexey Bataev [Fri, 18 Sep 2020 20:45:21 +0000 (16:45 -0400)]
[SLP] Allow reordering of vectorization trees with reused instructions.

If some leaves have the same instructions to be vectorized, we may
incorrectly evaluate the best order for the root node (it is built for the
vector of instructions without repeated instructions and, thus, has less
elements than the root node). In this case we just can not try to reorder
the tree + we may calculate the wrong number of nodes that requre the
same reordering.
For example, if the root node is \<a+b, a+c, a+d, f+e\>, then the leaves
are \<a, a, a, f\> and \<b, c, d, e\>. When we try to vectorize the first
leaf, it will be shrink to \<a, b\>. If instructions in this leaf should
be reordered, the best order will be \<1, 0\>. We need to extend this
order for the root node. For the root node this order should look like
\<3, 0, 1, 2\>. This patch allows extension of the orders of the nodes
with the reused instructions.

Reviewed By: RKSimon

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

3 years ago[AIX][Clang][Driver] Add handling of nostartfiles option
David Tenty [Fri, 28 Aug 2020 18:38:59 +0000 (14:38 -0400)]
[AIX][Clang][Driver] Add handling of nostartfiles option

Reviewed By: jasonliu

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

3 years ago[ASTImporter] Refactor IsStructurallyEquivalent's Decl overloads to be more consistent
Raphael Isemann [Mon, 21 Sep 2020 12:53:35 +0000 (14:53 +0200)]
[ASTImporter] Refactor IsStructurallyEquivalent's Decl overloads to be more consistent

There are several `::IsStructurallyEquivalent` overloads for Decl subclasses
that are used for comparing declarations. There is also one overload that takes
just two Decl pointers which ends up queuing the passed Decls to be later
compared in `CheckKindSpecificEquivalence`.

`CheckKindSpecificEquivalence` implements the dispatch logic for the different
Decl subclasses. It is supposed to hand over the queued Decls to the
subclass-specific `::IsStructurallyEquivalent` overload that will actually
compare the Decl instance. It also seems to implement a few pieces of actual
node comparison logic inbetween the dispatch code.

This implementation causes that the different overloads of
`::IsStructurallyEquivalent` do different (and sometimes no) comparisons
depending on which overload of `::IsStructurallyEquivalent` ends up being
called.

For example, if I want to compare two FieldDecl instances, then I could either
call the `::IsStructurallyEquivalent` with `Decl *` or with `FieldDecl *`
parameters. The overload that takes FieldDecls is doing a correct comparison.
However, the `Decl *` overload just queues the Decl pair.
`CheckKindSpecificEquivalence` has no dispatch logic for `FieldDecl`, so it
always returns true and never does any actual comparison.

On the other hand, if I try to compare two FunctionDecl instances the two
possible overloads of `::IsStructurallyEquivalent` have the opposite behaviour:
The overload that takes `FunctionDecl` pointers isn't comparing the names of the
FunctionDecls while the overload taking a plain `Decl` ends up comparing the
function names (as the comparison logic for that is implemented in
`CheckKindSpecificEquivalence`).

This patch tries to make this set of functions more consistent by making
`CheckKindSpecificEquivalence` a pure dispatch function without any
subclass-specific comparison logic. Also the dispatch logic is now autogenerated
so it can no longer miss certain subclasses.

The comparison code from `CheckKindSpecificEquivalence` is moved to the
respective `::IsStructurallyEquivalent` overload so that the comparison result
no longer depends if one calls the `Decl *` overload or the overload for the
specific subclass. The only difference is now that the `Decl *` overload is
queuing the parameter while the subclass-specific overload is directly doing the
comparison.

`::IsStructurallyEquivalent` is an implementation detail and I don't think the
behaviour causes any bugs in the current implementation (as carefully calling
the right overload for the different classes works around the issue), so the
test for this change is that I added some new code for comparing `MemberExpr`.
The new comparison code always calls the dispatching overload and it previously
failed as the dispatch didn't support FieldDecls.

Reviewed By: martong, a_sidorin

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

3 years agoDWARFEmitter.cpp - use auto const& iterators in for-range loops to avoid copies....
Simon Pilgrim [Mon, 21 Sep 2020 14:15:51 +0000 (15:15 +0100)]
DWARFEmitter.cpp - use auto const& iterators in for-range loops to avoid copies. NFCI.

3 years agoChange comments about order of classes in superclass list.
Paul C. Anagnostopoulos [Sat, 19 Sep 2020 16:22:12 +0000 (12:22 -0400)]
Change comments about order of classes in superclass list.

3 years ago[llvm-readobj/libObject] - Get rid of `FirstSym` argument. NFCI.
Georgii Rymar [Mon, 21 Sep 2020 11:00:42 +0000 (14:00 +0300)]
[llvm-readobj/libObject] - Get rid of `FirstSym` argument. NFCI.

We use `FirstSym` argument in `getExtendedSymbolTableIndex` to calculate
a symbol index:

```
&Sym - &FirstSym
```

Instead, we could pass the symbol index directly.
This is what this patch does, it allows to simplify another llvm-readobj API.

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

3 years agoDWARFYAML::emitDebugSections - remove unnecessary cantFail(success) call. NFCI.
Simon Pilgrim [Mon, 21 Sep 2020 13:06:56 +0000 (14:06 +0100)]
DWARFYAML::emitDebugSections - remove unnecessary cantFail(success) call. NFCI.

As mentioned on rG6bb912336804.

3 years ago[gn build] Port 4fc0214a101
LLVM GN Syncbot [Mon, 21 Sep 2020 12:47:54 +0000 (12:47 +0000)]
[gn build] Port 4fc0214a101

3 years ago[Statepoints][ISEL] gc.relocate uniquification should be based on SDValue, not IR...
Denis Antrushin [Tue, 15 Sep 2020 14:10:07 +0000 (21:10 +0700)]
[Statepoints][ISEL] gc.relocate uniquification should be based on SDValue, not IR Value.

When exporting statepoint results to virtual registers we try to avoid
generating exports for duplicated inputs. But we erroneously use
IR Value* to check if inputs are duplicated. Instead, we should use
SDValue, because even different IR values can get lowered to the same
SDValue.
I'm adding a (degenerate) test case which emphasizes importance of this
feature for invoke statepoints.
If we fail to export only unique values we will end up with something
like that:

  %0 = STATEPOINT
  %1 = COPY %0

landing_pad:
  <use of %1>

And when exceptional path is taken, %1 is left uninitialized (COPY is never
execute).

Reviewed By: reames

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

3 years ago[clang-tidy] New check cppcoreguidelines-prefer-member-initializer
Adam Balogh [Fri, 11 Sep 2020 08:12:39 +0000 (10:12 +0200)]
[clang-tidy] New check cppcoreguidelines-prefer-member-initializer

Finds member initializations in the constructor body which can be placed
into the initialization list instead. This does not only improves the
readability of the code but also affects positively its performance.
Class-member assignments inside a control statement or following the
first control statement are ignored.

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

3 years ago[SVE] Change definition of reduction ISD nodes to have an SVE vector result type.
Paul Walker [Thu, 17 Sep 2020 11:04:35 +0000 (12:04 +0100)]
[SVE] Change definition of reduction ISD nodes to have an SVE vector result type.

The current nodes, AArch64::SMAXV_PRED for example, are defined to
return a NEON vector result.  This is incorrect because they modify
the complete SVE register and are thus changed to represent such.

This patch also adds nodes for UADDV_PRED and SADDV_PRED, which
unifies the handling of all SVE reductions.

NOTE: Floating-point reductions are already implemented correctly,
so this patch is essentially making everything consistent with those.

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

3 years ago[SVE] Use NEON for extract_vector_elt when the index is in range.
Paul Walker [Thu, 17 Sep 2020 14:04:31 +0000 (15:04 +0100)]
[SVE] Use NEON for extract_vector_elt when the index is in range.

Patch also adds missing patterns for unpacked vector types and
extracts of element zero.

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

3 years ago[SyntaxTree][NFC] follow naming convention + remove auto on empty vector declaration
Eduardo Caldas [Mon, 21 Sep 2020 08:39:02 +0000 (08:39 +0000)]
[SyntaxTree][NFC] follow naming convention + remove auto on empty vector declaration

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

3 years ago[MLIR] Fix typo and expand gpu.host_register description.
Christian Sigg [Wed, 19 Aug 2020 13:50:44 +0000 (15:50 +0200)]
[MLIR] Fix typo and expand gpu.host_register description.

See comments in https://reviews.llvm.org/D85631.

Reviewed By: herhut

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

3 years agoFix buildbot.
Haojian Wu [Mon, 21 Sep 2020 11:29:44 +0000 (13:29 +0200)]
Fix buildbot.

TemplateArgumentLocInfo cannot result in a constant expression anymore
after D87080.

3 years agoRevert "[NFC][ScheduleDAG] Remove unused EntrySU SUnit"
Alexander Belyaev [Mon, 21 Sep 2020 11:18:39 +0000 (13:18 +0200)]
Revert "[NFC][ScheduleDAG] Remove unused EntrySU SUnit"

This reverts commit 0345d88de654259ae90494bf9b015416e2cccacb.

Google internal backend uses EntrySU, we are looking into removing
dependency on it.

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

3 years ago[AST] Reduce the size of TemplateArgumentLocInfo.
Haojian Wu [Mon, 21 Sep 2020 11:08:17 +0000 (13:08 +0200)]
[AST] Reduce the size of TemplateArgumentLocInfo.

allocate the underlying data of Template kind separately, this would reduce AST
memory usage

- TemplateArgumentLocInfo 24 => 8 bytes
- TemplateArgumentLoc  48 => 32 bytes
- DynTypeNode 56 => 40 bytes

ASTContext::.getASTAllocatedMemory changes:
  SemaDecl.cpp 255.5 MB => 247.5MB
  SemaExpr.cpp 293.5 MB => 283.5MB

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

3 years agoRecommit "[SCEV] Look through single value PHIs."
Florian Hahn [Mon, 21 Sep 2020 10:03:27 +0000 (11:03 +0100)]
Recommit "[SCEV] Look through single value PHIs."

This commit was originally because it was suspected to cause a crash,
but a reproducer did not surface.

A crash that was exposed by this change was fixed in 1d8f2e52925b.

This reverts the revert commit 0581c0b0eeba03da590d1176a4580cf9b9e8d1e3.

3 years ago[mlir][VectorOps] Loosen restrictions on vector.reduction types
Benjamin Kramer [Mon, 21 Sep 2020 10:04:33 +0000 (12:04 +0200)]
[mlir][VectorOps] Loosen restrictions on vector.reduction types

LLVM can deal with any integer or float type, don't arbitrarily restrict
it to f32/f64/i32/i64.

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

3 years ago[ARM] Select f32 constants with vmov.f16
David Green [Mon, 21 Sep 2020 10:10:47 +0000 (11:10 +0100)]
[ARM] Select f32 constants with vmov.f16

This adds lowering for f32 values using the vmov.f16, which zeroes the
top bits whilst setting the lower bits to a pattern. This range of
values does not often come up, except where a f16 constant value has
been converted to a f32.

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

3 years agoDo not dereference an array out of bound just to take its address
serge-sans-paille [Fri, 18 Sep 2020 09:02:15 +0000 (11:02 +0200)]
Do not dereference an array out of bound just to take its address

This is UB by the standard, and caught by the libstdc++ asserts

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

3 years ago[llvm-readelf/obj] - Stop printing invalid names for unnamed section symbols.
Georgii Rymar [Tue, 15 Sep 2020 13:17:08 +0000 (16:17 +0300)]
[llvm-readelf/obj] - Stop printing invalid names for unnamed section symbols.

We have an issue with `ELFDumper<ELFT>::getSymbolSectionName`:
1) It is used deeply for both LLVM/GNU styles and might return LLVM-style only
   values to describe symbols: "Undefined", "Processor Specific", "Absolute", etc.

2) `getSymbolSectionName` is used by `getFullSymbolName` and these special values
   might appear instead of symbol names in many places.
   This occurs for unnamed section symbols currently.

This patch extracts the LLVM specific logic to `LLVMStyle<ELFT>::printSymbolSection`,
which seems to be the only place where we want to print the special values mentioned.
It also adds a meaningful new warning that is reported when we are unable to get
a section index for a section symbol.

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

3 years ago[NFC][ARM] More tail predication tests.
Sam Parker [Mon, 21 Sep 2020 09:54:11 +0000 (10:54 +0100)]
[NFC][ARM] More tail predication tests.

Add mir tests for use/def of P0.

3 years ago[AArch64] Cortex-A55 scheduler model
Sjoerd Meijer [Mon, 21 Sep 2020 09:39:28 +0000 (10:39 +0100)]
[AArch64] Cortex-A55 scheduler model

This is an initial commit adding the A55 model, but it isn't used/enabled yet.
We will follow up on this to improve the model, then flip the switch.

The optimisation guide describing Cortex-A55 micro-architecture in more detail
can be found here:

https://static.docs.arm.com/epm128372/20/arm_cortex_a55_software_optimization_guide_v2.pdf

Original patch by Javed Absar.

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

3 years ago[mlir] Shape.AssumingOp implements RegionBranchOpInterface.
Tres Popp [Fri, 18 Sep 2020 09:14:32 +0000 (11:14 +0200)]
[mlir] Shape.AssumingOp implements RegionBranchOpInterface.

This adds support for the interface and provides unambigious information
on the control flow as it is unconditional on any runtime values.
The code is tested through confirming that buffer-placement behaves as
expected.

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

3 years ago[SyntaxTree][Synthesis] Implement `deepCopy`
Eduardo Caldas [Wed, 16 Sep 2020 07:56:47 +0000 (07:56 +0000)]
[SyntaxTree][Synthesis] Implement `deepCopy`

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

3 years ago[compiler-rt] Fix atomic support functions on 32-bit architectures
Alex Richardson [Mon, 21 Sep 2020 08:00:54 +0000 (09:00 +0100)]
[compiler-rt] Fix atomic support functions on 32-bit architectures

The code currently uses __c11_atomic_is_lock_free() to detect whether an
atomic operation is natively supported. However, this can result in a
runtime function call to determine whether the given operation is lock-free
and clang generating a call to e.g. __atomic_load_8 since the branch is
not a constant zero. Since we are implementing those runtime functions, we
must avoid those calls. This patch replaces __c11_atomic_is_lock_free()
with __atomic_always_lock_free() which always results in a compile-time
constant value. This problem was found while compiling atomic.c for MIPS32
since the -Watomic-alignment warning was being triggered and objdump showed
an undefined reference to _atomic_is_lock_free.

In addition to fixing 32-bit platforms this also enables the 16-byte case
that was disabled in r153779 (185f2edd70a34d28b305df0cd8ce519ecbca2cfd).

Reviewed By: efriedma

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

3 years ago[RISC-V] Implement RISCVInstrInfo::isCopyInstrImpl()
Alex Richardson [Mon, 21 Sep 2020 07:59:22 +0000 (08:59 +0100)]
[RISC-V] Implement RISCVInstrInfo::isCopyInstrImpl()

This does not result in changes for any of the current tests, but it might
improve debug information in some cases.

Reviewed By: luismarques

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

3 years ago[lld][ELF][test] Add additional LTO testing
James Henderson [Thu, 17 Sep 2020 10:23:58 +0000 (11:23 +0100)]
[lld][ELF][test] Add additional LTO testing

The additional testing is testing we previously had in a downstream test
suite.

Reviewed by: grimar, MaskRay

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

3 years ago[Test] Test auto-update
Max Kazantsev [Mon, 21 Sep 2020 09:05:29 +0000 (16:05 +0700)]
[Test] Test auto-update

3 years ago[CodeGen] Fixing inconsistent ABI mangling of vlaues in SelectionDAGBuilder
Lucas Prates [Thu, 17 Sep 2020 17:07:35 +0000 (18:07 +0100)]
[CodeGen] Fixing inconsistent ABI mangling of vlaues in SelectionDAGBuilder

SelectionDAGBuilder was inconsistently mangling values based on ABI
Calling Conventions when getting them through copyFromRegs in
SelectionDAGBuilder, causing duplicate value type convertions for
function arguments. The checking for the mangling requirement was based
on the value's originating instruction and was performed outside of, and
inspite of, the regular Calling Convention Lowering.

The issue could be observed in a scenario such as:

```
%arg1 = load half, half* %const, align 2
%arg2 = call fastcc half @someFunc()
call fastcc void @otherFunc(half %arg1, half %arg2)
; Here, %arg2 was incorrectly mangled twice, as the CallConv data from
; the call to @someFunc() was taken into consideration for the check
; when getting the value for processing the call to @otherFunc(...),
; after the proper convertion had taken place when lowering the return
; value of the first call.
```

This patch fixes the issue by disregarding the Calling Convention
information for such copyFromRegs, making sure the ABI mangling is
properly contanined in the Calling Convention Lowering.

This fixes Bugzilla #47454.

Reviewed By: efriedma

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

3 years agoFix crash in the pass pipeline when local reproducer is enabled
Mehdi Amini [Mon, 21 Sep 2020 06:42:25 +0000 (06:42 +0000)]
Fix crash in the pass pipeline when local reproducer is enabled

This crash only happens when a function pass is followed by a module
pass. In this case the splitting of the pass pipeline didn't handle
properly the verifier passes and ended up with an odd number of pass in
the pipeline, breaking an assumption of the local crash reproducer
executor and hitting an assertion.

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

3 years ago[LSR] Preserve MSSA when using SplitCriticalEdge.
Florian Hahn [Sun, 20 Sep 2020 11:40:35 +0000 (12:40 +0100)]
[LSR] Preserve MSSA when using SplitCriticalEdge.

LSR claims to MemorySSA, but we also have to make sure it is preserved
when splitting critical edges. This can be done by passing MSSAU to
SplitCriticalEdge.

Fixes PR47557.

3 years ago[clang] Fix incorrect call to TextDiagnostic::printDiagnosticMessage
Andrzej Warzynski [Wed, 16 Sep 2020 16:54:29 +0000 (17:54 +0100)]
[clang] Fix incorrect call to TextDiagnostic::printDiagnosticMessage

As per the documentation, the 2nd argument in printDiagnosticMessage
should be a bool that specifies whether the underlying message is a
continuation note diagnostic or not. More specifically, it should be:
```
Level == DiagnosticsEngine::Note
```
instead of:
```
Level
```

This change means that `no input file` in the following scenario will be
now correctly printed in bold:
```
$ bin/clang
clang: error: no input files
```
In terminals that don't support text formatting the behaviour doesn't
change.

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

3 years ago[clang][AArch64] Correct return type of Neon vqmovun intrinsics
David Spickett [Mon, 14 Sep 2020 13:16:20 +0000 (14:16 +0100)]
[clang][AArch64] Correct return type of Neon vqmovun intrinsics

Neon intrinsics vqmovunh_s16, vqmovuns_s32, vqmovund_s64
should have unsigned return types.

See https://developer.arm.com/architectures/instruction-sets/simd-isas/neon/intrinsics?search=vqmovun

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

Reviewed By: efriedma

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