platform/upstream/llvm.git
6 years agoMove buildConditionSet to C++
Tobias Grosser [Mon, 18 Jun 2018 12:35:36 +0000 (12:35 +0000)]
Move buildConditionSet to C++

llvm-svn: 334937

6 years agoUpdate copyright year to 2018.
Paul Robinson [Mon, 18 Jun 2018 12:22:17 +0000 (12:22 +0000)]
Update copyright year to 2018.

llvm-svn: 334936

6 years ago[analyzer] Checker for uninitialized C++ objects
Kristof Umann [Mon, 18 Jun 2018 11:50:17 +0000 (11:50 +0000)]
[analyzer] Checker for uninitialized C++ objects

This checker analyzes C++ constructor calls, and reports uninitialized fields.

Due to the nature of this problem (uninitialized fields after an object
construction), this checker doesn't search for bugs, but rather is a tool to
enforce a specific programming model where every field needs to be initialized.

This checker lands in alpha for now, and a number of followup patches will be
made to reduce false negatives and to make it easier for the user to understand
what rules the checker relies on, eg. whether a derived class' constructor is
responsible for initializing inherited data members or whether it should be
handled in the base class' constructor.

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

llvm-svn: 334935

6 years ago[SLPVectorizer] Avoid calling const VL.size() repeatedly in for-loop. NFCI.
Simon Pilgrim [Mon, 18 Jun 2018 11:35:36 +0000 (11:35 +0000)]
[SLPVectorizer] Avoid calling const VL.size() repeatedly in for-loop. NFCI.

llvm-svn: 334934

6 years ago[VPlanRecipeBase] Add insertBefore helper.
Florian Hahn [Mon, 18 Jun 2018 11:34:17 +0000 (11:34 +0000)]
[VPlanRecipeBase] Add insertBefore helper.

Reviewers: dcaballe, mkuper, hfinkel, hsaito, mssimpso

Reviewed By: dcaballe

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

llvm-svn: 334933

6 years ago[llvm-exegesis] Optionally ignore instructions without a sched class.
Clement Courbet [Mon, 18 Jun 2018 11:27:47 +0000 (11:27 +0000)]
[llvm-exegesis] Optionally ignore instructions without a sched class.

Summary: See PR37602.

Reviewers: RKSimon

Subscribers: llvm-commits, tschuett

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

llvm-svn: 334932

6 years ago[AArch64][SVE] Asm: Support for vector element compares.
Sander de Smalen [Mon, 18 Jun 2018 10:59:19 +0000 (10:59 +0000)]
[AArch64][SVE] Asm: Support for vector element compares.

This patch adds instructions for comparing elements from two vectors, e.g.
  cmpgt p0.s, p0/z, z0.s, z1.s

and also adds support for comparing to a 64-bit wide element vector, e.g.
  cmpgt p0.s, p0/z, z0.s, z1.d

The patch also contains aliases for certain comparisons, e.g.:
  cmple p0.s, p0/z, z0.s, z1.s => cmpge p0.s, p0/z, z1.s, z0.s
  cmplo p0.s, p0/z, z0.s, z1.s => cmphi p0.s, p0/z, z1.s, z0.s
  cmpls p0.s, p0/z, z0.s, z1.s => cmphs p0.s, p0/z, z1.s, z0.s
  cmplt p0.s, p0/z, z0.s, z1.s => cmpgt p0.s, p0/z, z1.s, z0.s

llvm-svn: 334931

6 years ago[ASTMatchers] Add support for matching the type of a friend decl.
David L. Jones [Mon, 18 Jun 2018 09:23:08 +0000 (09:23 +0000)]
[ASTMatchers] Add support for matching the type of a friend decl.

This allows matchers like:

  friendDecl(hasType(cxxRecordDecl(...)))
  friendDecl(hasType(asString(...)))

It seems that hasType is probably the most reasonable narrowing matcher to
overload, since it is already used to narrow to other declaration kinds.

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

Reviewers: klimek, aaron.ballman

Subscribers: cfe-commits
llvm-svn: 334930

6 years ago[ASTMatchers] Don't assert-fail in specifiesTypeLoc().
David L. Jones [Mon, 18 Jun 2018 08:59:16 +0000 (08:59 +0000)]
[ASTMatchers] Don't assert-fail in specifiesTypeLoc().

The specifiesTypeLoc() matcher narrows a nestedNameSpecifier matcher based on a
typeloc within the NNS. However, the matcher does not guard against NNS which
are a namespace, and cause getTypeLoc to assert-fail.

llvm-svn: 334929

6 years ago[Fuzzer] Set an explicit libc++ dependency when needed
Petr Hosek [Mon, 18 Jun 2018 08:01:57 +0000 (08:01 +0000)]
[Fuzzer] Set an explicit libc++ dependency when needed

On targets that don't link internal libc++ (Fuchsia and Linux) but
use libc++ as their C++ library and libFuzzer is being built using
the just built compiler together with libc++ as part of runtimes, we
need an explicit dependency from libFuzzer object library to libc++ to
make sure the headers are available by the time we start building
libFuzzer.

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

llvm-svn: 334928

6 years ago[X86] Fix NOOP sched overrides on BDW/HSW/SKL.
Clement Courbet [Mon, 18 Jun 2018 06:48:22 +0000 (06:48 +0000)]
[X86] Fix NOOP sched overrides on BDW/HSW/SKL.

Summary: Noop certainly does not use resources.

Reviewers: RKSimon, craig.topper, andreadb

Subscribers: gbedwell, llvm-commits, gchatelet

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

llvm-svn: 334927

6 years agoFix libcxxabi tests after clang r334924
Vitaly Buka [Mon, 18 Jun 2018 06:43:55 +0000 (06:43 +0000)]
Fix libcxxabi tests after clang r334924

llvm-svn: 334926

