platform/upstream/llvm.git
6 years ago[X86] Remove zext from vXi32 to vXi64 on indices of gather/scatter instructions if...
Craig Topper [Wed, 20 Dec 2017 19:25:33 +0000 (19:25 +0000)]
[X86] Remove zext from vXi32 to vXi64 on indices of gather/scatter instructions if we can prove the pre-extended value is positive.

Gather/scatter can implicitly sign extend from i32->i64 on indices. So if we know the sign bit of the input to a zext is 0 we can use the implicit extension.

llvm-svn: 321209

6 years agoDAG: Tolerate non-MemSDNodes for OPC_RecordMemRef
Matt Arsenault [Wed, 20 Dec 2017 19:11:59 +0000 (19:11 +0000)]
DAG: Tolerate non-MemSDNodes for OPC_RecordMemRef

When intrinsics are allowed to have mem operands, there
are two ways this can happen. First is an intrinsic
that is marked has having a mem operand, but is not handled
by getTgtMemIntrinsic.

The second way can occur even for intrinsics which do not
have a mem operand. It seems the selector table does
some kind of sorting based on the opcode, and the
mem ref recording can happen in the same scope for
intrinsics that both do and do not have mem refs.
I haven't been able to figure out exactly why this happens
(although it happens even with the matcher optimizations disabled).
I'm not sure if it's worth trying to avoid hitting this for
these nodes since I think it's still reasonable to handle
this in case getTgtMemIntrinic is not implemented.

llvm-svn: 321208

6 years agoImprove the test for r320216. NFC.
Warren Ristow [Wed, 20 Dec 2017 19:11:31 +0000 (19:11 +0000)]
Improve the test for r320216.  NFC.

Patch by Matthew Voss!

llvm-svn: 321207

6 years ago[opt-viewer] Also demangle indirect-call promotion targets
Adam Nemet [Wed, 20 Dec 2017 19:08:12 +0000 (19:08 +0000)]
[opt-viewer] Also demangle indirect-call promotion targets

llvm-svn: 321206

6 years ago[PowerPC] Added an assert to make sure that the MBBI iterator is valid.
Stefan Pintilie [Wed, 20 Dec 2017 19:07:44 +0000 (19:07 +0000)]
[PowerPC] Added an assert to make sure that the MBBI iterator is valid.

The function createTailCallBranchInstr assumes that the iterator MBBI is valid.
However, only one use of MBBI is guarded in the function.
Fix this by adding an assert.

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

llvm-svn: 321205

6 years ago[DAG] Fix condition on overlapping store check.
Nirav Dave [Wed, 20 Dec 2017 19:06:47 +0000 (19:06 +0000)]
[DAG] Fix condition on overlapping store check.

Prevent overlapping store elision when overlapping store is
pre-inc/dec as analysis is wrong in these cases.

llvm-svn: 321204

6 years ago[hwasan] Implement -fsanitize-recover=hwaddress.
Evgeniy Stepanov [Wed, 20 Dec 2017 19:05:44 +0000 (19:05 +0000)]
[hwasan] Implement -fsanitize-recover=hwaddress.

Summary: Very similar to AddressSanitizer, with the exception of the error type encoding.

Reviewers: kcc, alekseyshl

Subscribers: cfe-commits, kubamracek, llvm-commits, hiraditya

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

llvm-svn: 321203

6 years ago[AMDGPU, AsmParser] Enable the mnemonic spell corrector.
Matt Arsenault [Wed, 20 Dec 2017 18:52:57 +0000 (18:52 +0000)]
[AMDGPU, AsmParser] Enable the mnemonic spell corrector.

Patch by Dmitry Venikov

llvm-svn: 321202

6 years agoAdd support for ObjectFormat to TargetSpecificAttr
Erich Keane [Wed, 20 Dec 2017 18:51:08 +0000 (18:51 +0000)]
Add support for ObjectFormat to TargetSpecificAttr

Looking through the code, I saw a FIXME on IFunc to switch it
to a target specific attribute. In looking through it, i saw that
the no-longer-appropriately-named TargetArch didn't support ObjectFormat
checking.

This patch changes the name of TargetArch to TargetSpecific
(since it checks much more than just Arch), makes "Arch" optional, adds
support for ObjectFormat, better documents the TargetSpecific type, and
changes IFunc over to a TargetSpecificAttr.

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

llvm-svn: 321201

6 years ago[X86] Implement the fusing of MUL+SUBADD to FMSUBADD
Craig Topper [Wed, 20 Dec 2017 18:05:15 +0000 (18:05 +0000)]
[X86] Implement the fusing of MUL+SUBADD to FMSUBADD

This patch turns shuffles of fadd/fsub with fmul into fmsubadd.

Patch by Dmitry Venikov

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

llvm-svn: 321200

