platform/upstream/llvm.git
6 years ago[lit] Fix a bug where UNRESOLVED tests were not handled in the XUnit
Dan Liew [Fri, 20 Apr 2018 10:11:41 +0000 (10:11 +0000)]
[lit] Fix a bug where UNRESOLVED tests were not handled in the XUnit
XML printer.

A test has been added that tries to comprehensively test emitting
XUnit XML output for shell tests.

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

llvm-svn: 330409

6 years agoFix -Wunused-variable warnings after r330377.
Andrea Di Biagio [Fri, 20 Apr 2018 09:47:03 +0000 (09:47 +0000)]
Fix -Wunused-variable warnings after r330377.

llvm-svn: 330408

6 years ago[AArch64][SVE] Fix diagnostic for SVE LD4 instructions:
Sander de Smalen [Fri, 20 Apr 2018 09:45:50 +0000 (09:45 +0000)]
[AArch64][SVE] Fix diagnostic for SVE LD4 instructions:

Diagnostic:
  'index must be multiple of 3 in range [-32, 28]'

Must be:
  'index must be multiple of 4 in range [-32, 28]'

llvm-svn: 330407

6 years ago[AArch64][SVE] Added GPR64shifted and GPR64NoXZRshifted register classes.
Sander de Smalen [Fri, 20 Apr 2018 08:54:49 +0000 (08:54 +0000)]
[AArch64][SVE] Added GPR64shifted and GPR64NoXZRshifted register classes.

Summary:
This is patch [3/4] in a series to add assembler/disassembler support for
SVE's contiguous LD1 (scalar+scalar) instructions:
- Patch [1/4]: https://reviews.llvm.org/D45687
- Patch [2/4]: https://reviews.llvm.org/D45688
- Patch [3/4]: https://reviews.llvm.org/D45689
- Patch [4/4]: https://reviews.llvm.org/D45690

Reviewers: fhahn, rengolin, javed.absar, huntergr, SjoerdMeijer, t.p.northover, echristo, evandro

Reviewed By: SjoerdMeijer

Subscribers: tschuett, kristof.beyls, llvm-commits

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

llvm-svn: 330406

6 years agoMove FileSpecTest to Utility
Pavel Labath [Fri, 20 Apr 2018 08:27:27 +0000 (08:27 +0000)]
Move FileSpecTest to Utility

FileSpec class was moved to the Utility module a while ago, but the test
file was left behind. This corrects that.

llvm-svn: 330405

6 years ago[OpenCL] Add 'denorms-are-zero' function attribute
Alexey Sotkin [Fri, 20 Apr 2018 08:08:04 +0000 (08:08 +0000)]
[OpenCL] Add 'denorms-are-zero' function attribute

Summary:
Generate attribute 'denorms-are-zero'='true' if '-cl-denorms-are-zero'
compile option was specified and 'denorms-are-zero'='false' otherwise.

Patch by krisb

Reviewers: Anastasia, yaxunl

Reviewed By:  yaxunl

Subscribers: cfe-commits

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

llvm-svn: 330404

6 years agoReapply "[PR16756] Use SSAUpdaterBulk in JumpThreading." one more time.
Michael Zolotukhin [Fri, 20 Apr 2018 08:01:08 +0000 (08:01 +0000)]
Reapply "[PR16756] Use SSAUpdaterBulk in JumpThreading." one more time.

Hopefully, changing set to vector removes nondeterminism detected by
some bots, or the new assert will catch something.

This reverts commit r330180.

llvm-svn: 330403

6 years ago[SSAUpdaterBulk] Add an assert.
Michael Zolotukhin [Fri, 20 Apr 2018 07:59:57 +0000 (07:59 +0000)]
[SSAUpdaterBulk] Add an assert.

llvm-svn: 330402

6 years agoAdd SPARC support to update_llc_test_checks.py
Daniel Cederman [Fri, 20 Apr 2018 07:59:13 +0000 (07:59 +0000)]
Add SPARC support to update_llc_test_checks.py

Reviewers: spatel, jyknight

Reviewed By: spatel

Subscribers: fedor.sergeev, llvm-commits

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

llvm-svn: 330401

6 years ago[SSAUpdaterBulk] Add * and & to auto.
Michael Zolotukhin [Fri, 20 Apr 2018 07:58:54 +0000 (07:58 +0000)]
[SSAUpdaterBulk] Add * and & to auto.

llvm-svn: 330400

6 years ago[SSAUpdaterBulk] Use PredCache in ComputeLiveInBlocks.
Michael Zolotukhin [Fri, 20 Apr 2018 07:57:24 +0000 (07:57 +0000)]
[SSAUpdaterBulk] Use PredCache in ComputeLiveInBlocks.

llvm-svn: 330399

6 years ago[SSAUpdaterBulk] Use SmallVector instead of SmallPtrSet for uses.
Michael Zolotukhin [Fri, 20 Apr 2018 07:56:00 +0000 (07:56 +0000)]
[SSAUpdaterBulk] Use SmallVector instead of SmallPtrSet for uses.

llvm-svn: 330398

6 years agoRevert "This pass, fixing an erratum in some LEON 2 processors..."
Daniel Cederman [Fri, 20 Apr 2018 07:53:27 +0000 (07:53 +0000)]
Revert "This pass, fixing an erratum in some LEON 2 processors..."

Summary:
Reading Atmel's AT697E errata document this does not seem like a valid
workaround. While the text only mentions SDIV, it says that the ICC flags
can be wrong, and those are only generated by SDIVcc. Verification on
hardware shows that simply replacing SDIV with SDIVcc does not avoid
the bug with negative operands.

This reverts r283727.

Reviewers: lero_chris, jyknight

Reviewed By: jyknight

Subscribers: fedor.sergeev, jrtc27, llvm-commits

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

llvm-svn: 330397

6 years ago[Sparc] Use synthetic instruction clr to zero register instead of sethi
Daniel Cederman [Fri, 20 Apr 2018 07:47:12 +0000 (07:47 +0000)]
[Sparc] Use synthetic instruction clr to zero register instead of sethi