6 years ago[X86] Create X86InstrFMA3Group objects fully in a static table instead of on the...
Craig Topper [Mon, 18 Jun 2018 06:32:22 +0000 (06:32 +0000)]
[X86] Create X86InstrFMA3Group objects fully in a static table instead of on the heap. NFCI

Previously we heap allocated the X86InstrFMA3Group objects which were created by passing them small register/memory opcode arrays that existed as individual static tables.

Rather than a bunch of small static arrays we now have one large static table of X86InstrFMA3Group objects. Rather than storing a pointer to the opcode arrays in the X86InstrFMA3Group object, we now store have a register and memory array as part of the object. If a group doesn't have memory or register opcodes, the array entries will be 0.

This greatly simplifies the destruction of the X86InstrFMA3Info object. We no longer need to delete the X86InstrFMA3Group objects as we destruct the DenseMap. And we don't need to keep track of which ones we already deleted.

This reduces the llc binary size on my local machine by ~50k. I can only assume that's really due to the fact that we had something like 512 small static arrays that we passed to the init functions either one at a time or in pairs. So there were between 256 and 512 distinct calls to the init functions in the initOnceImpl method.

llvm-svn: 334925

6 years agoFix libcxx tests after clang r334677.
Vitaly Buka [Mon, 18 Jun 2018 06:24:29 +0000 (06:24 +0000)]
Fix libcxx tests after clang r334677.

llvm-svn: 334924

6 years ago[sanitizer] Suppress unused function warning
Vitaly Buka [Mon, 18 Jun 2018 05:55:44 +0000 (05:55 +0000)]
[sanitizer] Suppress unused function warning

llvm-svn: 334923

6 years ago[X86] Add '.s' aliases to the assembler for the various redundant move encodings...
Craig Topper [Mon, 18 Jun 2018 05:00:50 +0000 (05:00 +0000)]
[X86] Add '.s' aliases to the assembler for the various redundant move encodings to match gas and our EVEX instructions.

We already have these aliases for EVEX enocded instructions, but not for the GPR, MMX, SSE, and VEX versions.

Also remove the vpextrw.s EVEX alias. That's not something gas implements.

llvm-svn: 334922

6 years agoFix the 'tb' alias command
Frederic Riss [Mon, 18 Jun 2018 04:34:33 +0000 (04:34 +0000)]
Fix the 'tb' alias command

No idea when this broke or if it ever worked. Added a small test
for one-shot breakpoints while I was there.

llvm-svn: 334921

6 years ago[X86] Move the 'vmovq.s' and similar assembly strings for EVEX vector moves with...
Craig Topper [Mon, 18 Jun 2018 01:28:05 +0000 (01:28 +0000)]
[X86] Move the 'vmovq.s' and similar assembly strings for EVEX vector moves with reversed operands to InstAliases.

The .s assembly strings allow the reversed forms to be targeted from assembly which matches gas behavior. But when printing the instructions we should print them without the .s to match other tooling like objdump. By using InstAliases we can use the normal string in the instruction and just hide it from the assembly parser.

Ideally we'd add the .s versions to the legacy SSE and VEX versions as well for full compatibility with gas. Not sure how we got to state where only EVEX was supported.

llvm-svn: 334920

6 years ago[TableGen] Prevent double flattening of InstAlias asm strings in the asm matcher...
Craig Topper [Mon, 18 Jun 2018 01:28:01 +0000 (01:28 +0000)]
[TableGen] Prevent double flattening of InstAlias asm strings in the asm matcher emitter.

Unlike CodeGenInstruction, CodeGenInstAlias was flatting asm strings in its constructor. For instructions it was the users responsibility to flatten the string.

AsmMatcherEmitter didn't know this and treated them the same. This caused double flattening of InstAliases. This is mostly harmless unless the desired assembly string contains curly braces. The second flattening wouldn't know to ignore these and would remove the curly braces. And for variant 1 it would remove the contents of them as well.

To mitigate this, this patch makes removes the flattening from the CodeGenIntAlias constructor and modifies AsmWriterEmitter to account for the flattening not having been done.

llvm-svn: 334919

6 years ago[ORC] Remove redundant condition
Lang Hames [Sun, 17 Jun 2018 23:54:58 +0000 (23:54 +0000)]
[ORC] Remove redundant condition

llvm-svn: 334918

6 years agoFix libcxx tests after clang r334677.
Richard Smith [Sun, 17 Jun 2018 19:58:45 +0000 (19:58 +0000)]
Fix libcxx tests after clang r334677.

Feature test macro versions may have a trailing L.

llvm-svn: 334917

6 years ago[ORC] Only notify queries that they are resolved/ready when the query state
Lang Hames [Sun, 17 Jun 2018 18:59:01 +0000 (18:59 +0000)]
[ORC] Only notify queries that they are resolved/ready when the query state
changes.

This guards against redundant notifications.

llvm-svn: 334916

6 years ago[X86] Add all the FMA instructions direclty to the load folding table instead of...
Craig Topper [Sun, 17 Jun 2018 18:00:16 +0000 (18:00 +0000)]
[X86] Add all the FMA instructions direclty to the load folding table instead of proxying through X86InstrFMA3Info.

These increases the size of the static tables, but is closer to what we would get if used the autogenerated table directly. This reduces the remaining large deltas between what's in the manual table and what's in the autogenerated table.

llvm-svn: 334915

6 years ago[sanitizer] Fix tsan GO build
Vitaly Buka [Sun, 17 Jun 2018 17:58:08 +0000 (17:58 +0000)]
[sanitizer] Fix tsan GO build

llvm-svn: 334914

6 years ago[sanitizer] Fix s390 build after r334900
Vitaly Buka [Sun, 17 Jun 2018 17:40:38 +0000 (17:40 +0000)]
[sanitizer] Fix s390 build after r334900