6 years agoPass a InputFile reference to the Lazy constructor. NFC.
Rafael Espindola [Wed, 20 Dec 2017 18:01:32 +0000 (18:01 +0000)]
Pass a InputFile reference to the Lazy constructor. NFC.

llvm-svn: 321199

6 years agoUse a reference to a file in the LazyArchive symbol.
Rafael Espindola [Wed, 20 Dec 2017 17:59:43 +0000 (17:59 +0000)]
Use a reference to a file in the LazyArchive symbol.

It is never null.

llvm-svn: 321198

6 years ago[PGO] Function section hotness prefix should look at all blocks
Teresa Johnson [Wed, 20 Dec 2017 17:53:10 +0000 (17:53 +0000)]
[PGO] Function section hotness prefix should look at all blocks

Summary:
The function section prefix for PGO based layout (e.g. hot/unlikely)
should look at the hotness of all blocks not just the entry BB.
A function with a cold entry but a very hot loop should be placed in the
hot section, for example, so that it is located close to other hot
functions it may call. For SamplePGO it was already looking at the
branch weights on calls, and I made that code conditional on whether
this is SamplePGO since it was essentially a noop for instrumentation
PGO anyway.

Reviewers: davidxl

Subscribers: eraman, llvm-commits

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

llvm-svn: 321197

6 years agoLazyObject's file is never null, use a reference.
Rafael Espindola [Wed, 20 Dec 2017 17:52:36 +0000 (17:52 +0000)]
LazyObject's file is never null, use a reference.

llvm-svn: 321196

6 years agoUse a reference in addLazyArchive. NFC.
Rafael Espindola [Wed, 20 Dec 2017 17:48:28 +0000 (17:48 +0000)]
Use a reference in addLazyArchive. NFC.

llvm-svn: 321194

6 years ago[clangd] Pull CodeCompletionString handling logic into its own file and add unit...
Eric Liu [Wed, 20 Dec 2017 17:24:31 +0000 (17:24 +0000)]
[clangd] Pull CodeCompletionString handling logic into its own file and add unit test.

Reviewers: sammccall

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

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

llvm-svn: 321193

6 years ago[clangd] Remove an unused lambda capture.
Eric Liu [Wed, 20 Dec 2017 17:22:56 +0000 (17:22 +0000)]
[clangd] Remove an unused lambda capture.

llvm-svn: 321192

6 years ago[InstCombine] Add debug location to new caller.
Florian Hahn [Wed, 20 Dec 2017 17:16:59 +0000 (17:16 +0000)]
[InstCombine] Add debug location to new caller.

Reviewers: rnk, aprantl, majnemer

Reviewed By: aprantl

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

llvm-svn: 321191

6 years agoMake DiagnosticIDs::getAllDiagnostics use std::vector. NFC.
Gabor Horvath [Wed, 20 Dec 2017 16:55:41 +0000 (16:55 +0000)]
Make DiagnosticIDs::getAllDiagnostics use std::vector. NFC.

The size of the result vector is currently around 4600 with
Flavor::WarningOrError, which makes std::vector a better candidate than
llvm::SmallVector.

Patch by: Andras Leitereg!

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

llvm-svn: 321190

6 years ago[clang] Add BeforeExecute method to PrecompiledPreamble
Ilya Biryukov [Wed, 20 Dec 2017 16:48:56 +0000 (16:48 +0000)]
[clang] Add BeforeExecute method to PrecompiledPreamble

Summary: Adds BeforeExecute method to PrecompiledPreamble to be called
before Execute(). This method can be overriden.

Patch by William Enright.

Reviewers: malaperle, ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: arphaman, cfe-commits, ilya-biryukov

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

llvm-svn: 321189

6 years agoFix the definitions of 'reference' and 'pointer' in string_view that no one uses...
Marshall Clow [Wed, 20 Dec 2017 16:31:40 +0000 (16:31 +0000)]
Fix the definitions of 'reference' and 'pointer' in string_view that no one uses :-). Thanks to K-ballo for the catch.

llvm-svn: 321188

6 years agoUse a reference for the shared symbol file.
Rafael Espindola [Wed, 20 Dec 2017 16:28:19 +0000 (16:28 +0000)]
Use a reference for the shared symbol file.

Every shared symbol has a file, so we can use a reference.

llvm-svn: 321187

6 years agoUse a reference for a value that is never null. NFC.
Rafael Espindola [Wed, 20 Dec 2017 16:19:48 +0000 (16:19 +0000)]
Use a reference for a value that is never null. NFC.

llvm-svn: 321186

6 years agoUse a reference for a value that is never null. NFC.
Rafael Espindola [Wed, 20 Dec 2017 16:16:40 +0000 (16:16 +0000)]
Use a reference for a value that is never null. NFC.

llvm-svn: 321185