Using `clr reg`/`mov %g0, reg`/`or %g0, %g0, reg` to zero a register
looks much better than `sethi 0, reg`.

Reviewers: jyknight, venkatra

Reviewed By: jyknight

Subscribers: eraman, fedor.sergeev, jrtc27, llvm-commits

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

llvm-svn: 330396

6 years agoRevert r330376 "[sanitizer] Generalize atomic_uint8_t, atomic_uint16_t, ... into...
Hans Wennborg [Fri, 20 Apr 2018 07:34:59 +0000 (07:34 +0000)]
Revert r330376 "[sanitizer] Generalize atomic_uint8_t, atomic_uint16_t, ... into a template. NFC."

This broke the Windows build, see e.g. http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/10130

> Differential Revision: https://reviews.llvm.org/D44246

llvm-svn: 330395

6 years ago[AArch64][AsmParser] Extend RegOp with integrated 'shift/extend'.
Sander de Smalen [Fri, 20 Apr 2018 07:24:20 +0000 (07:24 +0000)]
[AArch64][AsmParser] Extend RegOp with integrated 'shift/extend'.

Summary:
In some cases the shift/extend needs to be explicitly parsed together
with the register, rather than as a separate operand. This is needed
for addressing modes where the instruction as a whole dictates the
scaling/extend, rather than specific bits in the instruction.
By parsing them as a single operand, we avoid the need to pass an
extra operand in all CodeGen patterns (because all operands need to
have an associated value), and we avoid the need to update TableGen to
accept operands that have no associated bits in the instruction.

An added benefit of parsing them together is that the assembler
can give a sensible diagnostic if the scaling is not correct.

This is patch [2/4] in a series to add assembler/disassembler support for
SVE's contiguous LD1 (scalar+scalar) instructions:
- Patch [1/4]: https://reviews.llvm.org/D45687
- Patch [2/4]: https://reviews.llvm.org/D45688
- Patch [3/4]: https://reviews.llvm.org/D45689
- Patch [4/4]: https://reviews.llvm.org/D45690

Reviewers: fhahn, rengolin, javed.absar, huntergr, SjoerdMeijer, t.p.northover, echristo, evandro

Reviewed By: fhahn, SjoerdMeijer

Subscribers: kristof.beyls, llvm-commits

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

llvm-svn: 330394

6 years agoAMDGPU: Legalize the operand of SI_INIT_M0
Nicolai Haehnle [Fri, 20 Apr 2018 07:14:25 +0000 (07:14 +0000)]
AMDGPU: Legalize the operand of SI_INIT_M0

Summary:
This fixes a case where the argument to a sendmsg intrinsic
ends up in a VGPR, for whatever reason.

The underlying performance issue is that a multiplication that
can be an s_mul_i32 is instead needlessly generated as
v_mul_u32_u24, but this is not addressed by this patch.

Change-Id: I61fd4034314d5acdf6074632c30b65364dfa7328

Reviewers: arsenm, rampitec

Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits

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

llvm-svn: 330393

6 years ago[Sparc] Fix addressing mode when using 64-bit values in inline assembly
Daniel Cederman [Fri, 20 Apr 2018 06:57:49 +0000 (06:57 +0000)]
[Sparc] Fix addressing mode when using 64-bit values in inline assembly

Summary:
If a 64-bit register is used as an operand in inline assembly together
with a memory reference, the memory addressing will be wrong. The
addressing will be a single reg, instead of reg+reg or reg+imm. This
will generate a bad offset value or an exception in printMemOperand().

For example:

```
long long int val = 5;
long long int mem;
__asm__ volatile ("std %1, %0":"=m"(mem):"r"(val));
```
becomes:

```
std %i0, [%i2+589833]
```

The problem is that SelectInlineAsmMemoryOperand() is never called for
the memory references if one of the operands is a 64-bit register.
By calling SelectInlineAsmMemoryOperands() in tryInlineAsm() the Sparc
version of  SelectInlineAsmMemoryOperand() gets called for each memory
reference.

Reviewers: jyknight, venkatra

Reviewed By: jyknight

Subscribers: eraman, fedor.sergeev, jrtc27, llvm-commits

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

llvm-svn: 330392

6 years ago[LibFuzzer] Report when custom counters are available.
Dan Liew [Fri, 20 Apr 2018 06:46:19 +0000 (06:46 +0000)]
[LibFuzzer] Report when custom counters are available.

This upstreams a feature from the JFS solver's fork of LibFuzzer.

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

llvm-svn: 330391

6 years ago[LibFuzzer] Try to unbreak the `FuzzerMutate.ShuffleBytes1` unit test.
Dan Liew [Fri, 20 Apr 2018 06:46:14 +0000 (06:46 +0000)]
[LibFuzzer] Try to unbreak the `FuzzerMutate.ShuffleBytes1` unit test.

This test is failing on my Linux box. Just increasing the number of
iterations works around this. The divergence is likely due to
our reliance on `std::shuffle()` which is not guaranteed to have
the same behaviour across platforms.

This is a strong argument for us to implement our own shuffle
function to avoid divergence in behaviour across platforms.

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

llvm-svn: 330390

6 years ago[LibFuzzer] Unbreak the `trace-malloc-unbalanced.test` when using Python 3.
Dan Liew [Fri, 20 Apr 2018 06:46:09 +0000 (06:46 +0000)]
[LibFuzzer] Unbreak the `trace-malloc-unbalanced.test` when using Python 3.

The `unbalanced_allocs.py` script uses Python 2 print statement
and `iteritems()`. Running `2to3` over the script fixes these.

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

llvm-svn: 330389

6 years agoFix build failures for r330387 on buildbots that don't build the X86 target
Vlad Tsyrklevich [Fri, 20 Apr 2018 02:26:12 +0000 (02:26 +0000)]
Fix build failures for r330387 on buildbots that don't build the X86 target