llvm-svn: 334913

6 years ago[sanitizer] Use confstr to check libc version in InitTlsSize
Vitaly Buka [Sun, 17 Jun 2018 17:31:22 +0000 (17:31 +0000)]
[sanitizer] Use confstr to check libc version in InitTlsSize

Reviewers: Lekensteyn, jakubjelinek

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 334912

6 years ago[ORC] Suppress an unused variable warning for a debug-mode only use.
Lang Hames [Sun, 17 Jun 2018 17:18:12 +0000 (17:18 +0000)]
[ORC] Suppress an unused variable warning for a debug-mode only use.

llvm-svn: 334911

6 years ago[ORC] Erase empty dependence sets when adding new symbol dependencies.
Lang Hames [Sun, 17 Jun 2018 16:59:53 +0000 (16:59 +0000)]
[ORC] Erase empty dependence sets when adding new symbol dependencies.

llvm-svn: 334910

6 years ago[ORC] In MaterializationResponsibility, only maintain the Materializing flag on
Lang Hames [Sun, 17 Jun 2018 16:59:52 +0000 (16:59 +0000)]
[ORC] In MaterializationResponsibility, only maintain the Materializing flag on
symbols in debug mode.

The MaterializationResponsibility class hijacks the Materializing flag to track
symbols that have not yet been resolved in order to guard against redundant
resolution. Since this is an API contract check and only enforced in debug mode
there is no reason to maintain the flag state in release mode.

llvm-svn: 334909

6 years ago[X86] Pass the parent SDNode to X86DAGToDAGISel::selectScalarSSELoad to simplify...
Craig Topper [Sun, 17 Jun 2018 16:29:46 +0000 (16:29 +0000)]
[X86] Pass the parent SDNode to X86DAGToDAGISel::selectScalarSSELoad to simplify the hasSingleUseFromRoot handling.

Some of the calls to hasSingleUseFromRoot were passing the load itself. If the load's chain result has a user this would count against that. By getting the true parent of the match and ensuring any intermediate between the match and the load have a single use we can avoid this case. isLegalToFold will take care of checking users of the load's data output.

This fixed at least fma-scalar-memfold.ll to succed without the peephole pass.

llvm-svn: 334908

6 years ago[llvm-mca][X86] Add some avx512f/avx512vl resource test placeholders
Simon Pilgrim [Sun, 17 Jun 2018 16:25:48 +0000 (16:25 +0000)]
[llvm-mca][X86] Add some avx512f/avx512vl resource test placeholders

There are a lot of instructions to add under these ISAs (and the other AVX512 variants) but this should demonstrate how to test for the EVEX instructions with different maskings

llvm-svn: 334907

6 years ago[AArch64][SVE] Asm: Support for bitwise operations on predicate vectors.
Sander de Smalen [Sun, 17 Jun 2018 10:48:21 +0000 (10:48 +0000)]
[AArch64][SVE] Asm: Support for bitwise operations on predicate vectors.

This patch adds support for instructions performing bitwise operations
on predicate vectors, including AND, BIC, EOR, NAND, NOR, ORN, ORR, and
their status flag setting variants ANDS, BICS, EORS, NANDS, ORNS, ORRS.

This patch also adds several aliases:

  orr  p0.b, p1/z, p1.b, p1.b  => mov  p0.b, p1.b
  orrs p0.b, p1/z, p1.b, p1.b  => movs p0.b, p1.b

  and  p0.b, p1/z, p2.b, p2.b  => mov  p0.b, p1/z, p2.b
  ands p0.b, p1/z, p2.b, p2.b  => movs p0.b, p1/z, p2.b

  eor  p0.b, p1/z, p2.b, p1.b  => not  p0.b, p1/z, p2.b
  eors p0.b, p1/z, p2.b, p1.b  => nots p0.b, p1/z, p2.b

llvm-svn: 334906

6 years ago[AArch64][SVE] Asm: Support for SEL (vector/predicate) instructions.
Sander de Smalen [Sun, 17 Jun 2018 10:11:04 +0000 (10:11 +0000)]
[AArch64][SVE] Asm: Support for SEL (vector/predicate) instructions.

Support for SVE's predicated select instructions to select elements
from either vector, both in a data-vector and a predicate-vector
variant.

llvm-svn: 334905

6 years ago[NVPTX] Ignore target-cpu and -features for inlining
Jonas Hahnfeld [Sun, 17 Jun 2018 09:55:20 +0000 (09:55 +0000)]
[NVPTX] Ignore target-cpu and -features for inlining

We don't want to prevent inlining because of target-cpu and -features
attributes that were added to newer versions of LLVM/Clang: There are
no incompatible functions in PTX, ptxas will throw errors in such cases.

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

llvm-svn: 334904

6 years agoRevert "[CMake] Use a different source depending on C++ support"
Jonas Hahnfeld [Sun, 17 Jun 2018 09:51:33 +0000 (09:51 +0000)]
Revert "[CMake] Use a different source depending on C++ support"

This reverts commit r332924 and followup r332936 silencing a warning.

The change breaks the build on x86 if there is no 32-bit version of the
C++ libraries, see discussion in https://reviews.llvm.org/D47169.

llvm-svn: 334903

6 years ago[fuzzer] Python 3 print fixes
Vitaly Buka [Sun, 17 Jun 2018 09:11:56 +0000 (09:11 +0000)]
[fuzzer] Python 3 print fixes

llvm-svn: 334902

6 years ago[fuzzer] Fix collect_data_flow.py for python 3
Vitaly Buka [Sun, 17 Jun 2018 08:41:56 +0000 (08:41 +0000)]
[fuzzer] Fix collect_data_flow.py for python 3

llvm-svn: 334901

6 years ago[sanitizer] Use const char* in internal_simple_strtoll
Vitaly Buka [Sun, 17 Jun 2018 08:41:45 +0000 (08:41 +0000)]
[sanitizer] Use const char* in internal_simple_strtoll

