platform/upstream/llvm.git
6 years ago[MinGW] Don't link -lmsvcrt if a different msvcrt version is to be linked
Martin Storsjo [Mon, 25 Sep 2017 19:24:45 +0000 (19:24 +0000)]
[MinGW] Don't link -lmsvcrt if a different msvcrt version is to be linked

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

llvm-svn: 314138

6 years ago[SLP] Add a test for PR32086, NFC.
Alexey Bataev [Mon, 25 Sep 2017 19:12:59 +0000 (19:12 +0000)]
[SLP] Add a test for PR32086, NFC.

llvm-svn: 314137

6 years ago[Hexagon] Better determination of register classes in bit tracker
Krzysztof Parzyszek [Mon, 25 Sep 2017 19:12:55 +0000 (19:12 +0000)]
[Hexagon] Better determination of register classes in bit tracker

Add two callbacks to MachineEvaluator, so that specific implementations
can specify more details about register classes:
- composeWithSubRegIndex(RC,Idx), to provide the register class for a
  register from RC used in conjunction with a subregister index Idx.
- getPhysRegBitWidth(Reg), to provide the size in bits of the given
  physical register.

llvm-svn: 314136

6 years ago[NVPTX] added match.{any,all}.sync instructions, intrinsics & builtins.
Artem Belevich [Mon, 25 Sep 2017 18:53:57 +0000 (18:53 +0000)]
[NVPTX] added match.{any,all}.sync instructions, intrinsics & builtins.

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

llvm-svn: 314135

6 years ago[Hexagon] Make getHexagonSubRegIndex take reference instead of pointer
Krzysztof Parzyszek [Mon, 25 Sep 2017 18:49:42 +0000 (18:49 +0000)]
[Hexagon] Make getHexagonSubRegIndex take reference instead of pointer

llvm-svn: 314134

6 years ago[AVX-512] Replace large number of explicit patterns that check for insert_subvector...
Craig Topper [Mon, 25 Sep 2017 18:43:13 +0000 (18:43 +0000)]
[AVX-512] Replace large number of explicit patterns that check for insert_subvector with zero after masked compares with fewer patterns with predicate

This replaces the large number of patterns that handle every possible case of zeroing after a masked compare with a few simpler patterns that use a predicate to check for a masked compare producer.

This is similar to what we do for detecting free GR32->GR64 zero extends and free xmm->ymm/zmm zero extends.

This shrinks the isel table from ~590k to ~531k. This is a roughly 10% reduction in size.

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

llvm-svn: 314133

6 years agoInitial patchset to get the testsuite running against armv7 and arm64 iOS devices.
Jason Molenda [Mon, 25 Sep 2017 18:19:39 +0000 (18:19 +0000)]
Initial patchset to get the testsuite running against armv7 and arm64 iOS devices.
Normal customer devices won't be able to run these tests, we're hoping to get
a public facing bot set up at some point.  Both devices pass the testsuite without
any errors or failures.

I have seen some instability with the armv7 test runs, I may submit additional patches
to address this.  arm64 looks good.

I'll be watching the bots for the rest of today; if any problems are introduced by
this patch I'll revert it - if anyone sees a problem with their bot that I don't
see, please do the same.  I know it's a rather large patch.

One change I had to make specifically for iOS devices was that debugserver can't
create files.  There were several tests that launch the inferior process redirecting
its output to a file, then they retrieve the file.  They were not trying to test
file redirection in these tests, so I rewrote those to write their output to a file
directly.

llvm-svn: 314132

6 years ago[SimplifyIndvar] Minor change to refine r314125, NFC
Hongbin Zheng [Mon, 25 Sep 2017 18:10:36 +0000 (18:10 +0000)]
[SimplifyIndvar] Minor change to refine r314125, NFC

llvm-svn: 314130

6 years ago[CUDA] Fix names of __nvvm_vote* intrinsics.
Artem Belevich [Mon, 25 Sep 2017 17:55:26 +0000 (17:55 +0000)]
[CUDA] Fix names of __nvvm_vote* intrinsics.

Also fixed a syntax error in activemask().

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

llvm-svn: 314129

6 years agoARM: One more fix for swifterror CSR set
Arnold Schwaighofer [Mon, 25 Sep 2017 17:51:33 +0000 (17:51 +0000)]
ARM: One more fix for swifterror CSR set

We use a differently ordered CSR set if the frame pointer is pushed. Add a
matching ..._SwiftError version.

llvm-svn: 314128

6 years agoUse socketpair on all Unix platforms
Eugene Zemtsov [Mon, 25 Sep 2017 17:41:16 +0000 (17:41 +0000)]
Use socketpair on all Unix platforms

Using TCP sockets is insecure against local attackers, and possibly
against remote attackers too (some vulnerabilities may allow tricking a
browser to make a request to localhost). Use socketpair (which is immune
to such attacks) on all Unix platforms.

Patch by Demi Marie Obenour < demiobenour@gmail.com >

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

llvm-svn: 314127

6 years agoUse UINT64_MAX instead of implicitly-type-converted -1.
Rui Ueyama [Mon, 25 Sep 2017 17:40:21 +0000 (17:40 +0000)]
Use UINT64_MAX instead of implicitly-type-converted -1.

llvm-svn: 314126

6 years ago[SimplifyIndvar] Replace the srem used by IV if we can prove both of its operands...
Hongbin Zheng [Mon, 25 Sep 2017 17:39:40 +0000 (17:39 +0000)]
[SimplifyIndvar] Replace the srem used by IV if we can prove both of its operands are non-negative

Since now SCEV can handle 'urem', an 'urem' is a better canonical form than an 'srem' because it has well-defined behavior