llvm-svn: 330388

6 years agoLowerTypeTests: Propagate symver directives
Vlad Tsyrklevich [Fri, 20 Apr 2018 01:36:48 +0000 (01:36 +0000)]
LowerTypeTests: Propagate symver directives

Summary:
This change fixes https://crbug.com/834474, a build failure caused by
LowerTypeTests not preserving .symver symbol versioning directives for
exported functions. Emit symver information to ThinLTO summary data and
then propagate symver directives for exported functions to the merged
module.

Emitting symver information to the summaries increases the size of
intermediate build artifacts for a Chromium build by less than 0.2%.

Reviewers: pcc

Reviewed By: pcc

Subscribers: tejohnson, mehdi_amini, eraman, llvm-commits, eugenis, kcc

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

llvm-svn: 330387

6 years agoFix trap instruction on pp64.
Rafael Espindola [Fri, 20 Apr 2018 01:21:24 +0000 (01:21 +0000)]
Fix trap instruction on pp64.

The test was passing on a big endian host, but just because od with x4
was compensating for it.

llvm-svn: 330386

6 years ago[DWARFASTParserClang] Remove dead code. NFCI.
Davide Italiano [Fri, 20 Apr 2018 00:44:33 +0000 (00:44 +0000)]
[DWARFASTParserClang] Remove dead code. NFCI.

llvm-svn: 330385

6 years agoMove a dump() implementation out of line.
Amara Emerson [Fri, 20 Apr 2018 00:42:46 +0000 (00:42 +0000)]
Move a dump() implementation out of line.

Fixes some link issues.

llvm-svn: 330384

6 years ago[Fuzzer] Add a missing header in Fuchsia implementation
Petr Hosek [Fri, 20 Apr 2018 00:41:06 +0000 (00:41 +0000)]
[Fuzzer] Add a missing header in Fuchsia implementation

This is needed for fd_set.

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

llvm-svn: 330383

6 years ago[CFG] [analyzer] Add construction contexts for loop condition variables.
Artem Dergachev [Thu, 19 Apr 2018 23:30:15 +0000 (23:30 +0000)]
[CFG] [analyzer] Add construction contexts for loop condition variables.

Loop condition variables, eg.

  while (shared_ptr<int> P = getIntPtr()) { ... })

weren't handled in r324794 because they don't go through the common
CFGBuilder::VisitDeclStmt method. Which means that they regressed
after r324800.

Fix the regression by duplicating the necessary construction context scan in
the loop visiting code.

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

llvm-svn: 330382

6 years ago[analyzer] When we fail to evaluate a pointer cast, escape the pointer.
Artem Dergachev [Thu, 19 Apr 2018 23:24:32 +0000 (23:24 +0000)]
[analyzer] When we fail to evaluate a pointer cast, escape the pointer.

If a pointer cast fails (evaluates to an UnknownVal, i.e. not implemented in the
analyzer) and such cast is in fact the last use of the pointer, the pointer
symbol is no longer referenced by the program state and a leak is
(mis-)diagnosed.

"Escape" the pointer upon a failed cast, i.e. inform the checker that we can no
longer reliably track it.

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

llvm-svn: 330380

6 years ago[ELF] Increase NextGroupId with --end-group
Fangrui Song [Thu, 19 Apr 2018 23:23:23 +0000 (23:23 +0000)]
[ELF] Increase NextGroupId with --end-group

Reviewers: ruiu, espindola

Subscribers: emaste, arichardson, llvm-commits

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

llvm-svn: 330379

6 years agoImplement proper support for `-falign-functions`
Saleem Abdulrasool [Thu, 19 Apr 2018 23:14:57 +0000 (23:14 +0000)]
Implement proper support for `-falign-functions`

This implements support for the previously ignored flag
`-falign-functions`.  This allows the frontend to request alignment on
function definitions in the translation unit where they are not
explicitly requested in code.  This is compatible with the GCC behaviour
and the ICC behaviour.

The scalar value passed to `-falign-functions` aligns functions to a
power-of-two boundary.  If flag is used, the functions are aligned to
16-byte boundaries.  If the scalar is specified, it must be an integer
less than or equal to 4096.  If the value is not a power-of-two, the
driver will round it up to the nearest power of two.

llvm-svn: 330378

6 years ago[CFG] [analyzer] Don't treat argument constructors as temporary constructors.
Artem Dergachev [Thu, 19 Apr 2018 23:09:22 +0000 (23:09 +0000)]
[CFG] [analyzer] Don't treat argument constructors as temporary constructors.

Function argument constructors (that are used for passing objects into functions
by value) are completely unlike temporary object constructors, but we were
treating them as such because they are also wrapped into a CXXBindTemporaryExpr.

This patch adds a partial construction context layer for call argument values,
but doesn't proceed to transform it into an actual construction context yet.
This is tells the clients that we aren't supporting these constructors yet.

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

llvm-svn: 330377

6 years ago[sanitizer] Generalize atomic_uint8_t, atomic_uint16_t, ... into a template. NFC.
Kuba Mracek [Thu, 19 Apr 2018 23:00:43 +0000 (23:00 +0000)]
[sanitizer] Generalize atomic_uint8_t, atomic_uint16_t, ... into a template. NFC.

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

llvm-svn: 330376

6 years ago[analyzer] RetainCount: Accept more "safe" CFRetain wrappers.
Artem Dergachev [Thu, 19 Apr 2018 23:00:22 +0000 (23:00 +0000)]
[analyzer] RetainCount: Accept more "safe" CFRetain wrappers.

r315736 added support for the misplaced CF_RETURNS_RETAINED annotation on
CFRetain() wrappers. It works by trusting the function's name (seeing if it
confirms to the CoreFoundation naming convention) rather than the annotation.

There are more false positives caused by users using a different naming
convention, namely starting the function name with "retain" or "release"
rather than suffixing it with "retain" or "release" respectively.