llvm-svn: 334900

6 years ago[WebAssembly] Simple comment fix. NFC.
Heejin Ahn [Sun, 17 Jun 2018 00:37:56 +0000 (00:37 +0000)]
[WebAssembly] Simple comment fix. NFC.

llvm-svn: 334899

6 years ago[X86] More additions to the load folding tables based on the autogenerated tables.
Craig Topper [Sat, 16 Jun 2018 23:25:50 +0000 (23:25 +0000)]
[X86] More additions to the load folding tables based on the autogenerated tables.

Including more additions for NotMemoryFoldable to remove some entries from the autogenerated table.

llvm-svn: 334898

6 years ago[X86] Hide POP16/32/64rmr and PUSH16/32/64rmr instructions from the assembly parser.
Craig Topper [Sat, 16 Jun 2018 23:25:48 +0000 (23:25 +0000)]
[X86] Hide POP16/32/64rmr and PUSH16/32/64rmr instructions from the assembly parser.

These all have a short form encoding that the assembler already prefers. Though that preference seems to only be based on order in the .td fie. Hiding the long form saves space in the table and prevents us from breaking the implicit order based priority.

llvm-svn: 334897

6 years ago[X86] Fix an inconsistency between AVX512 and AVX/SSE version on a couple instructions.
Craig Topper [Sat, 16 Jun 2018 23:25:47 +0000 (23:25 +0000)]
[X86] Fix an inconsistency between AVX512 and AVX/SSE version on a couple instructions.

VMOVPQIto64Zmr is not a 64-bit mode only instruction. But I don't know how to test this because VMOVPQIto64mr should always have priority over it in 32-bit mode since its only advantage is XMM16-XMM31 which aren't usable in 32-bit mode.

VMOVPQIto64Zrr is a 64-bit mode only instruction, but we don't need to explicitly mark it as such because it uses a GR64 register which won't parse in 32-bit mode.

llvm-svn: 334896

6 years agoCorrelatedValuePropagation: Preserve DT.
Michael Zolotukhin [Sat, 16 Jun 2018 18:57:31 +0000 (18:57 +0000)]
CorrelatedValuePropagation: Preserve DT.

Summary:
We only modify CFG in a couple of places, and we can preserve DT there
with a little effort.

Reviewers: davide, vsk

Subscribers: hiraditya, llvm-commits

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

llvm-svn: 334895

6 years agoRemove P0771, which was not passed in Rapperswil
Marshall Clow [Sat, 16 Jun 2018 18:03:29 +0000 (18:03 +0000)]
Remove P0771, which was not passed in Rapperswil

llvm-svn: 334894

6 years agoAdjust to recent LLVM changes to fix buildbots
Tobias Grosser [Sat, 16 Jun 2018 17:38:19 +0000 (17:38 +0000)]
Adjust to recent LLVM changes to fix buildbots

llvm-svn: 334893

6 years ago[Dominators] Change getNode parameter type to const NodeT * (NFC).
Florian Hahn [Sat, 16 Jun 2018 14:47:05 +0000 (14:47 +0000)]
[Dominators] Change getNode parameter type to const NodeT * (NFC).

DominatorTreeBase::getNode does not modify its parameter and this change
allows callers that only have access to const pointers to use it without
casting.

Reviewers: kuhar, dblaikie, chandlerc

Reviewed By: dblaikie

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

llvm-svn: 334892

6 years ago[analyzer] Add method to the generic SMT API to dump the SMT formula
Mikhail R. Gadelha [Sat, 16 Jun 2018 14:36:17 +0000 (14:36 +0000)]
[analyzer] Add method to the generic SMT API to dump the SMT formula

Summary:
New method dump the SMT formula and the Z3 implementation.

There is no test because I only used it for debugging.

However, if requested, I can add an option to the static analyzer to dump the formula (whole program? per path?), maybe something like the trimmed graph but for SMT formulas.

Reviewers: NoQ, george.karpenkov, ddcc

Reviewed By: george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin

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

llvm-svn: 334891

6 years agoFix namespaces. No functionality change.
Benjamin Kramer [Sat, 16 Jun 2018 13:37:52 +0000 (13:37 +0000)]
Fix namespaces. No functionality change.

llvm-svn: 334890

6 years agoRevert r334887, as GCC 4.8 does not have is_trivially_copy_constructible & co
Florian Hahn [Sat, 16 Jun 2018 13:00:33 +0000 (13:00 +0000)]
Revert r334887, as GCC 4.8 does not have is_trivially_copy_constructible & co

llvm-svn: 334889

6 years ago [SmallSet] Avoid using is_trivially_XXX<>::value which is C++17
Florian Hahn [Sat, 16 Jun 2018 12:50:32 +0000 (12:50 +0000)]
 [SmallSet] Avoid using is_trivially_XXX<>::value which is C++17

llvm-svn: 334888

6 years ago[SmallSet] Add SmallSetIterator.
Florian Hahn [Sat, 16 Jun 2018 12:36:19 +0000 (12:36 +0000)]
[SmallSet] Add SmallSetIterator.

This patch adds a simple const_iterator implementation for SmallSet by
delegating to either a SmallVector::const_iterator or
std::set::const_iterator, depending on which storage is used by the
SmallSet.

Reviewers: dblaikie, craig.topper

Reviewed By: dblaikie

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

llvm-svn: 334887

6 years agoAdd RUN line for amdgcn to lit test conditional-temporaries.cpp
Yaxun Liu [Sat, 16 Jun 2018 12:28:51 +0000 (12:28 +0000)]
Add RUN line for amdgcn to lit test conditional-temporaries.cpp

This is partial re-commit of r332982.

llvm-svn: 334886

