platform/upstream/llvm.git
7 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

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

llvm-svn: 314115

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 years ago[InstCombine] Teach foldICmpUsingKnownBits to simplify SLE/SGE/ULE/UGE to equality...
Craig Topper [Fri, 22 Sep 2017 21:47:22 +0000 (21:47 +0000)]
[InstCombine] Teach foldICmpUsingKnownBits to simplify SLE/SGE/ULE/UGE to equality comparisons when the min/max ranges intersect in a single value.

This is the inverse of what we do for SGT/SLT/UGT/ULT.

llvm-svn: 314032

7 years ago[InstCombine] Add test cases for known bits simplifications for comparisons that...
Craig Topper [Fri, 22 Sep 2017 21:47:21 +0000 (21:47 +0000)]
[InstCombine] Add test cases for known bits simplifications for comparisons that don't depend on constant RHS. NFC

This shows some missing simplifications for sge/sle/uge/ule relative to their non-equality counterparts.

llvm-svn: 314031

7 years ago[InstCombine] Remove a FIXME from a test that was fixed in r314025.
Craig Topper [Fri, 22 Sep 2017 21:47:20 +0000 (21:47 +0000)]
[InstCombine] Remove a FIXME from a test that was fixed in r314025.

llvm-svn: 314030

7 years ago[CodeGen][ObjC] Build the global block structure before emitting the
Akira Hatanaka [Fri, 22 Sep 2017 21:32:06 +0000 (21:32 +0000)]
[CodeGen][ObjC] Build the global block structure before emitting the
body of global block invoke functions.

This commit fixes an infinite loop in IRGen that occurs when compiling
the following code:

void FUNC2() {
  static void (^const block1)(int) = ^(int a){
    if (a--)
      block1(a);
  };
}

This is how IRGen gets stuck in the infinite loop:

1. GenerateBlockFunction is called to emit the body of "block1".

2. GetAddrOfGlobalBlock is called to get the address of "block1". The
   function calls getAddrOfGlobalBlockIfEmitted to check whether the
   global block has been emitted. If it hasn't been emitted, it then
   tries to emit the body of the block function by calling
   GenerateBlockFunction, which goes back to step 1.

This commit prevents the inifinite loop by building the global block in
GenerateBlockFunction before emitting the body of the block function.

rdar://problem/34541684

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

llvm-svn: 314029

7 years agoFixed broken links in docs.
Ilya Biryukov [Fri, 22 Sep 2017 21:10:37 +0000 (21:10 +0000)]
Fixed broken links in docs.

Replaced references to `llvm.org/klaus` with `git.llvm.org/klaus`.

llvm-svn: 314028

7 years ago[x86] remove over-specified platform from test config
Sanjay Patel [Fri, 22 Sep 2017 21:07:13 +0000 (21:07 +0000)]
[x86] remove over-specified platform from test config

llvm-svn: 314027

7 years ago[PowerPC] Mark P9 scheduling model complete
Stefan Pintilie [Fri, 22 Sep 2017 20:17:25 +0000 (20:17 +0000)]
[PowerPC] Mark P9 scheduling model complete

This patch just adds the missing information to the P9 scheduling model to allow
the model to be marked as complete.

The model has been verified against P9 documentation. The model was verified
with utils/schedcover.py.

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

llvm-svn: 314026

7 years ago[InstCombine] Add constant splat handling to one of the ICMP_SLT/SGT cases in foldICm...
Craig Topper [Fri, 22 Sep 2017 19:54:15 +0000 (19:54 +0000)]
[InstCombine] Add constant splat handling to one of the ICMP_SLT/SGT cases in foldICmpUsingKnownBits.

llvm-svn: 314025

7 years ago[x86] shiftRightAlgebraic -> shiftRightArithmetic; NFC
Sanjay Patel [Fri, 22 Sep 2017 19:49:37 +0000 (19:49 +0000)]
[x86] shiftRightAlgebraic -> shiftRightArithmetic; NFC

x86 re-education camp is in session. The LLVM LangRef agrees with x86 too.
The DAG nodes are undocumented and ambiguous as always. :)

llvm-svn: 314024

7 years ago[x86] swap order of srl (and X, C1), C2 when it saves size
Sanjay Patel [Fri, 22 Sep 2017 19:37:21 +0000 (19:37 +0000)]
[x86] swap order of srl (and X, C1), C2 when it saves size

