platform/upstream/llvm.git
6 years agoAllow to apply cherry-picks when building Docker images.
Ilya Biryukov [Wed, 20 Dec 2017 14:39:07 +0000 (14:39 +0000)]
Allow to apply cherry-picks when building Docker images.

Reviewers: mehdi_amini, ioeric, klimek

Reviewed By: ioeric

Subscribers: llvm-commits

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

llvm-svn: 321175

6 years ago[Frontend] Handle skipped bodies in template instantiations
Ilya Biryukov [Wed, 20 Dec 2017 14:32:38 +0000 (14:32 +0000)]
[Frontend] Handle skipped bodies in template instantiations

Summary:
- Fixed an assert in Sema::InstantiateFunctionDefinition and added
  support for instantiating a function template with skipped body.
- Properly call setHasSkippedBody for FunctionTemplateDecl passed to
  Sema::ActOnSkippedFunctionBody.

Reviewers: sepavloff, bkramer

Reviewed By: sepavloff

Subscribers: klimek, cfe-commits

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

llvm-svn: 321174

6 years ago[clangd] Made UniqueFunction's bool conversion explicit
Ilya Biryukov [Wed, 20 Dec 2017 14:06:05 +0000 (14:06 +0000)]
[clangd] Made UniqueFunction's bool conversion explicit

llvm-svn: 321173

6 years ago[LV] Remove unnecessary DoExtraAnalysis guard (silent bug)
Florian Hahn [Wed, 20 Dec 2017 13:28:38 +0000 (13:28 +0000)]
[LV] Remove unnecessary DoExtraAnalysis guard (silent bug)

canVectorize is only checking if the loop has a normalized pre-header if DoExtraAnalysis is true.
This doesn't make sense to me because reporting analysis information shouldn't alter legality
checks. This is probably the result of a last minute minor change before committing (?).

Patch by Diego Caballero.

Reviewed By: fhahn

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

llvm-svn: 321172

6 years ago[X86][AVX2] Split more shuffle tests into 'slow' and 'fast' variable shuffles
Simon Pilgrim [Wed, 20 Dec 2017 13:12:34 +0000 (13:12 +0000)]
[X86][AVX2] Split more shuffle tests into 'slow' and 'fast' variable shuffles

llvm-svn: 321171

6 years agoTrivial commit to force LLVM to run TableGen for Mips target after
Sander de Smalen [Wed, 20 Dec 2017 12:45:40 +0000 (12:45 +0000)]
Trivial commit to force LLVM to run TableGen for Mips target after
a change to the AsmMatcherEmitter, and should fix the buildbot
failure on llvm-clang-x86_64-expensive-checks-win.

The issue is also described here:
http://lists.llvm.org/pipermail/llvm-dev/2017-December/119617.html

llvm-svn: 321170

6 years agoFix an error in the release notes.
Gabor Horvath [Wed, 20 Dec 2017 12:30:27 +0000 (12:30 +0000)]
Fix an error in the release notes.

llvm-svn: 321169

6 years ago[clang-tidy] Misc redundant expression checker updated for ineffective bitwise operat...
Gabor Horvath [Wed, 20 Dec 2017 12:22:16 +0000 (12:22 +0000)]
[clang-tidy] Misc redundant expression checker updated for ineffective bitwise operator expressions

Examples:
* Always evaluates to 0:

```
  int X;
  if (0 & X) return;
```

* Always evaluates to ~0:

```
  int Y;
  if (Y | ~0) return;
```

* The symbol is unmodified:

```
  int Z;
  Z &= ~0;
```

Patch by: Lilla Barancsuk!

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

llvm-svn: 321168

6 years agoRemove llvm::MemoryBuffer const_casts
Pavel Labath [Wed, 20 Dec 2017 11:34:38 +0000 (11:34 +0000)]
Remove llvm::MemoryBuffer const_casts

Summary:
llvm has grown a WritableMemoryBuffer class, which is convertible
(inherits from) a MemoryBuffer. We can use it to avoid conts_casting the
buffer contents when we want to write to it.

Reviewers: dblaikie, rsmith

Subscribers: cfe-commits

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

llvm-svn: 321167

6 years ago[TargetParser] Check size before accessing architecture version.
Florian Hahn [Wed, 20 Dec 2017 11:32:43 +0000 (11:32 +0000)]
[TargetParser] Check size before accessing architecture version.

Summary:
This fixes a crash when invalid -march options like `armv` are provided.

Based on a patch by Will Lovett.

Reviewers: rengolin, samparker, mcrosier

Reviewed By: samparker

Subscribers: aemerson, kristof.beyls, llvm-commits

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

llvm-svn: 321166

6 years ago[ARM GlobalISel] Fix assertion in RegBankSelect
Diana Picus [Wed, 20 Dec 2017 11:27:10 +0000 (11:27 +0000)]
[ARM GlobalISel] Fix assertion in RegBankSelect

We get an assertion in RegBankSelect for code along the lines of
my_32_bit_int = my_64_bit_int, which tends to translate into a 64-bit
load, followed by a G_TRUNC, followed by a 32-bit store. This appears in
a couple of places in the test-suite.

At the moment, the legalizer doesn't distinguish between integer and
floating point scalars, so a 64-bit load will be marked as legal for
targets with VFP, and so will the rest of the sequence, leading to a
slightly bizarre G_TRUNC reaching RegBankSelect.

Since the current support for 64-bit integers is rather immature, this
patch works around the issue by explicitly handling this case in
RegBankSelect and InstructionSelect. In the future, we may want to
revisit this decision and make sure 64-bit integer loads are narrowed
before reaching RegBankSelect.

llvm-svn: 321165