This is a follow up of D34598

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

llvm-svn: 314125

6 years ago[Sema] Null check in BuildDeclarationNameExpr
Yi Kong [Mon, 25 Sep 2017 17:36:54 +0000 (17:36 +0000)]
[Sema] Null check in BuildDeclarationNameExpr

Qualtype may point to null if we cannot infer its type yet.

Fixes PR33843

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

llvm-svn: 314124

6 years ago[ARM] Fix -Wdangling-else warning.
Benjamin Kramer [Mon, 25 Sep 2017 17:35:38 +0000 (17:35 +0000)]
[ARM] Fix -Wdangling-else warning.

A ternary is clearer here. No functionality change.

llvm-svn: 314123

6 years agoRevert "Initial patchset to get the testsuite running against armv7 and arm64 iOS...
Chris Bieneman [Mon, 25 Sep 2017 17:31:40 +0000 (17:31 +0000)]
Revert "Initial patchset to get the testsuite running against armv7 and arm64 iOS devices. Normal customer devices won't be able to run these devices, we're hoping to get a public facing bot set up at some point.  Both devices pass the testsuite without any errors or failures."

This patch has been causing LLDB test failures on ObjC tests. A test log
may still be available here:

http://lab.llvm.org:8080/green/view/LLDB/job/lldb/1650/

This reverts commit r314038.

llvm-svn: 314122

6 years agoARM: Use the proper swifterror CSR list on platforms other than darwin
Arnold Schwaighofer [Mon, 25 Sep 2017 17:19:50 +0000 (17:19 +0000)]
ARM: Use the proper swifterror CSR list on platforms other than darwin

Noticed by inspection

llvm-svn: 314121

6 years agoUse a temporary varaible to improve readability. NFC.
Rui Ueyama [Mon, 25 Sep 2017 17:19:17 +0000 (17:19 +0000)]
Use a temporary varaible to improve readability. NFC.

llvm-svn: 314120

6 years ago[clangd] Fix missing "message" key when responding with unsupported method
Benjamin Kramer [Mon, 25 Sep 2017 17:16:47 +0000 (17:16 +0000)]
[clangd] Fix missing "message" key when responding with unsupported method

The language server protocol dictates that a ResponseError should have a
[message string][1] describing the error. This adds a simple message to the
error and a simple test.

[1]: https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md#response-message

Patch by Raoul Wols!

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

llvm-svn: 314119

6 years agorevert r314117 because there are bogus clang tests that depend on the optimizer
Sanjay Patel [Mon, 25 Sep 2017 17:00:04 +0000 (17:00 +0000)]
revert r314117 because there are bogus clang tests that depend on the optimizer

llvm-svn: 314118

6 years ago[InstCombine] remove extract-of-select vector transform
Sanjay Patel [Mon, 25 Sep 2017 16:41:34 +0000 (16:41 +0000)]
[InstCombine] remove extract-of-select vector transform

The transform to convert an extract-of-a-select-of-vectors was added at:
rL194013

And a question about the validity of this transform was raised in the review:
https://reviews.llvm.org/D1539:
...but not answered AFAICT>

Most of the motivating cases in that patch are now handled by other combines. These are the tests that were added with
the original commit, but they are not regressing even after we remove the transform in this patch.

The diffs we see after removing this transform cause us to avoid increasing the instruction count, so we don't want to do
those transforms as canonicalizations.

The motivation for not turning a vector-select-of-vectors into a scalar operation is shown in PR33301:
https://bugs.llvm.org/show_bug.cgi?id=33301
...in those cases, we'll get vector ops with this patch rather than the vector/scalar mix that we currently see.

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

llvm-svn: 314117

6 years ago[ScopInfo] Allow uniform branch conditions
Tobias Grosser [Mon, 25 Sep 2017 16:37:15 +0000 (16:37 +0000)]
[ScopInfo] Allow uniform branch conditions

If all but one branch come from an error condition and the incoming value from
this branch is a constant, we can model this branch.

llvm-svn: 314116

6 years agoRemove trailing whitespaces.
Michael Liao [Mon, 25 Sep 2017 16:21:21 +0000 (16:21 +0000)]
Remove trailing whitespaces.

llvm-svn: 314115

6 years ago[DebugInfo] Sort the SDDbgValue list before assuming it is in IR order
Reid Kleckner [Mon, 25 Sep 2017 16:14:53 +0000 (16:14 +0000)]
[DebugInfo] Sort the SDDbgValue list before assuming it is in IR order

Summary:
This code iterates the 'Orders' vector in parallel with the DbgValue
list, emitting all DBG_VALUEs that occurred between the last IR order
insertion point and the next insertion point. This assumes the
SDDbgValue list is sorted in IR order, which it usually is. However, it
is not sorted when a node with a debug value is replaced with another
one. When this happens, TransferDbgValues is called, and the new value
is added to the end of the list.

The problem can be solved by stably sorting the list by IR order.

Reviewers: aprantl, Ka-Ka

Reviewed By: aprantl

Subscribers: MatzeB, hiraditya, llvm-commits

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

llvm-svn: 314114

6 years agoUse {} instead of make_pair and an iterator for the insertion point, NFC
Reid Kleckner [Mon, 25 Sep 2017 16:14:39 +0000 (16:14 +0000)]
Use {} instead of make_pair and an iterator for the insertion point, NFC

llvm-svn: 314113

6 years agoRework atomic ops to use clang builtins rather than llvm asm
Jan Vesely [Mon, 25 Sep 2017 16:07:34 +0000 (16:07 +0000)]
Rework atomic ops to use clang builtins rather than llvm asm

reviewer: Aaron Watry

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 314112