Because this isn't according to the naming convention, these functions
are usually inlined and the annotation is therefore ignored, which is correct.
But sometimes we run out of inlining stack depth and the function is
evaluated conservatively and then the annotation is trusted.

Add support for the "alternative" naming convention and test the situation when
we're running out of inlining stack depth.

rdar://problem/18270122

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

llvm-svn: 330375

6 years ago[WebAssembly] Fix bug where reloc addends were written as unsigned
Sam Clegg [Thu, 19 Apr 2018 22:48:03 +0000 (22:48 +0000)]
[WebAssembly] Fix bug where reloc addends were written as unsigned

Relocation addends can be negative so should be written as
signed LEBs. This bug meant that writing value between 64
and 128 would be incorrectly interpreted as negative by the
object file readers.

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

llvm-svn: 330374

6 years ago[MachineOutliner] NFC: Move EnableLinkOnceODROutlining into MachineOutliner.cpp
Jessica Paquette [Thu, 19 Apr 2018 22:17:07 +0000 (22:17 +0000)]
[MachineOutliner] NFC: Move EnableLinkOnceODROutlining into MachineOutliner.cpp

This moves the EnableLinkOnceODROutlining flag from TargetPassConfig.cpp into
MachineOutliner.cpp. It also removes OutlineFromLinkOnceODRs from the
MachineOutliner constructor. This is now handled by the moved command-line
flag.

llvm-svn: 330373

6 years agoDon't do aligned allocations on MSVCRT before 19.12 (update 15.3)
Reid Kleckner [Thu, 19 Apr 2018 22:12:10 +0000 (22:12 +0000)]
Don't do aligned allocations on MSVCRT before 19.12 (update 15.3)

Reviewers: EricWF, pcc

Subscribers: christof, cfe-commits

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

llvm-svn: 330372

6 years ago[llvm-mca][X86] Add prefetch instruction resource tests
Simon Pilgrim [Thu, 19 Apr 2018 22:11:58 +0000 (22:11 +0000)]
[llvm-mca][X86] Add prefetch instruction resource tests

llvm-svn: 330371

6 years ago[WebAssembly] Enabled -triple=wasm32-unknown-unknown-wasm path using ELF directive...
Sam Clegg [Thu, 19 Apr 2018 22:00:53 +0000 (22:00 +0000)]
[WebAssembly] Enabled -triple=wasm32-unknown-unknown-wasm path using ELF directive parser.

This is a temporary solution until a proper WASM implementation of
MCAsmParserExtension is in place, but at least for now will unblock this
path.

Added test to make sure this path works with the WASM Assembler.

Patch By Wouter van Oortmerssen!

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

llvm-svn: 330370

6 years agoAdd a test. NFC.
Rafael Espindola [Thu, 19 Apr 2018 21:58:28 +0000 (21:58 +0000)]
Add a test. NFC.

We have relatively few tests on the contents of non alloc
sections. This one would have found a bug in a patch I am working on.

llvm-svn: 330369

6 years ago[Reassociate] add baseline tests for binop swapping; NFC
Sanjay Patel [Thu, 19 Apr 2018 21:56:17 +0000 (21:56 +0000)]
[Reassociate] add baseline tests for binop swapping; NFC

Similar to rL330086, I don't know if we want to do these
transforms here, but we might as well have the tests
here either way to show that this pass is missing
potential functionality (intentionally or not).

llvm-svn: 330368

6 years agoCOFF: Remove OutputSection::getPermissions() and getCharacteristics().
Peter Collingbourne [Thu, 19 Apr 2018 21:48:37 +0000 (21:48 +0000)]
COFF: Remove OutputSection::getPermissions() and getCharacteristics().

All callers can just access the header directly.

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

llvm-svn: 330367

6 years ago[llvm-mca][FMA] Add FMA resource tests
Simon Pilgrim [Thu, 19 Apr 2018 21:32:22 +0000 (21:32 +0000)]
[llvm-mca][FMA] Add FMA resource tests

llvm-svn: 330366

6 years ago[AMDGPU] Use packed literals with zero either lower or hi part
Stanislav Mekhanoshin [Thu, 19 Apr 2018 21:16:50 +0000 (21:16 +0000)]
[AMDGPU] Use packed literals with zero either lower or hi part

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

llvm-svn: 330365

6 years ago[llvm-objdump] Issue error message when object file cannot be created
Gerolf Hoflehner [Thu, 19 Apr 2018 20:48:35 +0000 (20:48 +0000)]
[llvm-objdump] Issue error message when object file cannot be created

llvm-svn: 330364

6 years ago[X86] Remove non-existant instruction name from X86DisassemblerTables.cpp.
Craig Topper [Thu, 19 Apr 2018 20:44:15 +0000 (20:44 +0000)]
[X86] Remove non-existant instruction name from X86DisassemblerTables.cpp.

This instruction was removed a long time so we don't need to check for it here.

llvm-svn: 330363

6 years agoRefine the loop rotation's API
Jin Lin [Thu, 19 Apr 2018 20:29:43 +0000 (20:29 +0000)]
Refine the loop rotation's API

Summary:
The following changes addresses the following two issues.

1) The existing loop rotation pass contains both loop latch simplification and loop rotation. So one flag RotationOnly is added to be passed to the loop rotation pass.
2) The threshold value is initialized with MAX_UINT since the loop rotation utility should not have threshold limit.

Reviewers: dmgreen, efriedma

Reviewed By: efriedma

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

llvm-svn: 330362

6 years agoCOFF: Rename Chunk::getPermissions to getOutputCharacteristics.
Peter Collingbourne [Thu, 19 Apr 2018 20:03:24 +0000 (20:03 +0000)]
COFF: Rename Chunk::getPermissions to getOutputCharacteristics.

In an upcoming change I will need to make a distinction between section
type (code, data, bss) and permissions. The term that I use for both
of these things is "output characteristics".

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

llvm-svn: 330361