6 years ago[ARM] Lower unsigned saturation to USAT
Florian Hahn [Wed, 20 Dec 2017 11:13:57 +0000 (11:13 +0000)]
[ARM] Lower unsigned saturation to USAT

Summary:
Implement lower of unsigned saturation on an interval [0, k] where k + 1 is a power of two using USAT instruction in a similar way to how [~k, k] is lowered using SSAT on ARM models that supports it.

Patch by Marten Svanfeldt

Reviewers: t.p.northover, pbarrio, eastig, SjoerdMeijer, javed.absar, fhahn

Reviewed By: fhahn

Subscribers: fhahn, aemerson, javed.absar, llvm-commits, kristof.beyls

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

llvm-svn: 321164

6 years ago[AArch64][SVE] Re-submit patch series for ZIP1/ZIP2
Sander de Smalen [Wed, 20 Dec 2017 11:02:42 +0000 (11:02 +0000)]
[AArch64][SVE] Re-submit patch series for ZIP1/ZIP2

This patch resubmits the SVE ZIP1/ZIP2 patch series consisting of
of r320992, r320986, r320973, and r320970 by reverting
https://reviews.llvm.org/rL321024.

The issue that caused r321024 has been addressed in https://reviews.llvm.org/rL321158,
so this patch-series should be safe to resubmit.

llvm-svn: 321163

6 years agoAArch64: fix one more place movi.2d could be created.
Tim Northover [Wed, 20 Dec 2017 10:45:39 +0000 (10:45 +0000)]
AArch64: fix one more place movi.2d could be created.

Somehow got missed out of r320965.

llvm-svn: 321162

6 years ago[clangd] Add debug printers for basic protocol types. NFC
Sam McCall [Wed, 20 Dec 2017 10:26:53 +0000 (10:26 +0000)]
[clangd] Add debug printers for basic protocol types. NFC

llvm-svn: 321161

6 years agoGive up on array allocas in getPointerDereferenceableBytes
Bjorn Steinbrink [Wed, 20 Dec 2017 10:01:30 +0000 (10:01 +0000)]
Give up on array allocas in getPointerDereferenceableBytes

Summary:
As suggested by Eli Friedman, don't try to handle array allocas here,
because of possible overflows, instead rely on instcombine converting
them to allocations of array types.

Reviewers: efriedma

Subscribers: llvm-commits

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

llvm-svn: 321159

6 years ago[AArch64] Asm: Fix parsing of register aliases that have a name starting with 'z'
Sander de Smalen [Wed, 20 Dec 2017 09:45:45 +0000 (09:45 +0000)]
[AArch64] Asm: Fix parsing of register aliases that have a name starting with 'z'

Summary: This fixes an issue as identified by @rnk in https://reviews.llvm.org/rL321029.

Reviewers: rnk, fhahn, rengolin, efriedma, echristo, olista01

Reviewed By: rnk, fhahn

Subscribers: aemerson, javed.absar, kristof.beyls, llvm-commits, rnk

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

llvm-svn: 321158

6 years ago[clangd] Igore cases in index fuzzy find.
Eric Liu [Wed, 20 Dec 2017 09:29:54 +0000 (09:29 +0000)]
[clangd] Igore cases in index fuzzy find.

llvm-svn: 321157

6 years ago[clangd] Add "../" to Logger.h included from parent directory.
Martin Bohme [Wed, 20 Dec 2017 09:17:31 +0000 (09:17 +0000)]
[clangd] Add "../" to Logger.h included from parent directory.

llvm-svn: 321156

6 years ago[AArch64] CCSIDR2 system register
Sam Parker [Wed, 20 Dec 2017 08:56:41 +0000 (08:56 +0000)]
[AArch64] CCSIDR2 system register

Implement the 'Current Cache Size' register that has been introduced
as part of the Armv8.3 architecture. I originally missed this, and
(hopefully) should be the final patch for assembler support.

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

llvm-svn: 321155

6 years ago[ELF] Fix an assignment command at the end of an .ARM.exidx section.
Igor Kudrin [Wed, 20 Dec 2017 08:56:10 +0000 (08:56 +0000)]
[ELF] Fix an assignment command at the end of an .ARM.exidx section.

The value of the symbol in the assignment should include the sentinel entry.

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

llvm-svn: 321154

6 years ago[X86][CLFLUSH]: Adding full coverage of MC encoding for the CLFLUSH isa sets.<NFC>
Gadi Haber [Wed, 20 Dec 2017 08:28:24 +0000 (08:28 +0000)]
[X86][CLFLUSH]: Adding full coverage of MC encoding for the CLFLUSH isa sets.<NFC>

NFC.
Adding MC regressions tests to cover the CLFLSH and CLFLUSHOPT isa sets.
This patch is part of a larger task to cover MC encoding of all X86 isa sets started in revision: https://reviews.llvm.org/D39952

Reviewers: zvi, RKSimon, craig.topper, m_zuckerman
Differential Revision: https://reviews.llvm.org/D41331

Change-Id: Ifa643dd52f1b7184c52bc1806038dc74b234fc65
llvm-svn: 321153

6 years ago[X86] Optimize sign extends on index operand to gather/scatter to not sign extend...
Craig Topper [Wed, 20 Dec 2017 07:36:59 +0000 (07:36 +0000)]
[X86] Optimize sign extends on index operand to gather/scatter to not sign extend past i32.

The gather instruction will implicitly sign extend to the pointer width, we don't need to further extend it. This can prevent unnecessary splitting in some cases.

There's still an issue that lowering on non-VLX can introduce another sign extend that doesn't get combined with shifts from a lowered sign_extend_inreg.

llvm-svn: 321152

6 years ago[builtins] Implement __chkstk for arm64 windows
Martin Storsjo [Wed, 20 Dec 2017 06:52:52 +0000 (06:52 +0000)]
[builtins] Implement __chkstk for arm64 windows

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