6 years ago[ELF] Pass callables by function_ref
Benjamin Kramer [Sat, 16 Jun 2018 12:11:34 +0000 (12:11 +0000)]
[ELF] Pass callables by function_ref

No need to create a heavyweight std::function if it's not stored. No
functionality change intended.

llvm-svn: 334885

6 years ago[sanitizer_common] Fix windows build caused by r334881
Fangrui Song [Sat, 16 Jun 2018 05:05:19 +0000 (05:05 +0000)]
[sanitizer_common] Fix windows build caused by r334881

llvm-svn: 334884

6 years ago[asan] Enable fgets_fputs test on Android
Vitaly Buka [Sat, 16 Jun 2018 04:01:08 +0000 (04:01 +0000)]
[asan] Enable fgets_fputs test on Android

"echo data" didn't work because %run on android executes test on the device
when lit shell command on the host system.

https://github.com/google/sanitizers/issues/952

llvm-svn: 334883

6 years ago[AMDGPU] setcc (select cc, CT, CF), CF, eq | ne -> xor cc, -1 | cc
Stanislav Mekhanoshin [Sat, 16 Jun 2018 03:46:59 +0000 (03:46 +0000)]
[AMDGPU] setcc (select cc, CT, CF), CF, eq | ne -> xor cc, -1 | cc

This is the common case in the BE when we serialize condition and then
rematerialize it. Use either original or inverted condition.

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

llvm-svn: 334882

6 years ago[sanitizer_common] Use O_TRUNC for WrOnly access mode.
Fangrui Song [Sat, 16 Jun 2018 03:32:59 +0000 (03:32 +0000)]
[sanitizer_common] Use O_TRUNC for WrOnly access mode.

Summary: Otherwise if the file existed and was larger than the write size before the OpenFile call, the file will not be truncated and contain garbage in trailing bytes.

Reviewers: glider, kcc, vitalybuka

Subscribers: kubamracek, delcypher, llvm-commits, #sanitizers

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

llvm-svn: 334881

6 years agoAvoid needing to walk out legalization tables. NFCI.
Nirav Dave [Sat, 16 Jun 2018 02:51:29 +0000 (02:51 +0000)]
Avoid needing to walk out legalization tables. NFCI.

Relanding after fixing expensive check from modifying tables.

To avoid redundant work, during DAG legalization we keep tables
mapping pre-legalized SDValues to post-legalized SDValues and a
SDValue-to-SDValue map to enable fast node replacements. However, as
the keys are nodes which may be reused it is possible that an entry in
a table refers to a now deleted node N (that should have been renamed
by the value replacement map) while a new node N' exists. If N' is
then replaced that entry would be wrong. Previously we avoided this by
when potentially violating this property, walking every table and
updating all node pointers. This is very expensive but hopefully rare
occurance.

This patch assigns each instance of a SDValue used in legalization a
unique id and uses these ids in the legalization tables. This avoids
any such aliasing issue, avoiding the full table search and allowing
more aggressive incremental table pruning.

In some cases this is a 1000x speedup to compilation.

Reviewers: jyknight, echristo, bogner, tra

Reviewed By: bogner

Subscribers: dberris, grandinj, hiraditya, llvm-commits

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

llvm-svn: 334880

6 years agoCall CreateTempAllocaWithoutCast for ActiveFlag
Yaxun Liu [Sat, 16 Jun 2018 01:20:52 +0000 (01:20 +0000)]
Call CreateTempAllocaWithoutCast for ActiveFlag

This is partial re-commit of r332982.

llvm-svn: 334879

6 years agoRevert "[SCEV] Use LLVM_MARK_AS_BITMASK_ENUM in SCEV." -- breaks MSVC builds.
Justin Lebar [Sat, 16 Jun 2018 00:14:10 +0000 (00:14 +0000)]
Revert "[SCEV] Use LLVM_MARK_AS_BITMASK_ENUM in SCEV." -- breaks MSVC builds.

This reverts D48237.

llvm-svn: 334878

6 years agoRevert "[SCEV] Simplify some flags expressions." -- dependent revision breaks MSVC...
Justin Lebar [Sat, 16 Jun 2018 00:13:57 +0000 (00:13 +0000)]
Revert "[SCEV] Simplify some flags expressions." -- dependent revision breaks MSVC builds.

This reverts D48238.

llvm-svn: 334877

6 years agoUtilize new SDNode flag functionality to expand current support for fma
Michael Berg [Sat, 16 Jun 2018 00:03:06 +0000 (00:03 +0000)]
Utilize new SDNode flag functionality to expand current support for fma

Summary: This patch originated from D47388 and is a proper subset of the originating changes, containing only the fmf optimization guard extensions.

Reviewers: spatel, hfinkel, wristow, arsenm, javed.absar, rampitec, nhaehnle, nemanjai

Reviewed By: rampitec, nhaehnle

Subscribers: tpr, nemanjai, wdng

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

llvm-svn: 334876

6 years ago[SCEV] Simplify some flags expressions.
Justin Lebar [Fri, 15 Jun 2018 23:52:11 +0000 (23:52 +0000)]
[SCEV] Simplify some flags expressions.

Summary:
Sending for presubmit review out of an abundance of caution; it would be
bad to mess this up.

Reviewers: sanjoy

Subscribers: hiraditya, llvm-commits

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

llvm-svn: 334875

6 years ago[SCEV] Use LLVM_MARK_AS_BITMASK_ENUM in SCEV.
Justin Lebar [Fri, 15 Jun 2018 23:51:57 +0000 (23:51 +0000)]
[SCEV] Use LLVM_MARK_AS_BITMASK_ENUM in SCEV.

Summary:
Obviates the need for mask/clear/setFlags helpers.

There are some expressions here which can be simplified, but to keep
this easy to review, I have not simplified them in this patch.

No functional change.

Reviewers: sanjoy