6 years agoRemove impossible _MSC_VER check
Reid Kleckner [Thu, 19 Apr 2018 19:40:12 +0000 (19:40 +0000)]
Remove impossible _MSC_VER check

Summary:
It is immediately preceded by this check:
  #if _MSC_VER < 1900
  #error "MSVC versions prior to Visual Studio 2015 are not supported"
  #endif

Reviewers: EricWF

Subscribers: christof, cfe-commits

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

llvm-svn: 330360

6 years ago[ORC] Fix an assertion condition from r329934.
Lang Hames [Thu, 19 Apr 2018 19:30:35 +0000 (19:30 +0000)]
[ORC] Fix an assertion condition from r329934.

Thanks to Alexander Ivchenko for finding the issue!

llvm-svn: 330359

6 years ago[X86] Enable popcnt false dependency breaking on Silvermont and Goldmont.
Craig Topper [Thu, 19 Apr 2018 19:25:24 +0000 (19:25 +0000)]
[X86] Enable popcnt false dependency breaking on Silvermont and Goldmont.

Silvermont and Goldmont have the same issue on popcnt as Sandy Bridge, Haswell, Broadwell, and Skylake. Believe it is fixed in Goldmont Plus.

llvm-svn: 330358

6 years ago[PM/LoopUnswitch] Detect irreducible control flow within loops and skip unswitching...
Chandler Carruth [Thu, 19 Apr 2018 18:44:25 +0000 (18:44 +0000)]
[PM/LoopUnswitch] Detect irreducible control flow within loops and skip unswitching non-trivial edges.

Summary:
This fixes the bug pointed out in review with non-trivial unswitching.

This also provides a basis that should make it pretty easy to finish
fleshing out a routine to scan an entire function body for irreducible
control flow, but this patch remains minimal for disabling loop
unswitch.

Reviewers: sanjoy, fedor.sergeev

Subscribers: mcrosier, hiraditya, llvm-commits

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

llvm-svn: 330357

6 years ago[ORC] Make VSO symbol resolution/finalization operations private.
Lang Hames [Thu, 19 Apr 2018 18:42:49 +0000 (18:42 +0000)]
[ORC] Make VSO symbol resolution/finalization operations private.

This forces these operations to be carried out via a
MaterializationResponsibility instance, ensuring responsibility is explicitly
tracked.

llvm-svn: 330356

6 years ago[sanitizer] Minor refactor of some ReservedAddressRange functions
Kostya Kortchinsky [Thu, 19 Apr 2018 18:38:15 +0000 (18:38 +0000)]
[sanitizer] Minor refactor of some ReservedAddressRange functions

Summary:
Some of the functions had spurious conditional statements and checks, and some
intermediary variables that I feel made the code more complicated than it needs
to be. Also, when unmapping the whole range, the range size would be 0, but
the base was set to the address of the end of the range, which sounds prone to
error. I think nulling out the base in this scenario is a better way to go.

Reviewers: alekseyshl, flowerhack

Reviewed By: alekseyshl

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

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

llvm-svn: 330355

6 years agoFix narrowing warning by appending `f` to literal constant.
Adrian McCarthy [Thu, 19 Apr 2018 18:31:57 +0000 (18:31 +0000)]
Fix narrowing warning by appending `f` to literal constant.

llvm-svn: 330354

6 years ago[UnitTests] NFC/build-perf: Break up nontrivial compile jobs
David Zarzycki [Thu, 19 Apr 2018 18:19:02 +0000 (18:19 +0000)]
[UnitTests] NFC/build-perf: Break up nontrivial compile jobs

RecursiveASTVisitorTest.cpp is one of the longest compile jobs and a
build bottleneck on many-core machines. This patch breaks that file and
some peer files up into smaller files to increase build concurrency and
overall rebuild performance.

llvm-svn: 330353

6 years ago[llvm-mca][X86] Add resource test for every out-of-order scheduler model
Simon Pilgrim [Thu, 19 Apr 2018 18:08:10 +0000 (18:08 +0000)]
[llvm-mca][X86] Add resource test for every out-of-order scheduler model

I've copied and regenerated a resource file from btver2 to every x86 scheduler model supported by llvm-mca so we have at least some basic coverage.

For most this has been the avx1 tests, but for silvermont I've used sse42 as thats the latest it supports.

More will be added later.

llvm-svn: 330352

6 years ago[X86][SLM] Fix typo using SandyBridge resources.
Simon Pilgrim [Thu, 19 Apr 2018 18:01:52 +0000 (18:01 +0000)]
[X86][SLM] Fix typo using SandyBridge resources.

Luckily this was on instructions not supported on Silvermont....

llvm-svn: 330351

6 years agoDefine InputSection::getOffset inline.
Rafael Espindola [Thu, 19 Apr 2018 18:00:46 +0000 (18:00 +0000)]
Define InputSection::getOffset inline.

This is much simpler than the other section types and there are many
places where the section type is statically know.

llvm-svn: 330350

6 years ago[X86] Correct the scheduling data for register forms of XCHG and XADD on Intel CPUs.
Craig Topper [Thu, 19 Apr 2018 18:00:17 +0000 (18:00 +0000)]
[X86] Correct the scheduling data for register forms of XCHG and XADD on Intel CPUs.

The XCHG16rr/XCHG32rr/XCHG64rr instructions should be 3 uops just like XCHG8rr. I believe they're just implemented as 3 move uops with a temporary register.

XADD is probably 2 moves and an add also using a temporary register.

Change the latency for both from 2 cycles to 3 cycles. Only 2 of the uops are serialized in their execution, the move into the temporary and the move out of the temporary. The move from one GPR to the other should be able to go in parallel with this if there are ALU resources available.

llvm-svn: 330349

6 years ago[Reassociate] fix formatting; NFC
Sanjay Patel [Thu, 19 Apr 2018 17:56:36 +0000 (17:56 +0000)]
[Reassociate] fix formatting; NFC

llvm-svn: 330348