llvm-svn: 321151

6 years ago[AArch64] Implement stack probing for windows
Martin Storsjo [Wed, 20 Dec 2017 06:51:45 +0000 (06:51 +0000)]
[AArch64] Implement stack probing for windows

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

llvm-svn: 321150

6 years ago[COFF] Don't set the thumb bit in address table entries for data symbols
Martin Storsjo [Wed, 20 Dec 2017 06:50:45 +0000 (06:50 +0000)]
[COFF] Don't set the thumb bit in address table entries for data symbols

The thumb bit should only be set for executable code.

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

llvm-svn: 321149

6 years ago[X86] Add a missing return to combineGatherScatter after sucessful combine.
Craig Topper [Wed, 20 Dec 2017 06:44:50 +0000 (06:44 +0000)]
[X86] Add a missing return to combineGatherScatter after sucessful combine.

Not sure how to test this cause I think the worst that happens is that we don't revisit the node a second time to look for additional combines. We used UpdateNodeOperands so the updating the DAG work was already done.

llvm-svn: 321148

6 years ago[PowerPC] fix a bug in redundant compare elimination
Hiroshi Inoue [Wed, 20 Dec 2017 05:18:19 +0000 (05:18 +0000)]
[PowerPC] fix a bug in redundant compare elimination

This patch fixes a bug in the redundant compare elimination reported in https://reviews.llvm.org/rL320786 and re-enables the optimization.

The redundant compare elimination assumes that we can replace signed comparison with unsigned comparison for the equality check. But due to the difference in the sign extension behavior we cannot change the opcode if the comparison is against an immediate and the most significant bit of the immediate is one.

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

llvm-svn: 321147

6 years ago[WebAssembly] Improve toString(OutputSection). NFC.
Sam Clegg [Wed, 20 Dec 2017 05:14:48 +0000 (05:14 +0000)]
[WebAssembly] Improve toString(OutputSection). NFC.

llvm-svn: 321146

6 years ago[darwin][driver] Warn about mismatching -<os>-version-min rather than
Alex Lorenz [Wed, 20 Dec 2017 02:31:30 +0000 (02:31 +0000)]
[darwin][driver] Warn about mismatching -<os>-version-min rather than
superfluous -<os>-version-min compiler option

rdar://35813850

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

llvm-svn: 321145

6 years ago[hwasan] Remove --check-prefix=CHECK (NFC)
Evgeniy Stepanov [Wed, 20 Dec 2017 02:03:47 +0000 (02:03 +0000)]
[hwasan] Remove --check-prefix=CHECK (NFC)

llvm-svn: 321141

6 years agoReplace a dyn_cast_or_null with dyn_cast.
Rafael Espindola [Wed, 20 Dec 2017 01:57:19 +0000 (01:57 +0000)]
Replace a dyn_cast_or_null with dyn_cast.

The variable being casted was accessed in the previous line.

llvm-svn: 321140

6 years agoRevert r320942, "[ASTImporter] Support importing FunctionTemplateDecl and CXXDependen...
Peter Collingbourne [Wed, 20 Dec 2017 01:47:08 +0000 (01:47 +0000)]
Revert r320942, "[ASTImporter] Support importing FunctionTemplateDecl and CXXDependentScopeMemberExpr"

Caused a test failure on Windows:

[ RUN      ] ImportExpr.ImportCXXDependentScopeMemberExpr
C:\b\rr\tmppzcp4w\w\src\third_party\llvm\tools\clang\unittests\AST\ASTImporterTest.cpp(526): error: Value of: testImport("template <typename T> class C { T t; };" "template <typename T> void declToImport() {" "  C<T> d;" "  d.t;" "}", Lang_CXX, "", Lang_CXX, Verifier, functionTemplateDecl(has(functionDecl(has(compoundStmt( has(cxxDependentScopeMemberExpr())))))))
  Actual: false (Could not find match)
Expected: true
C:\b\rr\tmppzcp4w\w\src\third_party\llvm\tools\clang\unittests\AST\ASTImporterTest.cpp(534): error: Value of: testImport("template <typename T> class C { T t; };" "template <typename T> void declToImport() {" "  C<T> d;" "  (&d)->t;" "}", Lang_CXX, "", Lang_CXX, Verifier, functionTemplateDecl(has(functionDecl(has(compoundStmt( has(cxxDependentScopeMemberExpr())))))))
  Actual: false (Could not find match)
Expected: true
[  FAILED  ] ImportExpr.ImportCXXDependentScopeMemberExpr (37 ms)

llvm-svn: 321139

6 years ago[memcpyopt] Teach memcpyopt to optimize across basic blocks
Dan Gohman [Wed, 20 Dec 2017 01:36:25 +0000 (01:36 +0000)]
[memcpyopt] Teach memcpyopt to optimize across basic blocks

This teaches memcpyopt to make a non-local memdep query when a local query
indicates that the dependency is non-local. This notably allows it to
eliminate many more llvm.memcpy calls in common Rust code, often by 20-30%.

This is r319482 and r319483, along with fixes for PR35519: fix the
optimization that merges stores into memsets to preserve cached memdep
info, and fix memdep's non-local caching strategy to not assume that larger
queries are always more conservative than smaller ones.

Fixes PR28958 and PR35519.

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

llvm-svn: 321138

6 years ago[X86] Improve coverage of fma negations.
Craig Topper [Wed, 20 Dec 2017 01:26:36 +0000 (01:26 +0000)]
[X86] Improve coverage of fma negations.

llvm-svn: 321137