Subscribers: hiraditya, llvm-commits

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

llvm-svn: 334874

6 years agoSort the files in the PBXBuildFile and PBXFileReference sections
Jason Molenda [Fri, 15 Jun 2018 23:32:37 +0000 (23:32 +0000)]
Sort the files in the PBXBuildFile and PBXFileReference sections
of debugserver's xcode project file to reduce automerger issues
with the github swift repository of lldb where the order of these
entries has drifted significantly over the years.

llvm-svn: 334873

6 years agoSort the files in the PBXBuildFile and PBXFileReference
Jason Molenda [Fri, 15 Jun 2018 23:29:32 +0000 (23:29 +0000)]
Sort the files in the PBXBuildFile and PBXFileReference
sections of lldb's xcode project file to reduce automerger
issues with the github swift repository of lldb where
the order of these entries has drifted significantly
over the years.

llvm-svn: 334872

6 years ago[globalisel][tablegen] Add support for C++ predicates on PatFrags and use it to suppo...
Daniel Sanders [Fri, 15 Jun 2018 23:13:43 +0000 (23:13 +0000)]
[globalisel][tablegen] Add support for C++ predicates on PatFrags and use it to support BFC on ARM.

So far, we've only handled special cases of PatFrag like ImmLeaf. This patch
adds support for the remaining cases using similar mechanisms.

Like most C++ code from SelectionDAG, GISel and DAGISel expect to operate on
different types and representations and as such the code is not compatible
between the two. It's therefore necessary to add an alternative implementation
in the GISelPredicateCode field.

The target test for this feature could easily be done with IntImmLeaf and this
would save on a little boilerplate. The reason I've chosen to implement this
using PatFrag.GISelPredicateCode and not IntImmLeaf is because I was unable to
find a rule that was blocked solely by lack of support for PatFrag predicates. I
found that the ones I investigated as being likely candidates for the test
were further blocked by other things.

llvm-svn: 334871

6 years ago[docs] -fsanitize=cfi only allowed with -fvisibility=
Fangrui Song [Fri, 15 Jun 2018 23:11:18 +0000 (23:11 +0000)]
[docs] -fsanitize=cfi only allowed with -fvisibility=

llvm-svn: 334870

6 years agoRevert r334729 "[DAG] Avoid needing to walk out legalization tables. NFCI."
Francis Visoiu Mistrih [Fri, 15 Jun 2018 23:05:41 +0000 (23:05 +0000)]
Revert r334729 "[DAG] Avoid needing to walk out legalization tables. NFCI."

This reverts commit r334729.

llvm-svn: 334869

6 years agoRevert r334731 "Avoid unused variable in non-assert builds."
Francis Visoiu Mistrih [Fri, 15 Jun 2018 23:05:40 +0000 (23:05 +0000)]
Revert r334731 "Avoid unused variable in non-assert builds."

This reverts commit r334731.

It breaks EXPENSIVE_CHECKS bots.

llvm-svn: 334868

6 years ago[X86] Add more instructions to the hasUndefRegUpdate list.
Craig Topper [Fri, 15 Jun 2018 22:25:04 +0000 (22:25 +0000)]
[X86] Add more instructions to the hasUndefRegUpdate list.

Not sure any of these matter today because I don't think we ever produce them with IMPLICIT_DEF as an input. But by listing them we don't be suprised in the future.

llvm-svn: 334867

6 years ago[asan] Move long-object-path.cc test to Linux
Vitaly Buka [Fri, 15 Jun 2018 21:25:42 +0000 (21:25 +0000)]
[asan] Move long-object-path.cc test to Linux

Reviewers: Lekensteyn

Reviewed By: Lekensteyn

Subscribers: srhines, kubamracek, llvm-commits

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

llvm-svn: 334866

6 years ago[BPI] Remove unnecessary std::list
Benjamin Kramer [Fri, 15 Jun 2018 21:06:43 +0000 (21:06 +0000)]
[BPI] Remove unnecessary std::list

vector is sufficient here. No functionality change intended.

llvm-svn: 334865

6 years ago[libFuzzer] Avoid -fuse-ld=lld on gc-sections.
Matt Morehouse [Fri, 15 Jun 2018 21:01:56 +0000 (21:01 +0000)]
[libFuzzer] Avoid -fuse-ld=lld on gc-sections.

The bot doesn't recognize lld as a linker even though it has the
property lld-available.

llvm-svn: 334864

6 years ago[FPEnv] Expand constrained FP POWI
Cameron McInally [Fri, 15 Jun 2018 20:57:55 +0000 (20:57 +0000)]
[FPEnv] Expand constrained FP POWI

Modify ExpandStrictFPOp(...) to handle nodes that have scalar
operands.

Also, add a Strict FMA test and do some other light cleanup in the
Strict FP code.

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

llvm-svn: 334863

6 years agoUtilize new SDNode flag functionality to expand current support for fdiv
Michael Berg [Fri, 15 Jun 2018 20:44:55 +0000 (20:44 +0000)]
Utilize new SDNode flag functionality to expand current support for fdiv

Summary: This patch originated from D46562 and is a proper subset, with some issues addressed.

Reviewers: spatel, hfinkel, wristow, arsenm

Reviewed By: spatel

Subscribers: wdng, nhaehnle

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

llvm-svn: 334862

6 years agoFix TestExec after r334783
Frederic Riss [Fri, 15 Jun 2018 20:36:03 +0000 (20:36 +0000)]
Fix TestExec after r334783

The second makefile that was added has implicit rules which meant
that secondprog.cpp would be built once into a secondprog binary,
but it would also be compiled as a.out overwriting the main binary.
This lead to spurious failures.

This commit simplifies the Makefile to build only once with the correct
executable name.

llvm-svn: 334861