6 years ago[X86] Merge some MMX instregex
Simon Pilgrim [Thu, 19 Apr 2018 17:32:10 +0000 (17:32 +0000)]
[X86] Merge some MMX instregex

There's a lot more but I'd prefer focussing on removing unnecessary InstRWs first.

llvm-svn: 330347

6 years agoSimplify Repl handling.
Rafael Espindola [Thu, 19 Apr 2018 17:26:50 +0000 (17:26 +0000)]
Simplify Repl handling.

Now that we don't ICF synthetic sections, we can go back to the old
logic on whose responsibility it is to check Repl.

The idea is that Sec->something() will not check Repl. It is the
responsibility of the caller to find the correct Sec.

llvm-svn: 330346

6 years ago[if-converter] Handle BBs that terminate in ret during diamond conversion
Krzysztof Parzyszek [Thu, 19 Apr 2018 17:26:46 +0000 (17:26 +0000)]
[if-converter] Handle BBs that terminate in ret during diamond conversion

This fixes https://llvm.org/PR36825.

Original patch by Valentin Churavy (D45218).

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

llvm-svn: 330345

6 years ago[Hexagon] Use legal types when lowering CONCAT_VECTORS via BUILD_VECTOR
Krzysztof Parzyszek [Thu, 19 Apr 2018 17:11:58 +0000 (17:11 +0000)]
[Hexagon] Use legal types when lowering CONCAT_VECTORS via BUILD_VECTOR

llvm-svn: 330344

6 years ago[llvm-objdump] Remove test object file
Francis Visoiu Mistrih [Thu, 19 Apr 2018 17:05:03 +0000 (17:05 +0000)]
[llvm-objdump] Remove test object file

Forgot to remove it from the previous commit.

llvm-svn: 330343

6 years ago[llvm-objdump] Print "..." instead of random data for virtual sections
Francis Visoiu Mistrih [Thu, 19 Apr 2018 17:02:57 +0000 (17:02 +0000)]
[llvm-objdump] Print "..." instead of random data for virtual sections

When disassembling with -D, skip virtual sections by printing "..." for
each symbol.

This patch also implements `MachOObjectFile::isSectionVirtual`.

Test case comes from:

```
.zerofill __DATA,__common,_data64unsigned,472,3
```

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

llvm-svn: 330342

6 years ago[gold/ThinLTO] Invoke llvm_shutdown when exiting after ThinLTO indexing
Teresa Johnson [Thu, 19 Apr 2018 16:55:13 +0000 (16:55 +0000)]
[gold/ThinLTO] Invoke llvm_shutdown when exiting after ThinLTO indexing

Summary:
Instead of manually invoking PrintStatistics, simply invoke
llvm_shutdown which will take care of destroying managed statics, and as
a side effect will destroy the StatisticInfo ManagedStatic, invoking
PrintStatistics when needed.

Reviewers: fhahn

Subscribers: inglorion, llvm-commits

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

llvm-svn: 330341

6 years agoSimplify getOffset for synthetic sections.
Rafael Espindola [Thu, 19 Apr 2018 16:54:30 +0000 (16:54 +0000)]
Simplify getOffset for synthetic sections.

We had a single symbol using -1 with a synthetic section. It is
simpler to just update its value.

This is not a big will by itself, but will allow having a simple
getOffset for InputSeciton.

llvm-svn: 330340

6 years agoRename MergeInputSection::getOffset.
Rafael Espindola [Thu, 19 Apr 2018 16:05:07 +0000 (16:05 +0000)]
Rename MergeInputSection::getOffset.

Unlike the getOffset in the base class, this one computes the offset
in the parent synthetic section, not the final output section.

llvm-svn: 330339

6 years ago[CXX] Templates specialization visibility can be wrong
Steven Wu [Thu, 19 Apr 2018 15:46:43 +0000 (15:46 +0000)]
[CXX] Templates specialization visibility can be wrong

Summary:
Under some conditions, LinkageComputer can get the visibility for
ClassTemplateSpecializationDecl wrong because it failed to find the Decl
that has the explicit visibility.

This fixes:
llvm.org/bugs/pr36810
rdar://problem/38080953

Reviewers: rsmith, arphaman, doug.gregor

Reviewed By: doug.gregor

Subscribers: doug.gregor, cfe-commits

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

llvm-svn: 330338

6 years ago[AMDGPU] Do not only rely on BB number when finding bottom loop
Mark Searles [Thu, 19 Apr 2018 15:42:30 +0000 (15:42 +0000)]
[AMDGPU] Do not only rely on BB number when finding bottom loop

We should also check that the "bottom" basic block of a loopis a successor of the "header" basic block, otherwise we don't propagate the information correctly when the CFG is complex. This fixes an important rendering problem with Wolfsentein 2, because of one vector-memory wait was missing.

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

llvm-svn: 330337

6 years ago[NEON] Define vfma_n_f32() and vfmaq_n_f32() intrinsics in AArch32 mode
Ivan A. Kosarev [Thu, 19 Apr 2018 15:27:28 +0000 (15:27 +0000)]
[NEON] Define vfma_n_f32() and vfmaq_n_f32() intrinsics in AArch32 mode

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

llvm-svn: 330336

6 years ago[llvm-mca][X86] Add mmx instruction to btver2 resource tests
Simon Pilgrim [Thu, 19 Apr 2018 15:09:46 +0000 (15:09 +0000)]
[llvm-mca][X86] Add mmx instruction to btver2 resource tests

Useful to see scheduler class deltas against xmm equivalents

llvm-svn: 330335

6 years ago[NewGVN] Add ops as dependency if we cannot find a leader for ValueOp.
Florian Hahn [Thu, 19 Apr 2018 15:05:47 +0000 (15:05 +0000)]
[NewGVN] Add ops as dependency if we cannot find a leader for ValueOp.

If those operands change, we might find a leader for ValueOp, which
could enable new phi-of-op creation.

This fixes a case where we missed creating a phi-of-ops node. With D43865
and this patch, bootstrapping clang/llvm works with -enable-newgvn, whereas
without it, the "value changed after iteration" assertion is triggered.