6 years ago[X86] Fix probable typo in fma fneg test.
Craig Topper [Wed, 20 Dec 2017 01:26:35 +0000 (01:26 +0000)]
[X86] Fix probable typo in fma fneg test.

llvm-svn: 321136

6 years ago[analyzer] De-duplicate path diagnostics for each exploded graph node.
Artem Dergachev [Wed, 20 Dec 2017 01:17:53 +0000 (01:17 +0000)]
[analyzer] De-duplicate path diagnostics for each exploded graph node.

The bugreporter::trackNullOrUndefValue() mechanism contains a system of bug
reporter visitors that recursively call each other in order to track where a
null or undefined value came from, where each visitor represents a particular
tracking mechanism (track how the value was stored, track how the value was
returned from a function, track how the value was constrained to null, etc.).

Each visitor is only added once per value it needs to track. Almost. One
exception from this rule would be FindLastStoreBRVisitor that has two operation
modes: it contains a flag that indicates whether null stored values should be
suppressed. Two instances of FindLastStoreBRVisitor with different values of
this flag are considered to be different visitors, so they can be added twice
and produce the same diagnostic twice. This was indeed the case in the affected
test.

With the current logic of this whole machinery, such duplication seems
unavoidable. We should be able to safely add visitors with different flag
values without constructing duplicate diagnostic pieces. Hence the effort
in this commit to de-duplicate diagnostics regardless of what visitors
have produced them.

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

llvm-svn: 321135

6 years ago[WebAssembly] Add test of indirect call to an otherwise unused type
Sam Clegg [Wed, 20 Dec 2017 01:17:45 +0000 (01:17 +0000)]
[WebAssembly] Add test of indirect call to an otherwise unused type

In this case we are calling a function pointer which
a type that doesn't otherwise exist in the code.
Clearly this code can't would trap if it was ever
called (because there is not such function that
the pointer can resolve to).

But it should valid and compile and link and validation
time.

llvm-svn: 321134

6 years ago[analyzer] trackNullOrUndefValue: always track through parentheses and casts.
Artem Dergachev [Wed, 20 Dec 2017 01:03:22 +0000 (01:03 +0000)]
[analyzer] trackNullOrUndefValue: always track through parentheses and casts.

When trying to figure out where a null or undefined value came from,
parentheses and cast expressions are either completely irrelevant, or,
in the case of lvalue-to-rvale cast, straightforwardly lead us in the right
direction when we remove them.

There is a regression that causes a certain diagnostic to appear twice in the
path-notes.cpp test (changed to FIXME). It would be addressed in the next
commit.

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

llvm-svn: 321133

6 years ago[X86] Remove code from combineSext that looks for MVT::i1 after operation legalizatio...
Craig Topper [Wed, 20 Dec 2017 01:00:01 +0000 (01:00 +0000)]
[X86] Remove code from combineSext that looks for MVT::i1 after operation legalization which can never happen.

Type legalization guarantees this to be impossible since MVT::i1 isn't a legal type.

llvm-svn: 321132

6 years ago[WebAssembly] Disable tee_local optimizations when targeting the ELF ABI.
Dan Gohman [Wed, 20 Dec 2017 00:59:28 +0000 (00:59 +0000)]
[WebAssembly] Disable tee_local optimizations when targeting the ELF ABI.

These optimizations depend on the ExplicitLocals pass to lower TEE
instructions, which is disabled in the ELF ABI, so disable them too.

llvm-svn: 321131

6 years ago[analyzer] trackNullOrUndefValue: track last store to non-variables.
Artem Dergachev [Wed, 20 Dec 2017 00:47:17 +0000 (00:47 +0000)]
[analyzer] trackNullOrUndefValue: track last store to non-variables.

When reporting certain kinds of analyzer warnings, we use the
bugreporter::trackNullOrUndefValue mechanism, which is part of public checker
API, to understand where a zero, null-pointer, or garbage value came from,
which would highlight important events with respect to that value in the
diagnostic path notes, and help us suppress various false positives that result
from values appearing from particular sources.

Previously, we've lost track of the value when it was written into a memory
region that is not a plain variable. Now try to resume tracking in this
situation by finding where the last write to this region has occured.

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

llvm-svn: 321130

6 years ago[X86] Add more CPUID bits to cpuid.h to match gcc and support icelake features.
Craig Topper [Wed, 20 Dec 2017 00:46:09 +0000 (00:46 +0000)]
[X86] Add more CPUID bits to cpuid.h to match gcc and support icelake features.

llvm-svn: 321129

6 years ago[analyzer] Fix a crash during C++17 aggregate construction of base objects.
Artem Dergachev [Wed, 20 Dec 2017 00:40:38 +0000 (00:40 +0000)]
[analyzer] Fix a crash during C++17 aggregate construction of base objects.

Since C++17, classes that have base classes can potentially be initialized as
aggregates. Trying to construct such objects through brace initialization was
causing the analyzer to crash when the base class has a non-trivial constructor,
while figuring target region for the base class constructor, because the parent
stack frame didn't contain the constructor of the subclass, because there is
no constructor for subclass, merely aggregate initialization.