6 years agoRevert "[lldb-mi] Add overload method for setting an error"
Alexander Polyakov [Fri, 15 Jun 2018 20:20:39 +0000 (20:20 +0000)]
Revert "[lldb-mi] Add overload method for setting an error"

Summary: This reverts commit r334245 because it duplicates
functionality of Status::AsCString used in SBError.

Reviewers: aprantl, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits, ki.stfu

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

llvm-svn: 334860

6 years ago[Modules] Improve .Private fix-its to handle 'explicit' and 'framework'
Bruno Cardoso Lopes [Fri, 15 Jun 2018 20:13:28 +0000 (20:13 +0000)]
[Modules] Improve .Private fix-its to handle 'explicit' and 'framework'

When in the context of suggestion the fix-it from .Private to _Private
for private modules, trim off the 'explicit' and add 'framework' when
appropriate.

rdar://problem/41030554

llvm-svn: 334859

6 years ago[SanitizerCoverage] Add associated metadata to pc-tables.
Matt Morehouse [Fri, 15 Jun 2018 20:12:58 +0000 (20:12 +0000)]
[SanitizerCoverage] Add associated metadata to pc-tables.

Summary:
Using associated metadata rather than llvm.used allows linkers to
perform dead stripping with -fsanitize-coverage=pc-table.  Unfortunately
in my local tests, LLD was the only linker that made use of this metadata.

Partially addresses https://bugs.llvm.org/show_bug.cgi?id=34636 and fixes
https://github.com/google/sanitizers/issues/971.

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: Dor1s, hiraditya, llvm-commits, kcc

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

llvm-svn: 334858

6 years agoUpdate my information in the CREDITS file.
Geoff Berry [Fri, 15 Jun 2018 20:02:11 +0000 (20:02 +0000)]
Update my information in the CREDITS file.

llvm-svn: 334857

6 years ago[PowerPC] Add support for high and higha symbol modifiers on tls modifers.
Sean Fertile [Fri, 15 Jun 2018 19:47:16 +0000 (19:47 +0000)]
[PowerPC] Add support for high and higha symbol modifiers on tls modifers.

Enables using the high and high-adjusted symbol modifiers on thread local
storage modifers in powerpc assembly. Needed to be able to support 64 bit
thread-pointer and dynamic-thread-pointer access sequences.

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

llvm-svn: 334856

6 years ago[PPC64] Support "symbol@high" and "symbol@higha" symbol modifers.
Sean Fertile [Fri, 15 Jun 2018 19:47:11 +0000 (19:47 +0000)]
[PPC64] Support "symbol@high" and "symbol@higha" symbol modifers.

Add support for the "@high" and "@higha" symbol modifiers in powerpc64 assembly.
The modifiers represent accessing the segment consiting of bits 16-31 of a
64-bit address/offset.

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

llvm-svn: 334855

6 years agoMove redundant-vf2-cost.ll test to X86 directory
Diego Caballero [Fri, 15 Jun 2018 18:46:03 +0000 (18:46 +0000)]
Move redundant-vf2-cost.ll test to X86 directory

redundant-vf2-cost.ll is X86 specific. Moved from
test/Transforms/LoopVectorize/redundant-vf2-cost.ll to
test/Transforms/LoopVectorize/X86/redundant-vf2-cost.ll

llvm-svn: 334854

6 years ago[llvm-mca][x86] Add Generic cpu resource tests
Simon Pilgrim [Fri, 15 Jun 2018 18:35:25 +0000 (18:35 +0000)]
[llvm-mca][x86] Add Generic cpu resource tests

Added a Generic x86 cpu set of resource tests to allow us to check all ISAs.

We currently use SandyBridge as our generic CPU model, but it's better if we actually duplicate these tests for if/when we change the model, it also means we don't end up polluting the SandyBridge folder with tests for ISAs it doesn't support.

llvm-svn: 334853

6 years ago[Fuzzer] Don't hardcode target architecture for Fuzzer tests
Petr Hosek [Fri, 15 Jun 2018 18:21:02 +0000 (18:21 +0000)]
[Fuzzer] Don't hardcode target architecture for Fuzzer tests

Don't hardcode the architecture for Fuzzer tests which breaks when
compiler-rt is being compiled for architectures other than x86_64.

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

llvm-svn: 334852

6 years ago[ELF][MIPS] Fix stable_sort predicate to satisfy strict-ordering requirement. NFC
Simon Atanasyan [Fri, 15 Jun 2018 18:15:26 +0000 (18:15 +0000)]
[ELF][MIPS] Fix stable_sort predicate to satisfy strict-ordering requirement. NFC

Fix for PR37785.

llvm-svn: 334851

6 years ago[X86] Lowering sqrt intrinsics to native IR
Tomasz Krupa [Fri, 15 Jun 2018 18:05:59 +0000 (18:05 +0000)]
[X86] Lowering sqrt intrinsics to native IR

Reviewers: craig.topper, spatel, RKSimon, igorb, uriel.k

Reviewed By: craig.topper

Subscribers: tkrupa, cfe-commits

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

llvm-svn: 334850

6 years ago[X86] Lowering sqrt intrinsics to native IR
Tomasz Krupa [Fri, 15 Jun 2018 18:05:24 +0000 (18:05 +0000)]
[X86] Lowering sqrt intrinsics to native IR

Summary: Complementary patch to lowering sqrt intrinsics in Clang.

Reviewers: craig.topper, spatel, RKSimon, DavidKreitzer, uriel.k

Reviewed By: craig.topper

Subscribers: tkrupa, mike.dvoretsky, llvm-commits

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

llvm-svn: 334849

6 years ago[X86] Prevent folding stack reloads into instructions in hasUndefRegUpdate.
Craig Topper [Fri, 15 Jun 2018 17:56:17 +0000 (17:56 +0000)]
[X86] Prevent folding stack reloads into instructions in hasUndefRegUpdate.