6 years ago[clangd] Switch xrefs and documenthighlight to annotated-code unit tests. NFC
Sam McCall [Wed, 20 Dec 2017 16:06:05 +0000 (16:06 +0000)]
[clangd] Switch xrefs and documenthighlight to annotated-code unit tests. NFC

Summary:
The goal here is again to make it easier to read and write the tests.

I've extracted `parseTextMarker` from CodeCompleteTests into an `Annotations`
class, adding features to it:
  - as well as points `^s` it allows ranges `[[...]]`
  - multiple points and ranges are supported
  - points and ranges may be named: `$name^` and `$name[[...]]`

These features are used for the xrefs tests. This also paves the way for
replacing the lit diagnostics.test with more readable unit tests, using named
ranges.

Alternative considered: `TestSelectionRange` in clang-refactor/TestSupport
Main problems were:
 - delimiting the end of ranges is awkward, requiring counting
 - comment syntax is long and at least as cryptic for most cases
 - no separate syntax for point vs range, which keeps xrefs tests concise
 - Still need to convert to Position everywhere
 - Still need helpers for common case of expecting exactly one point/range

(I'll probably promote the extra `PrintTo`s from some of the core Protocol types
into `operator<<` in `Protocol.h` itself in a separate, prior patch...)

Reviewers: ioeric

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

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

llvm-svn: 321184

6 years ago[Complex] Don't use __div?c3 when building with fast-math.
Florian Hahn [Wed, 20 Dec 2017 15:50:52 +0000 (15:50 +0000)]
[Complex] Don't use __div?c3 when building with fast-math.

Summary: Plant an inline version of "((ac+bd)/(cc+dd)) + i((bc-ad)/(cc+dd))" instead.

Patch by Paul Walker.

Reviewed By: hfinkel

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

llvm-svn: 321183

6 years ago[JumpTables] Let targets decide which switch instructions are suitable
Nemanja Ivanovic [Wed, 20 Dec 2017 15:44:32 +0000 (15:44 +0000)]
[JumpTables] Let targets decide which switch instructions are suitable

This commits the non-controversial part of https://reviews.llvm.org/D41029
(making the queries virtual). The PPC-specific portion of this will be
committed in a subsequent patch once some of the finer points are ironed out.

llvm-svn: 321182

6 years agoRevert r320548:[SLP] Vectorize jumbled memory loads
Mohammad Shahid [Wed, 20 Dec 2017 15:26:59 +0000 (15:26 +0000)]
Revert r320548:[SLP] Vectorize jumbled memory loads

llvm-svn: 321181

6 years agoAdd optional SelectionDAG* parameter to SValue::dump and SDValue::dumpr
Krzysztof Parzyszek [Wed, 20 Dec 2017 15:15:04 +0000 (15:15 +0000)]
Add optional SelectionDAG* parameter to SValue::dump and SDValue::dumpr

These functions simply call their counterparts in the associated SDNode,
which do take an optional SelectionDAG. This change makes the legalization
debug trace a little easier to read, since target-specific nodes will
now have their names shown instead of "Unknown node #123".

llvm-svn: 321180

6 years ago[SCEV] Fix Typo. NFC.
Javed Absar [Wed, 20 Dec 2017 15:06:26 +0000 (15:06 +0000)]
[SCEV] Fix Typo. NFC.

llvm-svn: 321179

6 years ago[NVPTX] Initial adaptation of MCAsmStreamer/MCTargetStreamer for debug info in Cuda.
Alexey Bataev [Wed, 20 Dec 2017 14:55:10 +0000 (14:55 +0000)]
[NVPTX] Initial adaptation of MCAsmStreamer/MCTargetStreamer for debug info in Cuda.

Summary:
Initial changes in interfaces of MCAsmStreamer/MCTargetStreamer for
correct debug info emission for Cuda.
1. PTX foramt does not support `.ascii` directives. Added the ability to
nullify it.
2. The initial function label must follow the first debug `.loc`
directive, not be followed by.
3. DWARF sections must be enclosed in braces.

Reviewers: hfinkel, probinson, jlebar, rafael, echristo

Subscribers: sdardis, nemanjai, llvm-commits, aprantl

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

llvm-svn: 321178

6 years ago[Hexagon] Adjust the value type for BCvt in LowerFormalArguments
Krzysztof Parzyszek [Wed, 20 Dec 2017 14:44:05 +0000 (14:44 +0000)]
[Hexagon] Adjust the value type for BCvt in LowerFormalArguments

llvm-svn: 321177

6 years ago[globalisel][tablegen] Allow ImmLeaf predicates to use InstructionSelector members
Daniel Sanders [Wed, 20 Dec 2017 14:41:51 +0000 (14:41 +0000)]
[globalisel][tablegen] Allow ImmLeaf predicates to use InstructionSelector members

NFC for currently supported targets. This resolves a problem encountered by
targets such as RISCV that reference `Subtarget` in ImmLeaf predicates.

llvm-svn: 321176

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