This patch avoids the crash, but doesn't provide the actually correct region
for the constructor, which still remains to be fixed. Instead, construction
goes into a fake temporary region which would be immediately discarded. Similar
extremely conservative approach is used for other cases in which the logic for
finding the target region is not yet implemented, including aggregate
initialization with fields instead of base-regions (which is not C++17-specific
but also never worked, just didn't crash).

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

rdar://problem/35441058

llvm-svn: 321128

6 years ago[WebAssembly] Remove an obsolete comment.
Dan Gohman [Wed, 20 Dec 2017 00:10:28 +0000 (00:10 +0000)]
[WebAssembly] Remove an obsolete comment.

llvm-svn: 321127

6 years agoUse references instead of pointers. NFC.
Rafael Espindola [Tue, 19 Dec 2017 23:59:35 +0000 (23:59 +0000)]
Use references instead of pointers. NFC.

These values are trivially never null. While at it, also use
InputSection instead of InputSectionBase when possible.

llvm-svn: 321126

6 years agoRevert "Fix faulty assertion in debug info"
Adrian McCarthy [Tue, 19 Dec 2017 23:34:37 +0000 (23:34 +0000)]
Revert "Fix faulty assertion in debug info"

This reverts commit e32def3f7ebe1136b7038336eff56a415a962bf2.

llvm-svn: 321125

6 years agolibcxx: Fix for basic_stringbuf::seekoff() after r320604.
Peter Collingbourne [Tue, 19 Dec 2017 23:33:16 +0000 (23:33 +0000)]
libcxx: Fix for basic_stringbuf::seekoff() after r320604.

As a result of this change, the basic_stringbuf constructor that
takes a mode ends up leaving __hm_ set to 0, causing the comparison
"__hm_ - __str_.data() < __noff" in seekoff() to succeed, which caused
the function to incorrectly return -1. The fix is to account for the
possibility of __hm_ being 0 when computing the distance from __hm_
to the start of the string.

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

llvm-svn: 321124

6 years agoReplace an accidentally added "break" with an LLVM_FALLTHROUGH.
Adrian Prantl [Tue, 19 Dec 2017 23:16:38 +0000 (23:16 +0000)]
Replace an accidentally added "break" with an LLVM_FALLTHROUGH.

Thanks to Greg Clayton for catchting this!

llvm-svn: 321123

6 years agoFix faulty assertion in debug info
Adrian McCarthy [Tue, 19 Dec 2017 23:01:17 +0000 (23:01 +0000)]
Fix faulty assertion in debug info

It appears the code uses nullptr to represent a void type in debug metadata,
which led to an assertion failure when building DeltaAlgorithm.cpp with a
self-hosted clang on Windows.

I'm not sure why/if the problem was Windows-specific.

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

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

llvm-svn: 321122

6 years ago[hwasan] Fix handling of store errors.
Evgeniy Stepanov [Tue, 19 Dec 2017 22:57:02 +0000 (22:57 +0000)]
[hwasan] Fix handling of store errors.

llvm-svn: 321121

6 years agoFix a couple of warnings (NFC)
Adrian Prantl [Tue, 19 Dec 2017 22:54:37 +0000 (22:54 +0000)]
Fix a couple of warnings (NFC)

llvm-svn: 321120

6 years ago[hwasan] Remove unused -check-prefix in tests.
Evgeniy Stepanov [Tue, 19 Dec 2017 22:48:46 +0000 (22:48 +0000)]
[hwasan] Remove unused -check-prefix in tests.

llvm-svn: 321119

6 years ago[X86] Add an assert to indicate that there is only once specific VT allowed at a...
Craig Topper [Tue, 19 Dec 2017 22:38:09 +0000 (22:38 +0000)]
[X86] Add an assert to indicate that there is only once specific VT allowed at a certain point in LowerMULH.

Helps with code readability a little.

llvm-svn: 321118

6 years agoAdd explicit break (PR35700).
Adrian Prantl [Tue, 19 Dec 2017 22:21:48 +0000 (22:21 +0000)]
Add explicit break (PR35700).

llvm-svn: 321116

6 years agoSilence a bunch of implicit fallthrough warnings
Adrian Prantl [Tue, 19 Dec 2017 22:06:11 +0000 (22:06 +0000)]
Silence a bunch of implicit fallthrough warnings

llvm-svn: 321115

6 years agoSilence a bunch of implicit fallthrough warnings
Adrian Prantl [Tue, 19 Dec 2017 22:05:25 +0000 (22:05 +0000)]
Silence a bunch of implicit fallthrough warnings

llvm-svn: 321114

6 years ago[CodeGen] Move printing MO_BlockAddress operands to MachineOperand::print
Francis Visoiu Mistrih [Tue, 19 Dec 2017 21:47:14 +0000 (21:47 +0000)]
[CodeGen] Move printing MO_BlockAddress operands to MachineOperand::print

Work towards the unification of MIR and debug output by refactoring the
interfaces.

llvm-svn: 321113

6 years ago[CodeGen] Move printing MO_IntrinsicID operands to MachineOperand::print
Francis Visoiu Mistrih [Tue, 19 Dec 2017 21:47:10 +0000 (21:47 +0000)]
[CodeGen] Move printing MO_IntrinsicID operands to MachineOperand::print

Work towards the unification of MIR and debug output by refactoring the
interfaces.

llvm-svn: 321112

6 years ago[CodeGen] Move printing MO_IntrinsicID operands to MachineOperand::print
Francis Visoiu Mistrih [Tue, 19 Dec 2017 21:47:05 +0000 (21:47 +0000)]
[CodeGen] Move printing MO_IntrinsicID operands to MachineOperand::print

Work towards the unification of MIR and debug output by refactoring the
interfaces.

Also add support for printing with a null TargetIntrinsicInfo and no
MachineFunction.

llvm-svn: 321111

6 years ago[CodeGen] Move printing MO_FPImmediate operands to MachineOperand::print
Francis Visoiu Mistrih [Tue, 19 Dec 2017 21:47:00 +0000 (21:47 +0000)]
[CodeGen] Move printing MO_FPImmediate operands to MachineOperand::print

Work towards the unification of MIR and debug output by refactoring the
interfaces.

llvm-svn: 321110

6 years ago[CodeGen] Refactor printOffset from MO and MIRPrinter
Francis Visoiu Mistrih [Tue, 19 Dec 2017 21:46:55 +0000 (21:46 +0000)]
[CodeGen] Refactor printOffset from MO and MIRPrinter

llvm-svn: 321109

6 years ago[CGP] Format. NFC
Haicheng Wu [Tue, 19 Dec 2017 20:53:32 +0000 (20:53 +0000)]
[CGP] Format. NFC

Clang-format.

llvm-svn: 321107

6 years ago[clangd] Don't use the optional "severity" when comparing Diagnostic.
Haojian Wu [Tue, 19 Dec 2017 20:52:56 +0000 (20:52 +0000)]
[clangd] Don't use the optional "severity" when comparing Diagnostic.

Summary:
We use Diagnostic as a key to find the corresponding FixIt when we do
the "apply-fix", but the "severity" field could be omitted, in some cases,
the codeAction request sent from LSP clients (e.g. VScode) doesn't include the
`severity` field, which makes clangd fail to find the FixIt.

Test the following code in VScode, before the fix, no FixIt shown.

```
void main() {}
^~~~
```

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: klimek, ilya-biryukov, cfe-commits

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

llvm-svn: 321106

6 years ago[WebAssembly] Apply data relocations in parallel. NFC.
Sam Clegg [Tue, 19 Dec 2017 20:45:15 +0000 (20:45 +0000)]
[WebAssembly] Apply data relocations in parallel. NFC.

Store data relocations with their respective segment.
This allows relocations to be applied as each segment
is written (and therefore in parallel).

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

llvm-svn: 321105

6 years agoTargetLoweringBase: Fix darwinHasSinCos()
Matthias Braun [Tue, 19 Dec 2017 20:24:12 +0000 (20:24 +0000)]
TargetLoweringBase: Fix darwinHasSinCos()

Another followup to my refactoring in r321036: Turns out we can end up
with an x86 darwin target that is not macos (simulator triples can look
like i386-apple-ios) so we need the x86/32bit check in all cases.

llvm-svn: 321104

6 years ago[WebAssembly] Fix a couple of typos. NFC.
Sam Clegg [Tue, 19 Dec 2017 19:56:27 +0000 (19:56 +0000)]
[WebAssembly] Fix a couple of typos. NFC.

Also remove unneeded braces and old comment.

llvm-svn: 321103

6 years ago[driver][darwin] Set the 'simulator' environment when it's specified
Alex Lorenz [Tue, 19 Dec 2017 19:56:14 +0000 (19:56 +0000)]
[driver][darwin] Set the 'simulator' environment when it's specified
in '-target'

rdar://35742458

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

llvm-svn: 321102

6 years ago[dwarfdump][test] Add test case for r321064
Jonas Devlieghere [Tue, 19 Dec 2017 19:42:32 +0000 (19:42 +0000)]
[dwarfdump][test] Add test case for r321064

Verify that -lookup takes a 64-bit address.

llvm-svn: 321101

6 years ago[AMDGPU] Turn off MergeConsecutiveStores() before Instruction Selection for AMDGPU...
Mark Searles [Tue, 19 Dec 2017 19:26:23 +0000 (19:26 +0000)]
[AMDGPU] Turn off MergeConsecutiveStores() before Instruction Selection for AMDGPU. Commit dbbb6c5fc3642987430866dffdf710df4f616ac7 turned on MergeConsecutiveStores() before Instruction Selection for all targets. Enough AMDGPU compiles go into an infinite loop ( MergeConsecutiveStores() merges two stores; LegalizeStoreOps() un-merges; MergeConsecutiveStores() re-merges, etc. ) to warrant turning it off until the issues can be addressed.

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

llvm-svn: 321100

6 years ago[driver][darwin] Take the OS version specified in "-target" as the target
Alex Lorenz [Tue, 19 Dec 2017 19:05:04 +0000 (19:05 +0000)]
[driver][darwin] Take the OS version specified in "-target" as the target
OS instead of inferring it from SDK / environment

The OS version is specified in -target should be used instead of the one in an
environment variable / SDK name.

rdar://35813850

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

llvm-svn: 321099

6 years ago[SeparateConstOffsetFromGEP] Fix a typo. NFC.
Haicheng Wu [Tue, 19 Dec 2017 18:49:21 +0000 (18:49 +0000)]
[SeparateConstOffsetFromGEP] Fix a typo. NFC.

do CSE for to => do CSE to

llvm-svn: 321098

6 years ago[WebAssembly] Fix typo
Sam Clegg [Tue, 19 Dec 2017 18:36:31 +0000 (18:36 +0000)]
[WebAssembly] Fix typo

Patch by Nicholas Wilson

llvm-svn: 321097

6 years ago[WebAssembly] Remove used member from SymbolTable
Sam Clegg [Tue, 19 Dec 2017 18:32:13 +0000 (18:32 +0000)]
[WebAssembly] Remove used member from SymbolTable

Patch by Nicholas Wilson

llvm-svn: 321096

6 years agoTemporarily XFAIL test/functionalities/exec while investiagting bot breakage.
Adrian Prantl [Tue, 19 Dec 2017 18:21:28 +0000 (18:21 +0000)]
Temporarily XFAIL test/functionalities/exec while investiagting bot breakage.

When building with cmake on green gragon or on ci.swift.org, this test fails.

rdar://problem/36134350

llvm-svn: 321095

6 years ago[clangd] Supress a log warning by putting it behind a condition.
Eric Liu [Tue, 19 Dec 2017 18:10:32 +0000 (18:10 +0000)]
[clangd] Supress a log warning by putting it behind a condition.

llvm-svn: 321094

6 years ago[X86] Regenerate popcnt tests
Simon Pilgrim [Tue, 19 Dec 2017 18:05:13 +0000 (18:05 +0000)]
[X86] Regenerate popcnt tests

llvm-svn: 321093

6 years ago[clangd] Build dynamic index and use it for code completion.
Eric Liu [Tue, 19 Dec 2017 18:00:37 +0000 (18:00 +0000)]
[clangd] Build dynamic index and use it for code completion.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: klimek, ilya-biryukov, cfe-commits

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

llvm-svn: 321092

6 years ago[GlobalISel][Legalizer] Fix crash when trying to lower G_FNEG of fp128 types.
Amara Emerson [Tue, 19 Dec 2017 17:21:35 +0000 (17:21 +0000)]
[GlobalISel][Legalizer] Fix crash when trying to lower G_FNEG of fp128 types.

This doesn't add legalizer support, just prevents crashing so that we
can gracefully fall back to SDAG.

Fixes PR35690.

llvm-svn: 321091

6 years ago[clang] -foptimization-record-file= should imply -fsave-optimization-record
Jonas Devlieghere [Tue, 19 Dec 2017 17:16:45 +0000 (17:16 +0000)]
[clang] -foptimization-record-file= should imply -fsave-optimization-record

The Clang option -foptimization-record-file= controls which file an
optimization record is output to. Optimization records are output if you
use the Clang option -fsave-optimization-record. If you specify the
first option without the second, you get a warning that the command line
argument was unused. Passing -foptimization-record-file= should imply
-fsave-optimization-record.

This fixes PR33670

Patch by: Dmitry Venikov <venikov@phystech.edu>

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

llvm-svn: 321090

6 years ago[DAG] Elide overlapping store
Nirav Dave [Tue, 19 Dec 2017 17:10:56 +0000 (17:10 +0000)]
[DAG] Elide overlapping store

Summary:
Extend overlapping store elision to handle overwrites of stores by
larger stores.

Nontemporal tests have been modified to add memory dependencies to
prevent store elision.

Reviewers: craig.topper, rnk, t.p.northover

Subscribers: javed.absar, hiraditya, llvm-commits

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

llvm-svn: 321089

6 years ago[WebAssembly] Add support for writing out init functions in linking section
Sam Clegg [Tue, 19 Dec 2017 17:09:45 +0000 (17:09 +0000)]
[WebAssembly] Add support for writing out init functions in linking section

This change add support for init functions in the linking
section, but only in -r/--relocatable mode.

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

llvm-svn: 321088

6 years ago[clangd] Split findDefs/highlights into XRefs, from ClangdUnit. NFC
Sam McCall [Tue, 19 Dec 2017 17:06:07 +0000 (17:06 +0000)]
[clangd] Split findDefs/highlights into XRefs, from ClangdUnit. NFC

Going to add unit tests in the next patch. (Haha!) But seriously there's
some work to do first - need to extract the markers-in-source-code
parser from CodeComplete test and make it more flexible, to allow
annotated ranges etc.

llvm-svn: 321087

6 years ago[clangd] Fix warnings/compiler pickiness after r321083
Sam McCall [Tue, 19 Dec 2017 17:05:00 +0000 (17:05 +0000)]
[clangd] Fix warnings/compiler pickiness after r321083

llvm-svn: 321086

6 years ago[X86][AVX512] Attempt target shuffle combining to different types instead of early-out
Simon Pilgrim [Tue, 19 Dec 2017 16:54:07 +0000 (16:54 +0000)]
[X86][AVX512] Attempt target shuffle combining to different types instead of early-out

We try to prevent shuffle combining to value types that would stop the folding of masked operations, but by just returning early, we were failing to try different shuffle types.

The TODOs are all still relevant here to improve codegen but we're lacking test examples.

llvm-svn: 321085

6 years ago[CodeGen] Move printing MO_CFIIndex operands to MachineOperand::print
Francis Visoiu Mistrih [Tue, 19 Dec 2017 16:51:52 +0000 (16:51 +0000)]
[CodeGen] Move printing MO_CFIIndex operands to MachineOperand::print

Work towards the unification of MIR and debug output by refactoring the
interfaces.

Before this patch we printed "<call frame instruction>" in the debug
output.

llvm-svn: 321084

6 years ago[clangd] Index-based code completion.
Eric Liu [Tue, 19 Dec 2017 16:50:37 +0000 (16:50 +0000)]
[clangd] Index-based code completion.

Summary: Use symbol index to populate completion results for qualfified IDs e.g. "nx::A^".

Reviewers: ilya-biryukov, sammccall

Reviewed By: ilya-biryukov, sammccall

Subscribers: rwols, klimek, mgorny, cfe-commits, sammccall

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

llvm-svn: 321083

6 years agoAdd renamed .o files that were omitted by "git llvm push" command
Walter Lee [Tue, 19 Dec 2017 16:34:13 +0000 (16:34 +0000)]
Add renamed .o files that were omitted by "git llvm push" command

Original commit is at: https://reviews.llvm.org/D41295.

llvm-svn: 321082

6 years agoRemove unnecessary this->. NFC.
Rafael Espindola [Tue, 19 Dec 2017 16:29:02 +0000 (16:29 +0000)]
Remove unnecessary this->. NFC.

llvm-svn: 321081

6 years agoRename sparc-myriad-elf triplet to sparc-myriad-rtems
Walter Lee [Tue, 19 Dec 2017 16:19:11 +0000 (16:19 +0000)]
Rename sparc-myriad-elf triplet to sparc-myriad-rtems

Summary: This is to be consistent with latest Movidius MDK releases.
Also, don't inherit any gcc paths for shave triple.

Reviewers: jyknight

Subscribers: emaste, fedor.sergeev

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

llvm-svn: 321080

6 years ago[CFGVPrinter] Fix -dot-cfg-only
Francis Visoiu Mistrih [Tue, 19 Dec 2017 15:20:18 +0000 (15:20 +0000)]
[CFGVPrinter] Fix -dot-cfg-only

The refactoring in r281640 made -dot-cfg-only ignore the "-only" part.

llvm-svn: 321079

6 years ago[ThinLTO][C-API] Correct api comments
Ben Dunbobbin [Tue, 19 Dec 2017 14:49:33 +0000 (14:49 +0000)]
[ThinLTO][C-API] Correct api comments

Negative values never disabled the pruning - they simply set high values for the pruning interval.

The behaviour now is that negative values set the maximum pruning interval (which appears to have been the intention from the start) see https://reviews.llvm.org/D41231.

I have adjusted the comments to reflect this, removed any inaccurate statements, and corrected any typos I spotted in the English.

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

llvm-svn: 321078

6 years ago[Support][CachePruning] Disable cache pruning regression fix
Ben Dunbobbin [Tue, 19 Dec 2017 14:42:38 +0000 (14:42 +0000)]
[Support][CachePruning] Disable cache pruning regression fix

borked by: rL284966 (see: https://reviews.llvm.org/D25730).

Previously, Interval was unsigned (see: CachePruning.h), replacing the type with std::chrono::seconds (which is signed) causes a regression in behaviour because the c-api intends negative values to translate to large positive intervals to *effectively* disable the pruning (see comments on: setCachePruningInterval()).

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

llvm-svn: 321077

6 years ago[X86] Fix uninitialized variable sanitizer warning from rL321074
Simon Pilgrim [Tue, 19 Dec 2017 14:34:35 +0000 (14:34 +0000)]
[X86] Fix uninitialized variable sanitizer warning from rL321074

llvm-svn: 321076

6 years ago[InlineCost] Skip volatile loads when looking for repeated loads
Haicheng Wu [Tue, 19 Dec 2017 13:42:58 +0000 (13:42 +0000)]
[InlineCost] Skip volatile loads when looking for repeated loads

This is a follow-up fix of r320814.  A test case is also added.

llvm-svn: 321075

6 years ago[X86][SSE] Add cpu feature for aggressive combining to variable shuffles
Simon Pilgrim [Tue, 19 Dec 2017 13:16:43 +0000 (13:16 +0000)]
[X86][SSE] Add cpu feature for aggressive combining to variable shuffles

As mentioned in D38318 and D40865, modern Intel processors prefer to combine multiple shuffles to a variable shuffle mask (PSHUFB/VPERMPS etc.) instead of having multiple stage 'fixed' shuffles which put more pressure on Port 5 (at the expense of extra shuffle mask loads).

This patch provides a FeatureFastVariableShuffle target flag for Haswell+ CPUs that prefers combining 2 or more fixed shuffles to a single variable shuffle (default is 3 shuffles).

The long term aim is to drive more of this from schedule data (probably via the MC) but we're not close to being ready for that yet.

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

llvm-svn: 321074

6 years ago[clangd] Expose offset <-> LSP position functions, and fix bugs
Sam McCall [Tue, 19 Dec 2017 12:23:48 +0000 (12:23 +0000)]
[clangd] Expose offset <-> LSP position functions, and fix bugs

Summary:
- Moved these functions to SourceCode.h
- added unit tests
- fix off by one in positionToOffset: Offset - 1 in final calculation was wrong
- fixed formatOnType which had an equal and opposite off-by-one
- positionToOffset and offsetToPosition both consistently clamp to beginning/end
  of file when input is out of range
- gave variables more descriptive names
- removed windows line ending fixmes where there is nothing to fix
- elaborated on UTF-8 fixmes

This will conflict with Eric's D41281, but in a pretty easy-to-resolve way.

Reviewers: ioeric

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

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

llvm-svn: 321073

6 years ago[ARM] Register the Thumb2SizeReducePass. NFC
David Green [Tue, 19 Dec 2017 12:19:08 +0000 (12:19 +0000)]
[ARM] Register the Thumb2SizeReducePass. NFC

Also adds a simple test case.

llvm-svn: 321072

6 years ago[Support] Add WritableMemoryBuffer class
Pavel Labath [Tue, 19 Dec 2017 12:15:50 +0000 (12:15 +0000)]
[Support] Add WritableMemoryBuffer class

Summary:
The motivation here is LLDB, where we need to fixup relocations in
mmapped files before their contents can be read correctly.  The
MemoryBuffer class does exactly what we need, *except* that it maps the
file in read-only mode.

WritableMemoryBuffer reuses the existing machinery for opening and
mmapping a file. The only difference is in the argument to the
mapped_file_region constructor -- we create a private copy-on-write
mapping, so that we can make changes to the mapped data, but the changes
aren't carried over to the underlying file.

This patch is based on an initial version by Zachary Turner.

Reviewers: mehdi_amini, rnk, rafael, dblaikie, zturner

Subscribers: llvm-commits

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

llvm-svn: 321071

6 years ago[X86][SSE] Use (V)PHMINPOSUW for vXi8 SMAX/SMIN/UMAX/UMIN horizontal reductions ...
Simon Pilgrim [Tue, 19 Dec 2017 12:02:40 +0000 (12:02 +0000)]
[X86][SSE] Use (V)PHMINPOSUW for vXi8 SMAX/SMIN/UMAX/UMIN horizontal reductions (PR32841)

Extension to D39729 which performed this for vXi16, with the same bit flipping to handle SMAX/SMIN/UMAX cases, vXi8 UMIN horizontal reductions can be performed.

This makes use of the fact that by performing a pair-wise i8 SHUFFLE/UMIN before PHMINPOSUW, we both get the UMIN of each pair but also zero-extend the upper bits ready for v8i16.

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

llvm-svn: 321070