The (non-)obvious win comes from saving 3 bytes by using the 0x83 'and' opcode variant instead of 0x81.
There are also better improvements based on known-bits that allow us to eliminate the mask entirely.

As noted, this could be extended. There are potentially other wins from always shifting first, but doing
that reveals a tangle of problems in other pattern matching. We do this transform generically in
instcombine, but we often have icmp IR that doesn't match that pattern, so we must account for this
in the backend.

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

llvm-svn: 314023

7 years ago[clang] Fix isExternC matcher docs
Alexander Shaposhnikov [Fri, 22 Sep 2017 19:29:38 +0000 (19:29 +0000)]
[clang] Fix isExternC matcher docs

The wording in the documentation for the matcher isExternC
appears to be misleading since this matcher
is applicable to functions and variables as well.
This diff changes the comment and regenerates the html file.

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

llvm-svn: 314022

7 years agoFix fuchsia builds broken by r313999
Francis Ricci [Fri, 22 Sep 2017 19:22:08 +0000 (19:22 +0000)]
Fix fuchsia builds broken by r313999

llvm-svn: 314021

7 years ago[clangd] Updated gold for completion tests after cfe changes.
Ilya Biryukov [Fri, 22 Sep 2017 19:07:45 +0000 (19:07 +0000)]
[clangd] Updated gold for completion tests after cfe changes.

llvm-svn: 314020

7 years agoSet completion priority of destructors and operators to CCP_Unlikely.
Ilya Biryukov [Fri, 22 Sep 2017 19:07:37 +0000 (19:07 +0000)]
Set completion priority of destructors and operators to CCP_Unlikely.

Summary:
It will move destructors and operators to the end of completion list.
Destructors and operators are currently very high on the completion
list, as they have the same priority as member functions. However,
they are clearly not something users usually choose in completion
lists.

Reviewers: arphaman, erikjv, bkramer, krasimir

Reviewed By: arphaman

Subscribers: eraman, klimek, cfe-commits

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

llvm-svn: 314019

7 years ago[InstCombine] Move the call to isSignBitCheck into getDemandedBitsLHSMask instead...
Craig Topper [Fri, 22 Sep 2017 18:57:23 +0000 (18:57 +0000)]
[InstCombine] Move the call to isSignBitCheck into getDemandedBitsLHSMask instead of calling it outside and passing its result through a flag. NFCI

The result of the isSignBitCheck isn't used anywhere else and this allows us to share the m_APInt call in the likely case that it isn't a sign bit check.

llvm-svn: 314018

7 years ago[InstCombine] Simplify check for RHS being a splat constant in foldICmpUsingKnownBits...
Craig Topper [Fri, 22 Sep 2017 18:57:22 +0000 (18:57 +0000)]
[InstCombine] Simplify check for RHS being a splat constant in foldICmpUsingKnownBits by just checking Op1Min==Op1Max rather than going through m_APInt.

llvm-svn: 314017

7 years ago[InstCombine] Make cases for ICMP_UGT/ICMP_ULT use similar formatting since they...
Craig Topper [Fri, 22 Sep 2017 18:57:20 +0000 (18:57 +0000)]
[InstCombine] Make cases for ICMP_UGT/ICMP_ULT use similar formatting since they use similar code. NFC

llvm-svn: 314016

7 years ago[sanitizer] Replace AddressSanitizer with correct tool name
Vitaly Buka [Fri, 22 Sep 2017 18:50:18 +0000 (18:50 +0000)]
[sanitizer] Replace AddressSanitizer with correct tool name

llvm-svn: 314015

7 years agoDeflake the "xpc-race.mm" test.
Kuba Mracek [Fri, 22 Sep 2017 18:49:56 +0000 (18:49 +0000)]
Deflake the "xpc-race.mm" test.

llvm-svn: 314014

7 years ago[lit.cfg] Avoid concatenating which(clang-func-mapping) if it's missing
Vedant Kumar [Fri, 22 Sep 2017 18:42:28 +0000 (18:42 +0000)]
[lit.cfg] Avoid concatenating which(clang-func-mapping) if it's missing

This un-breaks a lit workflow where you run lit tests from a test
sub-directory within clang without first building clang-func-mapping.

llvm-svn: 314013

7 years agoMove code to a helper function. NFC.
Rafael Espindola [Fri, 22 Sep 2017 18:40:14 +0000 (18:40 +0000)]
Move code to a helper function. NFC.

Part of a patch by Jake Ehrlich!

llvm-svn: 314012