Reviewers: dberlin, davide

Reviewed By: dberlin

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

llvm-svn: 330334

6 years ago[Hexagon] Generate code for vector bswap intrinsics
Krzysztof Parzyszek [Thu, 19 Apr 2018 14:46:44 +0000 (14:46 +0000)]
[Hexagon] Generate code for vector bswap intrinsics

llvm-svn: 330333

6 years ago[X86][BtVer2] Remove SSE4A EXTRQ/EXTRQI InstRW overrides.
Simon Pilgrim [Thu, 19 Apr 2018 14:38:36 +0000 (14:38 +0000)]
[X86][BtVer2] Remove SSE4A EXTRQ/EXTRQI InstRW overrides.

These are already handled identically by WriteALU.

llvm-svn: 330332

6 years agoFix __attribute__((force_align_arg_pointer)) misalignment bug
Erich Keane [Thu, 19 Apr 2018 14:27:05 +0000 (14:27 +0000)]
Fix __attribute__((force_align_arg_pointer)) misalignment bug

The force_align_arg_pointer attribute was using a hardcoded 16-byte
alignment value which in combination with -mstack-alignment=32 (or
larger) would produce a misaligned stack which could result in crashes
when accessing stack buffers using aligned AVX load/store instructions.

Fix the issue by using the "stackrealign" function attribute instead
of using a hardcoded 16-byte alignment.

Patch By: Gramner

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

llvm-svn: 330331

6 years ago[Hexagon] Add/fix patterns for 32/64-bit vector compares and logical ops
Krzysztof Parzyszek [Thu, 19 Apr 2018 14:24:31 +0000 (14:24 +0000)]
[Hexagon] Add/fix patterns for 32/64-bit vector compares and logical ops

llvm-svn: 330330

6 years ago[Unittests] Fix plugins test
Mikhail Maltsev [Thu, 19 Apr 2018 14:02:46 +0000 (14:02 +0000)]
[Unittests] Fix plugins test

Summary:
Currently the PluginsTests.LoadPlugin unit test is failing in
LLVM configurations that have LLVM_EXPORT_SYMBOLS_FOR_PLUGINS enabled
because the EnableABIBreakingChecks symbol is missing.

This patch fixes the issue by linking some additional libraries to the
test plugin if LLVM_EXPORT_SYMBOLS_FOR_PLUGINS is enabled.

Reviewers: philip.pfaffe

Reviewed By: philip.pfaffe

Subscribers: mgorny, llvm-commits, rogfer01

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

llvm-svn: 330329

6 years ago[Fuzzer] Make InterruptHandler non-blocking for Fuchsia
Petr Hosek [Thu, 19 Apr 2018 14:01:46 +0000 (14:01 +0000)]
[Fuzzer] Make InterruptHandler non-blocking for Fuchsia

The initial naive approach to simulate SIGINT on Fuchsia was to getchar
and look for ETX. This caused the InterruptHandler thread to lock stdin,
preventing musl's exit() from being able to close the stdio descriptors
and complete. This change uses select() instead.

Patch By: aarongreen

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

llvm-svn: 330328

6 years ago[clang-tidy] Fix unused-variable warning.
Haojian Wu [Thu, 19 Apr 2018 13:34:03 +0000 (13:34 +0000)]
[clang-tidy] Fix unused-variable warning.

llvm-svn: 330327

6 years ago[mips] Correct the definitions of the unaligned word memory operation instructions
Simon Dardis [Thu, 19 Apr 2018 13:33:51 +0000 (13:33 +0000)]
[mips] Correct the definitions of the unaligned word memory operation instructions

These instructions lacked the correct predicates, were not marked
as loads and stores and lacked the proper instruction mapping information.

In the case of microMIPS sw(l|r)e (EVA) these instructions were using the load
EVA description.

Reviewers: abeserminji, smaksimovic, atanasyan

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

llvm-svn: 330326

6 years ago[NFC][InstCombine] A few more tests for masked merge add/xor -> or with constant...
Roman Lebedev [Thu, 19 Apr 2018 13:02:17 +0000 (13:02 +0000)]
[NFC][InstCombine] A few more tests for masked merge add/xor -> or with constant mask

llvm-svn: 330325

6 years ago[clang-format] Don't remove empty lines before namespace endings
Krasimir Georgiev [Thu, 19 Apr 2018 13:02:15 +0000 (13:02 +0000)]
[clang-format] Don't remove empty lines before namespace endings

Summary: This implements an alternative to r327861, namely preserving empty lines before namespace endings.

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 330324

6 years agoLowering x86 adds/addus/subs/subus intrinsics (clang)
Alexander Ivchenko [Thu, 19 Apr 2018 12:15:11 +0000 (12:15 +0000)]
Lowering x86 adds/addus/subs/subus intrinsics (clang)

This is the patch that lowers x86 intrinsics to native IR
in order to enable optimizations.

Patch by tkrupa

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

llvm-svn: 330323

6 years agoLowering x86 adds/addus/subs/subus intrinsics (llvm part)
Alexander Ivchenko [Thu, 19 Apr 2018 12:13:30 +0000 (12:13 +0000)]
Lowering x86 adds/addus/subs/subus intrinsics (llvm part)

This is the patch that lowers x86 intrinsics to native IR
in order to enable optimizations. The patch also includes folding
of previously missing saturation patterns so that IR emits the same
machine instructions as the intrinsics.

Patch by tkrupa

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

llvm-svn: 330322

6 years agoRemove file accidentally added in r330320.
Florian Hahn [Thu, 19 Apr 2018 12:09:05 +0000 (12:09 +0000)]
Remove file accidentally added in r330320.

llvm-svn: 330321

6 years ago[IR/BasicBlockTest] Fix asan failure introduced in rL330316.
Florian Hahn [Thu, 19 Apr 2018 12:06:26 +0000 (12:06 +0000)]
[IR/BasicBlockTest] Fix asan failure introduced in rL330316.