6 years agoprepare_builtins: Fix compile breakage with older LLVM
Jan Vesely [Mon, 25 Sep 2017 16:04:37 +0000 (16:04 +0000)]
prepare_builtins: Fix compile breakage with older LLVM

Fixes r314050

reviewer: Tom Stellard

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 314111

6 years ago[scudo] Scudo thread specific data refactor, part 2
Kostya Kortchinsky [Mon, 25 Sep 2017 15:12:08 +0000 (15:12 +0000)]
[scudo] Scudo thread specific data refactor, part 2

Summary:
Following D38139, we now consolidate the TSD definition, merging the shared
TSD definition with the exclusive TSD definition. We introduce a boolean set
at initializaton denoting the need for the TSD to be unlocked or not. This
adds some unused members to the exclusive TSD, but increases consistency and
reduces the definitions fragmentation.

We remove the fallback mechanism from `scudo_allocator.cpp` and add a fallback
TSD in the non-shared version. Since the shared version doesn't require one,
this makes overall more sense.

There are a couple of additional cosmetic changes: removing the header guards
from the remaining `.inc` files, added error string to a `CHECK`.

Question to reviewers: I thought about friending `getTSDAndLock` in `ScudoTSD`
so that the `FallbackTSD` could `Mutex.Lock()` directly instead of `lock()`
which involved zeroing out the `Precedence`, which is unused otherwise. Is it
worth doing?

Reviewers: alekseyshl, dvyukov, kcc

Reviewed By: dvyukov

Subscribers: srhines, llvm-commits

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

llvm-svn: 314110