An earlier commit prevented folds from the peephole pass by checking for IMPLICIT_DEF. But later in the pipeline IMPLICIT_DEF just becomes and Undef flag on the input register so we need to check for that case too.

llvm-svn: 334848

6 years ago[X86] __builtin_ia32_prord512_mask, __builtin_ia32_prorq512_mask, __builtin_ia32_shuf...
Craig Topper [Fri, 15 Jun 2018 17:40:37 +0000 (17:40 +0000)]
[X86] __builtin_ia32_prord512_mask, __builtin_ia32_prorq512_mask, __builtin_ia32_shufpd should only accept an ICE constant.

The rotates also need to check for the immediate to fit in 8-bits. Shufpd already checks its immediate range.

llvm-svn: 334847

6 years ago[X86] The immediate argument to getmantpd*_mask should be an ICE and it should only...
Craig Topper [Fri, 15 Jun 2018 17:03:32 +0000 (17:03 +0000)]
[X86] The immediate argument to getmantpd*_mask should be an ICE and it should only be 4 bits wide.

We already checked this for the scalar version, but missed the vector version somehow.

llvm-svn: 334846

6 years agoRemove <undef> from rematerialized full register
Krzysztof Parzyszek [Fri, 15 Jun 2018 16:58:22 +0000 (16:58 +0000)]
Remove <undef> from rematerialized full register

When coalescing a small register into a subregister of a larger register,
if the larger register is rematerialized, the function updateRegDefUses
can add an <undef> flag to the rematerialized definition (since it's
treating it as only definining the coalesced subregister). While with that
assumption doing so is not incorrect, make sure to remove the flag later
on after the call to updateRegDefUses.

llvm-svn: 334845

6 years ago[InstCombine] Avoid iteration/mutation conflict
Joseph Tremoulet [Fri, 15 Jun 2018 16:52:40 +0000 (16:52 +0000)]
[InstCombine] Avoid iteration/mutation conflict

Summary:
When iterating users of a multiply in processUMulZExtIdiom, the
call to setOperand in the truncation case may replace the use
being visited; make sure the iterator has been advanced before
doing that replacement.

Reviewers: majnemer, davide

Reviewed By: davide

Subscribers: llvm-commits

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

llvm-svn: 334844

6 years ago[scudo] Add verbose failures in place of CHECK(0)
Kostya Kortchinsky [Fri, 15 Jun 2018 16:45:19 +0000 (16:45 +0000)]
[scudo] Add verbose failures in place of CHECK(0)

Summary:
The current `FailureHandler` mechanism was fairly opaque with regard to the
failure reason due to using `CHECK(0)`. Scudo is a bit different from the other
Sanitizers as it prefers to avoid spurious processing in its failure path. So
we just `dieWithMessage` using a somewhat explicit string.

Adapted the tests for the new strings.

While this takes care of the `OnBadRequest` & `OnOOM` failures, the next step
is probably to migrate the other Scudo failures in the same failes (header
corruption, invalid state and so on).

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: filcab, mgorny, delcypher, #sanitizers, llvm-commits

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

llvm-svn: 334843

6 years ago[AArch64][SVE] Asm: Support for CPY SIMD/FP and GPR instructions.
Sander de Smalen [Fri, 15 Jun 2018 16:39:46 +0000 (16:39 +0000)]
[AArch64][SVE] Asm: Support for CPY SIMD/FP and GPR instructions.

Predicated splat/copy of SIMD/FP register or general purpose
register to SVE vector, along with MOV-aliases.

llvm-svn: 334842

6 years agoAvoid copying PrettyStackTrace messages an extra time on Apple OSs
Jordan Rose [Fri, 15 Jun 2018 16:35:31 +0000 (16:35 +0000)]
Avoid copying PrettyStackTrace messages an extra time on Apple OSs

We were unnecessarily going from SmallString to std::string just to
get a null-terminated C string. So just...don't do that. Crash
slightly faster!

llvm-svn: 334841

6 years ago[LV] Prevent LV to run cost model twice for VF=2
Diego Caballero [Fri, 15 Jun 2018 16:21:35 +0000 (16:21 +0000)]
[LV] Prevent LV to run cost model twice for VF=2

This is a minor fix for LV cost model, where the cost for VF=2 was
computed twice when the vectorization of the loop was forced without
specifying a VF.

Reviewers: xusx595, hsaito, fhahn, mkuper

Reviewed By: hsaito, xusx595

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

llvm-svn: 334840

6 years agobpf: recognize target specific option -mattr=dwarfris in clang
Yonghong Song [Fri, 15 Jun 2018 15:53:31 +0000 (15:53 +0000)]
bpf: recognize target specific option -mattr=dwarfris in clang

The following is the usage example with clang:
  bash-4.2$ clang -target bpf -O2 -g -c -Xclang -target-feature -Xclang +dwarfris t.c
  bash-4.2$ llvm-objdump -S -d t.o

  t.o:    file format ELF64-BPF

  Disassembly of section .text:
  test:
  ; int test(void) {
       0:       b7 00 00 00 00 00 00 00         r0 = 0
  ; return 0;
         1:       95 00 00 00 00 00 00 00         exit
  bash-4.2$ cat t.c
  int test(void) {
    return 0;
  }
  bash-4.2$

Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 334839

6 years ago[AArch64][SVE] Asm: Support for INC/DEC (scalar) instructions.
Sander de Smalen [Fri, 15 Jun 2018 15:47:44 +0000 (15:47 +0000)]
[AArch64][SVE] Asm: Support for INC/DEC (scalar) instructions.

Increment/decrement scalar register by (scaled) element count given by
predicate pattern, e.g. 'incw x0, all, mul #4'.

Reviewers: rengolin, fhahn, SjoerdMeijer, samparker, javed.absar

Reviewed By: SjoerdMeijer

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

llvm-svn: 334838