The argument has to be deleted after the module containing the function
gets deleted.

llvm-svn: 330320

6 years ago[X86][FMA] Remove FMA reg-reg InstRW scheduler overrides.
Simon Pilgrim [Thu, 19 Apr 2018 11:37:26 +0000 (11:37 +0000)]
[X86][FMA] Remove FMA reg-reg InstRW scheduler overrides.

These are all already handled identically by WriteFMA.

llvm-svn: 330319

6 years ago[X86][BtVer2] Remove 128-bit F16C InstRW overrides.
Simon Pilgrim [Thu, 19 Apr 2018 11:16:33 +0000 (11:16 +0000)]
[X86][BtVer2] Remove 128-bit F16C InstRW overrides.

These are already handled identically by WriteCvtF2F.

llvm-svn: 330318

6 years ago[llvm-exegesis] Fix PfmIssueCountersTable creation
Simon Pilgrim [Thu, 19 Apr 2018 10:59:49 +0000 (10:59 +0000)]
[llvm-exegesis] Fix PfmIssueCountersTable creation

This patch ensures that the pfm issue counter tables are the correct size, accounting for the invalid resource entry at the beginning of the resource tables.

It also fixes an issue with pfm failing to match event counters due to a trailing comma added to all the event names.

I've also added a counter comment to each entry as it helps locate problems with the tables.

Note: I don't have access to a SandyBridge test machine, which is the only model to make use of multiple event counters being mapped to a single resource. I don't know if pfm accepts a comma-seperated list or not, but that is what it was doing.

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

llvm-svn: 330317

6 years ago[BasicBlock] Add instructionsWithoutDebug methods to skip debug insts.
Florian Hahn [Thu, 19 Apr 2018 09:48:07 +0000 (09:48 +0000)]
[BasicBlock] Add instructionsWithoutDebug methods to skip debug insts.

Reviewers: aprantl, vsk, mattd, chandlerc

Reviewed By: aprantl, vsk

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

llvm-svn: 330316

6 years ago[mips] Guard some macro expansions properly
Simon Dardis [Thu, 19 Apr 2018 09:45:04 +0000 (09:45 +0000)]
[mips] Guard some macro expansions properly

Reviewers: atanasyan, abeserminji

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

llvm-svn: 330315

6 years agoAttempt to fix TestMiniDump on windows
Pavel Labath [Thu, 19 Apr 2018 09:38:42 +0000 (09:38 +0000)]
Attempt to fix TestMiniDump on windows

It was failing because the modules names were coming out as
C:\Windows\System32/MSVCP120D.dll (last separator is a forward slash) on
windows.

There are two issues at play here:
- the first problem is that the paths in minidump were being parsed as a
  host path. This meant that on posix systems the whole path was
  interpreted as a file name.
- on windows the path was split into a directory-filename pair
  correctly, but then when it was reconsituted, the last separator ended
  up being a forward slash because SBFileSpec.fullpath was joining them
  with '/' unconditionally.

I fix the first issue by parsing the minidump paths according to the
path syntax of the host which produced the dump, which should make the
test behavior on posix&windows identical. The last path will still be a
forward slash because of the second issue. We should probably fix the
"fullpath" property to do something smarter in the future.

llvm-svn: 330314

6 years ago[ARM] Add some missing FP16 VSEL test cases
Sjoerd Meijer [Thu, 19 Apr 2018 08:21:50 +0000 (08:21 +0000)]
[ARM] Add some missing FP16 VSEL test cases

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

llvm-svn: 330313

6 years agotsan: fix compiler warnings
Dmitry Vyukov [Thu, 19 Apr 2018 07:42:08 +0000 (07:42 +0000)]
tsan: fix compiler warnings

vmaSize is uptr, so we need to print it with %zd.

llvm-svn: 330312

6 years ago[AArch64][AsmParser] NFC: Cleanup parsing of scalar registers.
Sander de Smalen [Thu, 19 Apr 2018 07:35:08 +0000 (07:35 +0000)]
[AArch64][AsmParser] NFC: Cleanup parsing of scalar registers.

Summary:
- Renamed tryParseRegister to tryParseScalarRegister, which
  now returns an OperandMatchResultTy.
- Moved matching of certain aliases into matchRegisterNameAlias.
- Changed type of most 'Reg' variables to 'unsigned'.

This is patch [1/4] in a series to add assembler/disassembler support for
SVE's contiguous LD1 (scalar+scalar) instructions:
- Patch [1/4]: https://reviews.llvm.org/D45687
- Patch [2/4]: https://reviews.llvm.org/D45688
- Patch [3/4]: https://reviews.llvm.org/D45689
- Patch [4/4]: https://reviews.llvm.org/D45690

Reviewers: fhahn, rengolin, javed.absar, huntergr, SjoerdMeijer, t.p.northover, echristo, evandro, samparker

Reviewed By: samparker

Subscribers: samparker, llvm-commits, kristof.beyls

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

llvm-svn: 330311

6 years agoOpenBSD add C++ runtime in a driver's standpoint
Dean Michael Berris [Thu, 19 Apr 2018 06:55:30 +0000 (06:55 +0000)]
OpenBSD add C++ runtime in a driver's standpoint

Summary: - Since 6.2 release, on supporters platforms clang is shipped with both libcxx and libcxxabi.

Reviewers: dberris, alekseyshl, EricWF

Reviewed By: dberris

Subscribers: cfe-commits

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

llvm-svn: 330310

6 years ago[RuntimeDebugBuilder] Do not break for 64 bit integers
Tobias Grosser [Thu, 19 Apr 2018 05:38:12 +0000 (05:38 +0000)]
[RuntimeDebugBuilder] Do not break for 64 bit integers

In r330292 this assert was turned incorrectly into an unreachable, but
the correct behavior (thanks Michael) is to assert for anything that is
not 64 bit, but falltrough for 64 bit. I document this in the source
code.

llvm-svn: 330309