6 years ago[X86][LLVM]Expanding Supports lowerInterleavedStore() in X86InterleavedAccess (VF8...
Michael Zuckerman [Mon, 25 Sep 2017 14:50:38 +0000 (14:50 +0000)]
[X86][LLVM]Expanding Supports lowerInterleavedStore() in X86InterleavedAccess (VF8 stride 4):

This patch expands the support of lowerInterleavedStore to 8x8i stride 4.

LLVM creates suboptimal shuffle code-gen for AVX2.
In overall, this patch is a specific fix for the pattern (Strid=4 VF=8) and we plan to include more patterns in the future.

The patch goal is to optimize the following sequence:
At the end of the computation, we have xmm2, xmm0, xmm12 and xmm3 holding
each 8 chars:

c0, c1, , c7
m0, m1, , m7
y0, y1, , y7
k0, k1, ., k7

And these need to be transposed/interleaved and stored like so:

c0 m0 y0 k0 c1 m1 y1 k1 c2 m2 y2 k2 c3 m3 y3 k3 ....

Reviewers
DavidKreitzer
Farhana
zvi
igorb
guyblank
RKSimon
Ayal

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

Change-Id: I3cc5c2ca5d6318901c192a4428493b99ef424c32
llvm-svn: 314109

6 years ago[ELF][fix] Using statically linked lld leads to segmentation fault on linking ELF
Evgeny Mankov [Mon, 25 Sep 2017 14:42:15 +0000 (14:42 +0000)]
[ELF][fix] Using statically linked lld leads to segmentation fault on linking ELF

[Synopsys]
Using function elf::link(...) leads to segmentation fault on its second call. First call finishes correctly.
[Solution]
Clear the rest of globals.

Reviewed by: George Rimar and Rui Ueyama

Differential Revision: http://reviews.llvm.org/D38131

llvm-svn: 314108

6 years agoFix clangd when built with LLVM_LINK_LLVM_DYLIB=ON
Sylvestre Ledru [Mon, 25 Sep 2017 14:08:35 +0000 (14:08 +0000)]
Fix clangd when built with LLVM_LINK_LLVM_DYLIB=ON

Reviewers: malaperle, malaperle-ericsson, bkramer

Reviewed By: bkramer

Subscribers: bkramer, mgorny, ilya-biryukov, cfe-commits

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

llvm-svn: 314107

6 years ago[PowerPC] Eliminate compares - add i64 sext/zext handling for SETLT/SETGT
Nemanja Ivanovic [Mon, 25 Sep 2017 14:05:46 +0000 (14:05 +0000)]
[PowerPC] Eliminate compares - add i64 sext/zext handling for SETLT/SETGT

As mentioned in https://reviews.llvm.org/D33718, this simply adds another
pattern to the compare elimination sequence and is committed without a
differential review.

llvm-svn: 314106

6 years ago[AArch64] Add basic support for Qualcomm's Saphira CPU.
Chad Rosier [Mon, 25 Sep 2017 14:05:00 +0000 (14:05 +0000)]
[AArch64] Add basic support for Qualcomm's Saphira CPU.

llvm-svn: 314105

6 years ago[Clang] Adding missing feature to goldmont
Michael Zuckerman [Mon, 25 Sep 2017 13:49:32 +0000 (13:49 +0000)]
[Clang] Adding missing feature to goldmont

Change-Id: I6c22478d16b8e02ce60dae2f8c80d43bc5ab3a9c
llvm-svn: 314104

6 years agoAdding missing feature to goldmont.
Michael Zuckerman [Mon, 25 Sep 2017 13:45:31 +0000 (13:45 +0000)]
Adding missing feature to goldmont.

Change-Id: I1ddc619169fae6a56308deef8dae5db3da702cf4
llvm-svn: 314103

6 years agofixing a bug in mask[z]_set1 intrinsic
Jina Nahias [Mon, 25 Sep 2017 13:38:08 +0000 (13:38 +0000)]
fixing a bug in mask[z]_set1 intrinsic

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

Change-Id: I80bbff9cbe93e4be54d8a761ef9723edf3f57c57
llvm-svn: 314102

6 years ago[SLP] Support for horizontal min/max reduction.
Alexey Bataev [Mon, 25 Sep 2017 13:34:59 +0000 (13:34 +0000)]
[SLP] Support for horizontal min/max reduction.

Summary:
SLP vectorizer supports horizontal reductions for Add/FAdd binary operations. Patch adds support for horizontal min/max reductions.
Function getReductionCost() is split to getArithmeticReductionCost() for binary operation reductions and getMinMaxReductionCost() for min/max reductions.
Patch fixes PR26956.

Reviewers: spatel, mkuper, hfinkel, RKSimon

Subscribers: llvm-commits

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

llvm-svn: 314101

6 years ago[mips][compiler-rt] Disable sem_init_glibc.cc for MIPS64.
Simon Dardis [Mon, 25 Sep 2017 13:25:34 +0000 (13:25 +0000)]
[mips][compiler-rt] Disable sem_init_glibc.cc for MIPS64.

This test can't pass on MIPS64 due to the lack of versioned interceptors
for asan and company. The interceptors bind to the earlier version of
sem_init rather than the latest version. For MIPS64el this causes an
accidental pass while MIPS64 big endian fails due reading back a
different 32bit word to what sem_init wrote when the test is corrected
to use 64bit atomics.

llvm-svn: 314100

6 years ago[ELF] - Simplify removeUnusedSyntheticSections a bit.
George Rimar [Mon, 25 Sep 2017 09:46:33 +0000 (09:46 +0000)]
[ELF] - Simplify removeUnusedSyntheticSections a bit.

Previously`InX::Got` and InX::MipsGot synthetic sections
were not removed if ElfSym::GlobalOffsetTable was defined.
ElfSym::GlobalOffsetTable is a symbol for _GLOBAL_OFFSET_TABLE_.

Patch moves ElfSym::GlobalOffsetTable check out from removeUnusedSyntheticSections.
Also note that there was no point to check ElfSym::GlobalOffsetTable for MIPS case
because InX::MipsGot::empty() always returns false for non-relocatable case, and in case
of relocatable output we do not create special symbols anyways.

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

llvm-svn: 314099

6 years ago[ELF] - Report orphan sections if -verbose given.
George Rimar [Mon, 25 Sep 2017 09:41:32 +0000 (09:41 +0000)]
[ELF] - Report orphan sections if -verbose given.

When -verbose is specified, patch outputs names of each input orphan section
assigned to output.

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

llvm-svn: 314098

6 years ago[ELF] - LTO: do not optimize away symbols accessed from linkerscript.
George Rimar [Mon, 25 Sep 2017 09:31:43 +0000 (09:31 +0000)]
[ELF] - LTO: do not optimize away symbols accessed from linkerscript.

Previously when BC file had global variable that was accessed from script,
it was optimized away or inlined by IPO.
In this patch I add symbols at left side of assignment expression as LinkerRedefined,
what prevents optimization for them.

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

llvm-svn: 314097

6 years ago[CodeGenPrepare][NFC] Rename TargetTransformInfo::expandMemCmp -> TargetTransformInfo...
Clement Courbet [Mon, 25 Sep 2017 06:35:16 +0000 (06:35 +0000)]
[CodeGenPrepare][NFC] Rename TargetTransformInfo::expandMemCmp -> TargetTransformInfo::enableMemCmpExpansion.

Summary:
Right now there are two functions with the same name, one does the work
and the other one returns true if expansion is needed. Rename
TargetTransformInfo::expandMemCmp to make it more consistent with other
members of TargetTransformInfo.

Remove the unused Instruction* parameter.

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

llvm-svn: 314096

6 years agoDo not sort CU vectors.
Rui Ueyama [Mon, 25 Sep 2017 05:30:39 +0000 (05:30 +0000)]
Do not sort CU vectors.

We used to sort and uniquify CU vectors, but looks like CU vectors in
.gdb_index sections created by gold are not guaranteed to be sorted.

llvm-svn: 314095

6 years agoSpeeds up CU vector creation.
Rui Ueyama [Mon, 25 Sep 2017 04:55:27 +0000 (04:55 +0000)]
Speeds up CU vector creation.

We used to use std::set to uniquify CU vector elements, but as we know,
std::set is pretty slow. Fortunately we didn't actually have to use a
std::set here. This patch replaces it with std::vector.

With this patch, lld's -gdb-index overhead when linking a clang debug
build is now about 1 second (8.65 seconds without -gdb-index vs 9.60
seconds with -gdb-index). Since gold takes more than 6 seconds to create
a .gdb_index for the same output, our number isn't that bad.

llvm-svn: 314094

6 years agoFix off-by-one error.
Rui Ueyama [Mon, 25 Sep 2017 03:40:45 +0000 (03:40 +0000)]
Fix off-by-one error.

llvm-svn: 314093

6 years agoDo not use StringTableBuilder to build symbol table for .gdb_index.
Rui Ueyama [Mon, 25 Sep 2017 02:29:51 +0000 (02:29 +0000)]
Do not use StringTableBuilder to build symbol table for .gdb_index.

Previously, we had two levels of hash table lookup. The first hash
lookup uses CachedHashStringRefs as keys and returns offsets in string
table. Then, we did the second hash table lookup to obtain GdbSymbol
pointers. But we can directly map strings to GDbSymbols.

One test file is updated in this patch because we no longer have a '\0'
byte at the start of the string pool, which was automatically inserted
by StringTableBuilder.

This patch speeds up Clang debug build (with -gdb-index) link time by
0.3 seconds.

llvm-svn: 314092

6 years agoCompute string hashes early and cache them.
Rui Ueyama [Mon, 25 Sep 2017 01:42:57 +0000 (01:42 +0000)]
Compute string hashes early and cache them.

This change alone speeds up linking of Clang debug build with -gdb-index
by 1.2 seconds, from 12.5 seconds to 11.3 seconds. (Without -gdb-index,
lld takes 8.5 seconds to link the same input files.)

llvm-svn: 314090

6 years agoRename copy -> copyFrom.
Rui Ueyama [Mon, 25 Sep 2017 00:57:30 +0000 (00:57 +0000)]
Rename copy -> copyFrom.

This patch is to improve code readability.

llvm-svn: 314089

6 years agoMove Config->SymbolRenaming to SymbolTable.
Rui Ueyama [Mon, 25 Sep 2017 00:57:18 +0000 (00:57 +0000)]
Move Config->SymbolRenaming to SymbolTable.

In order to keep track of symbol renaming, we used to have
Config->SymbolRenaming, and whether a symbol is in the map or not
affects its symbol attribute (i.e. "LinkeRedefined" bit).

This patch adds "CanInline" bit to Symbol to aggreagate symbol
information in one place and removed the member from Config since
no one except SymbolTable now uses the table.

llvm-svn: 314088

6 years agoRemove unused member variable.
Rui Ueyama [Sun, 24 Sep 2017 23:12:36 +0000 (23:12 +0000)]
Remove unused member variable.

llvm-svn: 314087

6 years agoRefactor GdbIndexSection. NFC.
Rui Ueyama [Sun, 24 Sep 2017 21:45:35 +0000 (21:45 +0000)]
Refactor GdbIndexSection. NFC.

This patch rewrites a part of GdbIndexSection to address the following
issues in the previous implementation:

 - Previously, some struct declarations were in GdbIndex.h while they
   were not used in GdbIndex.cpp. Such structs are moved to
   SyntheticSection.h.

 - The actual implementation were split into GdbIndexSection and GdbHash
   section, but that separation didn't make much sense. They are now
   unified as GdbIndexSection.

In addition to the above changes, this patch splits functions, rename
variables and remove redundant functions/variables to generally improve
code quality.

llvm-svn: 314084

6 years ago[X86] Make IFMA instructions during isel so we can fold broadcast loads.
Craig Topper [Sun, 24 Sep 2017 19:30:55 +0000 (19:30 +0000)]
[X86] Make IFMA instructions during isel so we can fold broadcast loads.

This required changing the ISD opcode for these instructions to have the commutable operands first and the addend last. This way tablegen can autogenerate the additional patterns for us.

llvm-svn: 314083

6 years ago[X86] Add tests to show missed opportunities to fold broadcast loads into IFMA instru...
Craig Topper [Sun, 24 Sep 2017 19:30:54 +0000 (19:30 +0000)]
[X86] Add tests to show missed opportunities to fold broadcast loads into IFMA instructions when the load is on operand1 of the instrinsic.

We need to enable commuting during isel to catch this since the load folding tables can't handle broadcasts.

llvm-svn: 314082

6 years ago[Polly] Information about generalized matrix multiplication
Roman Gareev [Sun, 24 Sep 2017 19:00:25 +0000 (19:00 +0000)]
[Polly] Information about generalized matrix multiplication

Reviewed-by: Tobias Grosser <tobias@grosser.es>
Differential Revision: https://reviews.llvm.org/D38218

llvm-svn: 314081

6 years ago[X86] Add IFMA instructions to the load folding tables and make them commutable for...
Craig Topper [Sun, 24 Sep 2017 17:28:14 +0000 (17:28 +0000)]
[X86] Add IFMA instructions to the load folding tables and make them commutable for the multiply operands.

llvm-svn: 314080

6 years agoFix implicit-fallthrough warning by adding missing break
Simon Pilgrim [Sun, 24 Sep 2017 15:17:46 +0000 (15:17 +0000)]
Fix implicit-fallthrough warning by adding missing break

llvm-svn: 314079

6 years agoFix signed/unsigned warning
Simon Pilgrim [Sun, 24 Sep 2017 14:00:52 +0000 (14:00 +0000)]
Fix signed/unsigned warning

llvm-svn: 314078

6 years ago[X86][SSE] Add more tests for shuffle combining with extracted vector elements (PR22415)
Simon Pilgrim [Sun, 24 Sep 2017 13:45:49 +0000 (13:45 +0000)]
[X86][SSE] Add more tests for shuffle combining with extracted vector elements (PR22415)

llvm-svn: 314077

6 years ago[X86][SSE] Add support for extending bool vectors bitcasted from scalars
Simon Pilgrim [Sun, 24 Sep 2017 13:42:31 +0000 (13:42 +0000)]
[X86][SSE] Add support for extending bool vectors bitcasted from scalars

This patch acts as a reverse to combineBitcastvxi1 - bitcasting a scalar integer to a boolean vector and extending it 'in place' to the requested legal type.

Currently this doesn't handle AVX512 at all - but the current mask register approach is lacking for some cases.

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

llvm-svn: 314076

6 years ago[ScopDetect/Info] Look through PHIs that follow an error block
Tobias Grosser [Sun, 24 Sep 2017 09:25:30 +0000 (09:25 +0000)]
[ScopDetect/Info] Look through PHIs that follow an error block

In case a PHI node follows an error block we can assume that the incoming value
can only come from the node that is not an error block. As a result, conditions
that seemed non-affine before are now in fact affine.

This is a recommit of r312663 after fixing
test/Isl/CodeGen/phi_after_error_block_outside_of_scop.ll

llvm-svn: 314075

6 years ago[PowerPC] Eliminate compares - add i64 sext/zext handling for SETLE/SETGE
Nemanja Ivanovic [Sun, 24 Sep 2017 05:48:11 +0000 (05:48 +0000)]
[PowerPC] Eliminate compares - add i64 sext/zext handling for SETLE/SETGE

As mentioned in https://reviews.llvm.org/D33718, this simply adds another
pattern to the compare elimination sequence and is committed without a
differential review.

llvm-svn: 314073

6 years ago[AVX-512] Add pattern for selecting masked version of v8i32/v8f32 compare instruction...
Craig Topper [Sun, 24 Sep 2017 05:24:52 +0000 (05:24 +0000)]
[AVX-512] Add pattern for selecting masked version of v8i32/v8f32 compare instructions when VLX isn't available.

We use a v16i32/v16f32 compare instead and truncate the result. We already did this for the unmasked version, but were missing the version with 'and'.

llvm-svn: 314072

6 years ago[X86] Make sure we still mark the full register as implicitly defined when we shrink...
Craig Topper [Sun, 24 Sep 2017 05:24:51 +0000 (05:24 +0000)]
[X86] Make sure we still mark the full register as implicitly defined when we shrink 256/512 bit zeroing xors to 128-bit.

Not sure if anything really cares, but this seems like the right thing to do.

llvm-svn: 314071

6 years ago[AVR] Implement getCmpLibcallReturnType().
Dylan McKay [Sun, 24 Sep 2017 01:07:26 +0000 (01:07 +0000)]
[AVR] Implement getCmpLibcallReturnType().

This fixes the avr-rust issue (#75) with floating-point comparisons generating broken code.
By default, LLVM assumes these comparisons return 32-bit values, but ours are 8-bit.

Patch By Thomas Backman.

llvm-svn: 314070

6 years ago[Verifier] Stop accepting broken DIGlobalVariable(s).
Davide Italiano [Sun, 24 Sep 2017 01:06:35 +0000 (01:06 +0000)]
[Verifier] Stop accepting broken DIGlobalVariable(s).

The code wasn't yelling at the user when there's a reference
from a DIGlobalVariableExpression. Thanks to Adrian for the
reduced testcase. Fixes PR34672.

llvm-svn: 314069

6 years ago[X86] Regenerate i64 to v2f32 bitcast test
Simon Pilgrim [Sat, 23 Sep 2017 19:18:29 +0000 (19:18 +0000)]
[X86] Regenerate i64 to v2f32 bitcast test

llvm-svn: 314068

6 years agoDon't warn about runtime behavior problems in variable initializers that we
Richard Smith [Sat, 23 Sep 2017 18:27:11 +0000 (18:27 +0000)]
Don't warn about runtime behavior problems in variable initializers that we
know are going to be constant-evaluated.

Any relevant diagnostics should be produced by constant expression evaluation.

llvm-svn: 314067

6 years agoSilence unused variable warning in Release builds.
Benjamin Kramer [Sat, 23 Sep 2017 16:08:48 +0000 (16:08 +0000)]
Silence unused variable warning in Release builds.

llvm-svn: 314066

6 years ago[IslExprBuilder] Do not generate RTC with more than 64 bit
Tobias Grosser [Sat, 23 Sep 2017 15:32:07 +0000 (15:32 +0000)]
[IslExprBuilder] Do not generate RTC with more than 64 bit

Such RTCs may introduce integer wrapping intrinsics with more than 64 bit,
which are translated to library calls on AOSP that are not part of the
runtime and will consequently cause linker errors.

Thanks to Eli Friedman for reporting this issue and reducing the test case.

llvm-svn: 314065

6 years ago[x86] reduce 64-bit mask constant to 32-bits by right shifting
Sanjay Patel [Sat, 23 Sep 2017 14:32:07 +0000 (14:32 +0000)]
[x86] reduce 64-bit mask constant to 32-bits by right shifting

This is a follow-up from D38181 (r314023). We have to put 64-bit
constants into a register using a separate instruction, so we
should try harder to avoid that.

From what I see, we're not likely to encounter this pattern in the
DAG because the upstream setcc combines from this don't (usually?)
produce this pattern. If we fix that, then this will become more
relevant. Since the cost of handling this case is just loosening
the predicate of the existing fold, we might as well do it now.

llvm-svn: 314064

6 years ago[x86] add an add+shift test for follow-up suggestion from D38181; NFC
Sanjay Patel [Sat, 23 Sep 2017 14:24:07 +0000 (14:24 +0000)]
[x86] add an add+shift test for follow-up suggestion from D38181; NFC

llvm-svn: 314063

6 years ago[PowerPC] Eliminate compares - add i32 sext/zext handling for SETULT/SETUGT
Nemanja Ivanovic [Sat, 23 Sep 2017 12:53:03 +0000 (12:53 +0000)]
[PowerPC] Eliminate compares - add i32 sext/zext handling for SETULT/SETUGT

As mentioned in https://reviews.llvm.org/D33718, this simply adds another
pattern to the compare elimination sequence and is committed without a
differential revision.

llvm-svn: 314062

6 years ago[docs] Fix typos in Clang's User's Manual.
Reka Kovacs [Sat, 23 Sep 2017 12:13:32 +0000 (12:13 +0000)]
[docs] Fix typos in Clang's User's Manual.

llvm-svn: 314061

6 years ago[PowerPC] Eliminate compares - add i32 sext/zext handling for SETULE/SETUGE
Nemanja Ivanovic [Sat, 23 Sep 2017 09:50:12 +0000 (09:50 +0000)]
[PowerPC] Eliminate compares - add i32 sext/zext handling for SETULE/SETUGE

As mentioned in https://reviews.llvm.org/D33718, this simply adds another
pattern to the compare elimination sequence and is committed without a
differential revision.

llvm-svn: 314060

6 years ago[X86] Move the getInsertVINSERTImmediate and getExtractVEXTRACTImmediate helper funct...
Craig Topper [Sat, 23 Sep 2017 05:34:07 +0000 (05:34 +0000)]
[X86] Move the getInsertVINSERTImmediate and getExtractVEXTRACTImmediate helper functions over to X86ISelDAGToDAG.cpp

Redefine them to call getI8Imm and return that directly.

llvm-svn: 314059

6 years ago[X86] Remove is the isVINSERT*Index/isVEXTRACT*Index predicates from isel.
Craig Topper [Sat, 23 Sep 2017 05:34:06 +0000 (05:34 +0000)]
[X86] Remove is the isVINSERT*Index/isVEXTRACT*Index predicates from isel.

The only insert_subvector/extract_subvector nodes that make it to isel are guaranteed to match.

llvm-svn: 314058

6 years ago[ubsan] Fix assert.cc test by compiling it as C++
Vitaly Buka [Sat, 23 Sep 2017 05:09:45 +0000 (05:09 +0000)]
[ubsan] Fix assert.cc test by compiling it as C++

llvm-svn: 314057

6 years agoPromote storage-only __fp16 vector operands to float vectors.
Akira Hatanaka [Sat, 23 Sep 2017 05:02:02 +0000 (05:02 +0000)]
Promote storage-only __fp16 vector operands to float vectors.

This commit fixes a bug in the handling of storage-only __fp16 vectors
where clang didn't promote __fp16 vector operands to float vectors.

Conceptually, it performs the following transformation on the AST in
CreateBuiltinBinOp and CreateBuiltinUnaryOp:

(Before)
  typedef __fp16 half4 __attribute__ ((vector_size (8)));
  typedef float float4 __attribute__ ((vector_size (16)));
  half4 hv0, hv1, hv2, hv3;

  hv0 = hv1 + hv2 + hv3;

(After)
  float4 t0 = (float4)hv1 + (float4)hv2;
  float4 t1 = t0 + (float4)hv3;
  hv0 = (half4)t1;

Note that this commit fixes the bug for targets that set
HalfArgsAndReturns to true (ARM and ARM64). Targets using intrinsics
such as llvm.convert.to.fp16 to handle __fp16 are still broken.

rdar://problem/20625184

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

llvm-svn: 314056

6 years ago[PowerPC] Eliminate compares - add i32 sext/zext handling for SETLT/SETGT
Nemanja Ivanovic [Sat, 23 Sep 2017 04:41:34 +0000 (04:41 +0000)]
[PowerPC] Eliminate compares - add i32 sext/zext handling for SETLT/SETGT

As mentioned in https://reviews.llvm.org/D33718, this simply adds another
pattern to the compare elimination sequence and is committed without a
differential revision.

llvm-svn: 314055

6 years agoCorrectly compute linkage for members of internal linkage classes.
Richard Smith [Sat, 23 Sep 2017 04:02:17 +0000 (04:02 +0000)]
Correctly compute linkage for members of internal linkage classes.

We used to give such members no linkage instead of giving them the linkage of
the class.

llvm-svn: 314054

6 years ago[ubsan] Replace CommonSanitizerReportMutex with ScopedErrorReportLock
Vitaly Buka [Sat, 23 Sep 2017 02:47:21 +0000 (02:47 +0000)]
[ubsan] Replace CommonSanitizerReportMutex with ScopedErrorReportLock

Reviewers: eugenis, alekseyshl

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 314053

6 years ago[ubsan] Support signal specific options in ubsan
Vitaly Buka [Sat, 23 Sep 2017 02:47:11 +0000 (02:47 +0000)]
[ubsan] Support signal specific options in ubsan

Summary:
Part of https://github.com/google/sanitizers/issues/637

Standalone ubsan needs signal and sigaction handlers and interceptors.
Plugin mode should rely on parent tool.

Reviewers: eugenis, alekseyshl

Subscribers: kubamracek, llvm-commits, mgorny

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

llvm-svn: 314052

6 years agoCommit missing fixes for tool_file_rename
Reid Kleckner [Sat, 23 Sep 2017 01:04:42 +0000 (01:04 +0000)]
Commit missing fixes for tool_file_rename

llvm-svn: 314051

6 years ago[Support] Rename tool_output_file to ToolOutputFile, NFC
Reid Kleckner [Sat, 23 Sep 2017 01:03:17 +0000 (01:03 +0000)]
[Support] Rename tool_output_file to ToolOutputFile, NFC

This class isn't similar to anything from the STL, so it shouldn't use
the STL naming conventions.

llvm-svn: 314050

6 years ago[CodeGen] Fix build bots which uses old Clang broken in r314046. (NFC)
Eugene Zelenko [Fri, 22 Sep 2017 23:55:32 +0000 (23:55 +0000)]
[CodeGen] Fix build bots which uses old Clang broken in r314046. (NFC)

llvm-svn: 314049

6 years ago[lsan] Add __lsan_default_options
Vitaly Buka [Fri, 22 Sep 2017 23:49:49 +0000 (23:49 +0000)]
[lsan] Add __lsan_default_options

For consistency with asan, msan, tsan and ubsan.

llvm-svn: 314048

6 years agoFix up clang-tidy after clang r314037.
Richard Smith [Fri, 22 Sep 2017 23:47:20 +0000 (23:47 +0000)]
Fix up clang-tidy after clang r314037.

llvm-svn: 314047

6 years ago[CodeGen] Fix some Clang-tidy modernize-use-default-member-init and Include What...
Eugene Zelenko [Fri, 22 Sep 2017 23:46:57 +0000 (23:46 +0000)]
[CodeGen] Fix some Clang-tidy modernize-use-default-member-init and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 314046

6 years agoImplement trampoline step-through for Windows-x86.
Stephane Sezer [Fri, 22 Sep 2017 23:41:41 +0000 (23:41 +0000)]
Implement trampoline step-through for Windows-x86.

Summary:
This is required to be able to step through calls to external functions
that are not properly marked with __declspec(dllimport). When a call
like this is emitted, the linker will inject a trampoline to produce an
indirect call through the IAT.

Reviewers: zturner, jingham

Reviewed By: jingham

Subscribers: sas, jingham, lldb-commits

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

llvm-svn: 314045

6 years ago[X86] [MC] fixed non optimal encoding of instruction memory operand (PR24038).
Konstantin Belochapka [Fri, 22 Sep 2017 23:37:48 +0000 (23:37 +0000)]
[X86] [MC] fixed non optimal encoding of instruction memory operand (PR24038).
Fixed suboptimal encoding of instruction memory operand when assembler is used to select 32 bit fixup rather than 8 bit immediate for encoding memory offset value.
Differential Revision: https://reviews.llvm.org/D38117

llvm-svn: 314044

6 years agoFix uninteneded fallthrough detected by GCC warning
Reid Kleckner [Fri, 22 Sep 2017 23:19:52 +0000 (23:19 +0000)]
Fix uninteneded fallthrough detected by GCC warning

llvm-svn: 314043

6 years ago[Analyzer] Fix minor errors in python scripts.
George Karpenkov [Fri, 22 Sep 2017 22:58:46 +0000 (22:58 +0000)]
[Analyzer] Fix minor errors in python scripts.

llvm-svn: 314042

6 years ago[lsan] Deadly signal handler for lsan
Vitaly Buka [Fri, 22 Sep 2017 22:57:48 +0000 (22:57 +0000)]
[lsan] Deadly signal handler for lsan

Summary: Part of https://github.com/google/sanitizers/issues/637

Reviewers: eugenis, alekseyshl

Subscribers: llvm-commits, dberris, kubamracek, krytarowski

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

llvm-svn: 314041

6 years ago[sanitizer] Replace thread id with GetThreadSelf
Vitaly Buka [Fri, 22 Sep 2017 22:36:21 +0000 (22:36 +0000)]
[sanitizer] Replace thread id with GetThreadSelf

This allows to avoid constructor parameter

llvm-svn: 314040

6 years ago[sanitizer] Move ScopedErrorReportLock into libcdep version
Vitaly Buka [Fri, 22 Sep 2017 22:36:11 +0000 (22:36 +0000)]
[sanitizer] Move ScopedErrorReportLock into libcdep version

llvm-svn: 314039

6 years agoInitial patchset to get the testsuite running against armv7 and arm64 iOS devices.
Jason Molenda [Fri, 22 Sep 2017 22:34:53 +0000 (22:34 +0000)]
Initial patchset to get the testsuite running against armv7 and arm64 iOS devices.
Normal customer devices won't be able to run these devices, we're hoping to get
a public facing bot set up at some point.  Both devices pass the testsuite without
any errors or failures.

I have seen some instability with the armv7 test runs, I may submit additional patches
to address this.  arm64 looks good.

I'll be watching the bots for the rest of today; if any problems are introduced by
this patch I'll revert it - if anyone sees a problem with their bot that I don't
see, please do the same.  I know it's a rather large patch.

One change I had to make specifically for iOS devices was that debugserver can't
create files.  There were several tests that launch the inferior process redirecting
its output to a file, then they retrieve the file.  They were not trying to test
file redirection in these tests, so I rewrote those to write their output to a file
directly.

llvm-svn: 314038

6 years agoDR1113: anonymous namespaces formally give their contents internal linkage.
Richard Smith [Fri, 22 Sep 2017 22:21:44 +0000 (22:21 +0000)]
DR1113: anonymous namespaces formally give their contents internal linkage.

This doesn't affect our code generation in any material way -- we already give
such declarations internal linkage from a codegen perspective -- but it has
some subtle effects on code validity.

We suppress the 'L' (internal linkage) marker for mangled names in anonymous
namespaces, because it is redundant (the information is already carried by the
namespace); this deviates from GCC's behavior if a variable or function in an
anonymous namespace is redundantly declared 'static' (where GCC does include
the 'L'), but GCC's behavior is incoherent because such a declaration can be
validly declared with or without the 'static'.

We still deviate from the standard in one regard here: extern "C" declarations
in anonymous namespaces are still granted external linkage. Changing those does
not appear to have been an intentional consequence of the standard change in
DR1113.

llvm-svn: 314037

6 years ago[test] Enable clang-func-mapping as a test dep with the analyzer
Vedant Kumar [Fri, 22 Sep 2017 22:17:10 +0000 (22:17 +0000)]
[test] Enable clang-func-mapping as a test dep with the analyzer

clang-func-mapping should not be a test dependency when the static
analyzer isn't being built.

llvm-svn: 314036

6 years agoFix unused variable warning in non-debug builds.
Richard Trieu [Fri, 22 Sep 2017 22:16:13 +0000 (22:16 +0000)]
Fix unused variable warning in non-debug builds.

llvm-svn: 314035

6 years agoclang-format plugin: Add missing NL (new line) at EOF (end of file)
Hans Wennborg [Fri, 22 Sep 2017 21:47:39 +0000 (21:47 +0000)]
clang-format plugin: Add missing NL (new line) at EOF (end of file)

clang-format.exe removes trailing new lines at end of file.

However, if no NL is found at EOF one should be added.

Patch by Teodor MICU!

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

llvm-svn: 314033