platform/upstream/llvm.git
5 years agoFix threaded test under no-threading configuration
Eric Fiselier [Mon, 1 Oct 2018 01:05:51 +0000 (01:05 +0000)]
Fix threaded test under no-threading configuration

llvm-svn: 343432

5 years agoAttempt to unbreak Windows configuration.
Eric Fiselier [Mon, 1 Oct 2018 01:00:11 +0000 (01:00 +0000)]
Attempt to unbreak Windows configuration.

Although libc++ doesn't yet support Windows we still have Windows
builders to track our progress.

Currently the clang-cl configuration seems broken because it doesn't
support -std=c++11 and instead requires /std:c++11. This patch attempts
to fix this.

llvm-svn: 343431

5 years ago[ORC] Add convenience methods for creating DynamicLibraryFallbackGenerators for
Lang Hames [Mon, 1 Oct 2018 00:59:28 +0000 (00:59 +0000)]
[ORC] Add convenience methods for creating DynamicLibraryFallbackGenerators for
libraries on disk, and for the current process.

Avoids more boilerplate during JIT construction.

llvm-svn: 343430

5 years ago[ORC] Add a method to JITTargetMachineBuilder to get the default data layout
Lang Hames [Mon, 1 Oct 2018 00:59:26 +0000 (00:59 +0000)]
[ORC] Add a method to JITTargetMachineBuilder to get the default data layout
for the target machine.

This simplifies usage during setup of concurrent JIT stacks where the client
needs a DataLayout, but not a TargetMachine (TargetMachines are created on
the fly by the compile threads later).

llvm-svn: 343429

5 years ago[X86] Change an llvm_unreachable to a report_fatal_error so the optimizer will stop...
Craig Topper [Sun, 30 Sep 2018 23:43:30 +0000 (23:43 +0000)]
[X86] Change an llvm_unreachable to a report_fatal_error so the optimizer will stop making us reach the other report_fatal_error in this function.

There's a conditional report_fatal_error just above this llvm_unreachable. The optimizer when seeing the unreachable removes the conditional and just makes any other error trigger the existing report_fatal_error.

llvm-svn: 343428

5 years ago[ORC] Add an 'intern' method to ExecutionEngine for interning symbol names.
Lang Hames [Sun, 30 Sep 2018 23:18:24 +0000 (23:18 +0000)]
[ORC] Add an 'intern' method to ExecutionEngine for interning symbol names.

This cuts down on boilerplate by reducing 'ES.getSymbolStringPool().intern(...)'
to 'ES.intern(...)'.

llvm-svn: 343427

5 years agoUse the container form llvm::sort(C, ...)
Fangrui Song [Sun, 30 Sep 2018 22:31:29 +0000 (22:31 +0000)]
Use the container form llvm::sort(C, ...)

There are a few leftovers in rL343163 which span two lines. This commit
changes these llvm::sort(C.begin(), C.end, ...) to llvm::sort(C, ...)

llvm-svn: 343426

5 years agoUse the container form llvm::sort(C, ...)
Fangrui Song [Sun, 30 Sep 2018 21:41:11 +0000 (21:41 +0000)]
Use the container form llvm::sort(C, ...)

There are a few leftovers of rC343147 that are not (\w+)\.begin but in
the form of ([-[:alnum:]>.]+)\.begin or spanning two lines. Change them
to use the container form in this commit. The 12 occurrences have been
inspected manually for safety.

llvm-svn: 343425

5 years ago[X86] Fix scheduler class for BTmi instructions
Simon Pilgrim [Sun, 30 Sep 2018 20:19:16 +0000 (20:19 +0000)]
[X86] Fix scheduler class for BTmi instructions

This wasn't treated as a folded load instruction

llvm-svn: 343424

5 years ago[ORC] Extract and tidy up JITTargetMachineBuilder, add unit test.
Lang Hames [Sun, 30 Sep 2018 19:12:23 +0000 (19:12 +0000)]
[ORC] Extract and tidy up JITTargetMachineBuilder, add unit test.

(1) Adds comments for the API.

(2) Removes the setArch method: This is redundant: the setArchStr method on the
    triple should be used instead.

(3) Turns EmulatedTLS on by default. This matches EngineBuilder's behavior.

llvm-svn: 343423

5 years ago[COFF] In MinGW mode, ignore relocations against a discarded section
Martin Storsjo [Sun, 30 Sep 2018 18:31:03 +0000 (18:31 +0000)]
[COFF] In MinGW mode, ignore relocations against a discarded section

When GCC produces a jump table as part of a comdat function, the
jump table itself is produced as plain non-comdat rdata section. When
linked with ld.bfd, all of those rdata sections are kept, with
relocations unchanged in the sections that refer to discarded comdat
sections.

This has been observed with at least GCC 5.x and 7.x.

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

llvm-svn: 343422

5 years ago[LLVM-MCA][X86] Add missing VCMPESTR/VCMPESTR tests
Simon Pilgrim [Sun, 30 Sep 2018 18:19:00 +0000 (18:19 +0000)]
[LLVM-MCA][X86] Add missing VCMPESTR/VCMPESTR tests

llvm-svn: 343421

5 years agoFix linkage error on ProgramPoint's dump method.
Eric Fiselier [Sun, 30 Sep 2018 18:05:39 +0000 (18:05 +0000)]
Fix linkage error on ProgramPoint's dump method.

Currently, ProgramPoint::dump calls the out-of-line function ProgramPoint::print. This causes
libraries which include ProgramPoint.h to become dependent on libclangAnalysis, which in turn
causes missing symbol link error when building with -DBUILD_SHARED_LIBS=ON -DLLVM_ENABLE_MODULES=ON.

The breakage was introduced in r343160.

This patch fixes the issues by moving ProgramPoint::dump's declaration out of line.

llvm-svn: 343420

5 years ago[X86] Copy memrefs when folding a load for division instruction selection.
Craig Topper [Sun, 30 Sep 2018 17:47:18 +0000 (17:47 +0000)]
[X86] Copy memrefs when folding a load for division instruction selection.

llvm-svn: 343419

5 years agoReverting r343415 as it breaks at least one of the bots.
Aaron Ballman [Sun, 30 Sep 2018 17:39:39 +0000 (17:39 +0000)]
Reverting r343415 as it breaks at least one of the bots.

http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/37336

llvm-svn: 343418

5 years ago[PHIElimination] Lower a PHI node with only undef uses as IMPLICIT_DEF
Bjorn Pettersson [Sun, 30 Sep 2018 17:26:58 +0000 (17:26 +0000)]
[PHIElimination] Lower a PHI node with only undef uses as IMPLICIT_DEF

Summary:
The lowering of PHI nodes used to detect if all inputs originated
from IMPLICIT_DEF's. If so the PHI node was replaced by an
IMPLICIT_DEF. Now we also consider undef uses when checking the
inputs. So if all inputs are implicitly defined or undef we
lower the PHI to an IMPLICIT_DEF. This makes
PHIElimination::LowerPHINode more consistent as it checks
both implicit and undef properties at later stages.

Reviewers: MatzeB, tstellar

Reviewed By: MatzeB

Subscribers: jvesely, nhaehnle, llvm-commits

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

llvm-svn: 343417

5 years ago[PHIElimination] Update the regression test for PR16508
Bjorn Pettersson [Sun, 30 Sep 2018 17:23:21 +0000 (17:23 +0000)]
[PHIElimination] Update the regression test for PR16508

Summary:
When PR16508 was solved (in rL185363) a regression test was
added as test/CodeGen/PowerPC/2013-07-01-PHIElimBug.ll.
I discovered that the test case no longer reproduced the
scenario from PR16508. This problem could have been amended
by adding an extra RUN line with "-O1" (or possibly "-O0"),
but instead I added a mir-reproducer
  test/CodeGen/PowerPC/2013-07-01-PHIElimBug.mir
to get a reproducer that is less sensitive to changes in
earlier passes (including O-level).

While being at it I also corrected a code comment in
PHIElimination::EliminatePHINodes that has been incorrect
since the related bugfix from rL185363.

Reviewers: MatzeB, hfinkel

Reviewed By: MatzeB

Subscribers: nemanjai, jsji, llvm-commits

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

llvm-svn: 343416

5 years agoAllow clang-tidy to be built without a dependency on the clang static analyzer.
Aaron Ballman [Sun, 30 Sep 2018 17:22:58 +0000 (17:22 +0000)]
Allow clang-tidy to be built without a dependency on the clang static analyzer.

Patch by Stephen Kelly.

llvm-svn: 343415

5 years ago[LLVM-MCA][X86] Add some AVX512 tests
Simon Pilgrim [Sun, 30 Sep 2018 17:01:59 +0000 (17:01 +0000)]
[LLVM-MCA][X86] Add some AVX512 tests

These are going to be necessary to check I don't mess up when I start cleaning up all the remaining vector integer overrides

llvm-svn: 343414

5 years ago[X86][Btver2] Fix PCmpIStrI/PCmpIStrM schedules
Simon Pilgrim [Sun, 30 Sep 2018 16:38:38 +0000 (16:38 +0000)]
[X86][Btver2] Fix PCmpIStrI/PCmpIStrM schedules

Missing JFPU0 pipe and double JFPU1 pipe (to match JVALU1) resources

Match AMD Fam16h SOG + llvm-exegesis tests

llvm-svn: 343413

5 years ago[PDB] Add native support for dumping array types.
Zachary Turner [Sun, 30 Sep 2018 16:19:18 +0000 (16:19 +0000)]
[PDB] Add native support for dumping array types.

llvm-svn: 343412

5 years agoFix NetBSD build for r343409
Pavel Labath [Sun, 30 Sep 2018 16:12:09 +0000 (16:12 +0000)]
Fix NetBSD build for r343409

Forgot to remove the method declaration from the header.

llvm-svn: 343411

5 years ago[X86][BtVer2] Add the ability to add additional uops for folded instructions
Simon Pilgrim [Sun, 30 Sep 2018 15:58:56 +0000 (15:58 +0000)]
[X86][BtVer2] Add the ability to add additional uops for folded instructions

Some instructions take an extra load uop - but not consistently.....

llvm-svn: 343410

5 years agoPull GetSoftwareBreakpointPCOffset into base class
Pavel Labath [Sun, 30 Sep 2018 15:58:52 +0000 (15:58 +0000)]
Pull GetSoftwareBreakpointPCOffset into base class

Summary:
This function encodes the knowledge of whether the PC points to the
breakpoint instruction of the one following it after the breakpoint is
"hit". This behavior mainly(*) depends on the architecture and not on the
OS, so it makes sense for it to be implemented in the base class, where
it can be shared between different implementations (Linux and NetBSD
atm).

(*) It is possible for an OS to expose a different API, perhaps by doing
some fixups in the kernel. In this case, the implementation can override
this function to implement custom behavior.

Reviewers: krytarowski, zturner

Subscribers: lldb-commits

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

llvm-svn: 343409

5 years agoUpdate ifunc attribute support documentation
Ed Maste [Sun, 30 Sep 2018 15:08:18 +0000 (15:08 +0000)]
Update ifunc attribute support documentation

Previously we documented GNU binutils and glibc versions required for
ifunc support, but our own lld linker and FreeBSD's rtld also support
ifuncs.

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

llvm-svn: 343408

5 years ago[InstCombine] try to convert vector insert+extract to trunc
Sanjay Patel [Sun, 30 Sep 2018 14:34:01 +0000 (14:34 +0000)]
[InstCombine] try to convert vector insert+extract to trunc

This transform is requested for the backend in:
https://bugs.llvm.org/show_bug.cgi?id=39016
...but I figured it was worth doing in IR too, and it's probably
easier to implement here, so that's this patch.

In the simplest case, we are just truncating a scalar value. If the
extract index doesn't correspond to the LSBs of the scalar, then we
have to shift-right before the truncate. Endian-ness makes this tricky,
but hopefully the ASCII-art helps visualize the transform.

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

llvm-svn: 343407

5 years ago[InstCombine] allow lengthening of insertelement to eliminate shuffles
Sanjay Patel [Sun, 30 Sep 2018 13:50:42 +0000 (13:50 +0000)]
[InstCombine] allow lengthening of insertelement to eliminate shuffles

As noted in post-commit comments for D52548, the limitation on
increasing vector length can be applied by opcode.
As a first step, this patch only allows insertelement to be
widened because that has no logical downsides for IR and has
little risk of pessimizing codegen.

This may cause PR39132 to go into hiding during a full compile,
but that bug is not fixed.

llvm-svn: 343406

5 years ago[DAG] Don't perform SINT_TO_FP<->UINT_TO_FP custom conversion after legalization
Simon Pilgrim [Sun, 30 Sep 2018 12:46:42 +0000 (12:46 +0000)]
[DAG] Don't perform SINT_TO_FP<->UINT_TO_FP custom conversion after legalization

The SINT_TO_FP<->UINT_TO_FP combines for non-negative integers should only occur for legal ops once LegalOperations = true

No test case to hand, noticed when investigating PR38226 + PR38970

llvm-svn: 343405

5 years ago[NFC][CodeGen][X86][AArch64] Add 64-bit constant bit field extract pattern tests
Roman Lebedev [Sun, 30 Sep 2018 12:42:08 +0000 (12:42 +0000)]
[NFC][CodeGen][X86][AArch64] Add 64-bit constant bit field extract pattern tests

llvm-svn: 343404

5 years ago[X86] Regenerate MMX coalescing test
Simon Pilgrim [Sun, 30 Sep 2018 09:42:04 +0000 (09:42 +0000)]
[X86] Regenerate MMX coalescing test

Exposes another extractelement(bitcast(scalartovector())) pattern

llvm-svn: 343403

5 years ago[libomptarget-nvptx] Align data sharing stack
Jonas Hahnfeld [Sun, 30 Sep 2018 09:23:21 +0000 (09:23 +0000)]
[libomptarget-nvptx] Align data sharing stack

NVPTX requires addresses of pointer locations to be 8-byte aligned
or there will be an exception during runtime.
This could happen without this patch as shown in the added test:
getId() requires 4 byte of stack and putValueInParallel() uses 16
bytes to store the addresses of the captured variables.

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

llvm-svn: 343402

5 years ago[libomptarget-nvptx] Fix ancestor_thread_num and team_size (non-SPMD)
Jonas Hahnfeld [Sun, 30 Sep 2018 09:23:14 +0000 (09:23 +0000)]
[libomptarget-nvptx] Fix ancestor_thread_num and team_size (non-SPMD)

According to OpenMP 4.5, p250:12-14:

    If the requested nest level is outside the range of 0 and the
    nest level of the current thread, as returned by the omp_get_level
    routine, the routine returns -1.

The SPMD code path will need a similar fix.

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

llvm-svn: 343401

5 years ago[PDB] Fix this test for real.
Zachary Turner [Sun, 30 Sep 2018 03:57:49 +0000 (03:57 +0000)]
[PDB] Fix this test for real.

I was able to test this fix on an actual Windows machine
so this should get the bot green again.

llvm-svn: 343400

5 years ago[X86] Disable BMI BEXTR in X86DAGToDAGISel::matchBEXTRFromAnd unless we're on compili...
Craig Topper [Sun, 30 Sep 2018 03:01:46 +0000 (03:01 +0000)]
[X86] Disable BMI BEXTR in X86DAGToDAGISel::matchBEXTRFromAnd unless we're on compiling for a CPU with single uop BEXTR

Summary:
This function turns (X >> C1) & C2 into a BMI BEXTR or TBM BEXTRI instruction. For BMI BEXTR we have to materialize an immediate into a register to feed to the BEXTR instruction.

The BMI BEXTR instruction is 2 uops on Intel CPUs. It looks like on SKL its one port 0/6 uop and one port 1/5 uop. Despite what Agner's tables say. I know one of the uops is a regular shift uop so it would have to go through the port 0/6 shifter unit. So that's the same or worse execution wise than the shift+and which is one 0/6 uop and one 0/1/5/6 uop. The move immediate into register is an additional 0/1/5/6 uop.

For now I've limited this transform to AMD CPUs which have a single uop BEXTR. If may also might make sense if we can fold a load or if the and immediate is larger than 32-bits and can't be encoded as a sign extended 32-bit value or if LICM or CSE can hoist the move immediate and share it. But we'd need to look more carefully at that. In the regression I looked at it doesn't look load folding or large immediates were occurring so the regression isn't caused by the loss of those. So we could try to be smarter here if we find a compelling case.

Reviewers: RKSimon, spatel, lebedev.ri, andreadb

Reviewed By: RKSimon

Subscribers: llvm-commits, andreadb, RKSimon

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

llvm-svn: 343399

5 years agoOnly dump the types we need in the test.
Zachary Turner [Sun, 30 Sep 2018 00:51:54 +0000 (00:51 +0000)]
Only dump the types we need in the test.

We added support for dumping pointers but pointers to arrays
won't correctly dump until we add support for dumping arrays.
Instead of trying to dump everything, which this test isn't
even interested in, just dump enums and typedefs.

llvm-svn: 343398

5 years agoFix some tests on Windows.
Zachary Turner [Sun, 30 Sep 2018 00:22:21 +0000 (00:22 +0000)]
Fix some tests on Windows.

I don't actually have a Windows machine at the present moment,
so hopefully this fixes it.

llvm-svn: 343397

5 years ago[ORC] Add partitioning support to CompileOnDemandLayer2.
Lang Hames [Sat, 29 Sep 2018 23:49:57 +0000 (23:49 +0000)]
[ORC] Add partitioning support to CompileOnDemandLayer2.

CompileOnDemandLayer2 now supports user-supplied partition functions (the
original CompileOnDemandLayer already supported these).

Partition functions are called with the list of requested global values
(i.e. global values that currently have queries waiting on them) and have an
opportunity to select extra global values to materialize at the same time.

Also adds testing infrastructure for the new feature to lli.

llvm-svn: 343396

5 years ago[ORC] Clear SymbolToDefinitionMap when materializing a MaterializationUnit.
Lang Hames [Sat, 29 Sep 2018 23:49:56 +0000 (23:49 +0000)]
[ORC] Clear SymbolToDefinitionMap when materializing a MaterializationUnit.

The map is inaccessible at this point, so we may as well reclaim the memory
early.

llvm-svn: 343395

5 years agoAdd a comment to clarify the contract for LLVMGetErrorMessage in the c-bindings
Lang Hames [Sat, 29 Sep 2018 23:49:54 +0000 (23:49 +0000)]
Add a comment to clarify the contract for LLVMGetErrorMessage in the c-bindings
for Error.

llvm-svn: 343394

5 years ago[PDB] Better native API support for pointers.
Zachary Turner [Sat, 29 Sep 2018 23:28:19 +0000 (23:28 +0000)]
[PDB] Better native API support for pointers.

We didn't properly detect when a pointer was a member
pointer, and when that was the case we were not
properly returning class parent info.  This caused
member pointers to render incorrectly in pretty mode.
However, we didn't even have pretty tests for pointers
in native mode, so those are also added now to ensure
this.

llvm-svn: 343393

5 years ago[DAGCombiner][NFC] Tests for X div/rem Y single bit fold
David Bolvansky [Sat, 29 Sep 2018 21:00:37 +0000 (21:00 +0000)]
[DAGCombiner][NFC] Tests for X div/rem Y single bit fold

llvm-svn: 343392

5 years ago[X86][AVX2] Cleanup shuffle combining tests - add common prefixes
Simon Pilgrim [Sat, 29 Sep 2018 20:34:16 +0000 (20:34 +0000)]
[X86][AVX2] Cleanup shuffle combining tests - add common prefixes

llvm-svn: 343391

5 years ago[X86] SimplifyDemandedVectorEltsForTargetNode - remove identity target shuffles befor...
Simon Pilgrim [Sat, 29 Sep 2018 18:15:26 +0000 (18:15 +0000)]
[X86] SimplifyDemandedVectorEltsForTargetNode - remove identity target shuffles before simplifying inputs

By removing demanded target shuffles that simplify to zero/undef/identity before simplifying its inputs we improve chances of further simplification, as only the immediate parent user of the combined is added back to the work list - this still doesn't help us if its passed through other ops though (bitcasts....).

llvm-svn: 343390

5 years ago[X86] Add fast-isel test cases for unaligned load/store intrinsics recently added...
Craig Topper [Sat, 29 Sep 2018 18:03:52 +0000 (18:03 +0000)]
[X86] Add fast-isel test cases for unaligned load/store intrinsics recently added to clang

This adds tests for:
_mm_loadu_si16
_mm_loadu_si32
_mm_loadu_si16
_mm_storeu_si64
_mm_storeu_si32
_mm_storeu_si16

llvm-svn: 343389

5 years ago[X86] Add more of the icc unaligned load/store to/from 128 bit vector intrinsics
Craig Topper [Sat, 29 Sep 2018 17:49:42 +0000 (17:49 +0000)]
[X86] Add more of the icc unaligned load/store to/from 128 bit vector intrinsics

Summary:
This patch adds
_mm_loadu_si32
_mm_loadu_si16
_mm_storeu_si64
_mm_storeu_si32
_mm_storeu_si16

We already had _mm_load_si64.

Reviewers: spatel, RKSimon

Reviewed By: RKSimon

Subscribers: cfe-commits

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

llvm-svn: 343388

5 years ago[X86][SSE] LowerScalarImmediateShift - remove 32-bit vXi64 special case handling.
Simon Pilgrim [Sat, 29 Sep 2018 17:36:22 +0000 (17:36 +0000)]
[X86][SSE] LowerScalarImmediateShift - remove 32-bit vXi64 special case handling.

This is all handled generally by getTargetConstantBitsFromNode now

llvm-svn: 343387

5 years agoFix signed/unsigned mismatch warning. NFCI.
Simon Pilgrim [Sat, 29 Sep 2018 17:11:19 +0000 (17:11 +0000)]
Fix signed/unsigned mismatch warning. NFCI.

llvm-svn: 343385

5 years ago[X86] getTargetConstantBitsFromNode - add support for rearranging constant bits via...
Simon Pilgrim [Sat, 29 Sep 2018 17:01:55 +0000 (17:01 +0000)]
[X86] getTargetConstantBitsFromNode - add support for rearranging constant bits via shuffles

Exposed an issue that recursive calls to getTargetConstantBitsFromNode don't handle changes to EltSizeInBits yet.

llvm-svn: 343384

5 years ago[X86][SSE] LowerScalarImmediateShift - use getTargetConstantBitsFromNode to get immed...
Simon Pilgrim [Sat, 29 Sep 2018 16:40:35 +0000 (16:40 +0000)]
[X86][SSE] LowerScalarImmediateShift - use getTargetConstantBitsFromNode to get immediate data

Don't just attempt to find a splat build vector.

First step towards getting rid of all the 32-bit special case code.

llvm-svn: 343383

5 years ago[libomptarget-nvptx] Add tests for nested parallelism
Jonas Hahnfeld [Sat, 29 Sep 2018 16:02:32 +0000 (16:02 +0000)]
[libomptarget-nvptx] Add tests for nested parallelism

Clang trunk will serialize nested parallel regions. Check that this
is correctly reflected in various API methods.

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

llvm-svn: 343382

5 years ago[libomptarget-nvptx] Ignore calls to dynamic API
Jonas Hahnfeld [Sat, 29 Sep 2018 16:02:25 +0000 (16:02 +0000)]
[libomptarget-nvptx] Ignore calls to dynamic API

There is no support and according to the OpenMP 4.5, p238:7-9:

    For implementations that do not support dynamic adjustment
    of the number of threads this routine has no effect: the
    value of dyn-var remains false.

Add a test that cancellation and nested parallelism aren't
supported either.

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

llvm-svn: 343381

5 years ago[libomptarget-nvptx] Fix number of threads in parallel
Jonas Hahnfeld [Sat, 29 Sep 2018 16:02:17 +0000 (16:02 +0000)]
[libomptarget-nvptx] Fix number of threads in parallel

If there is no num_threads() clause we must consider the
nthreads-var ICV. Its value is set by omp_set_num_threads()
and can be queried using omp_get_max_num_threads().
The rewritten code now closely resembles the algorithm given
in the OpenMP standard.

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

llvm-svn: 343380

5 years ago[InstCombine] fix formatting in vector evaluators; NFC
Sanjay Patel [Sat, 29 Sep 2018 15:05:24 +0000 (15:05 +0000)]
[InstCombine] fix formatting in vector evaluators; NFC

We need to alter the functionality as shown in D52548.

llvm-svn: 343379

5 years ago[InstCombine] add test for vector widening of insertelements; NFC
Sanjay Patel [Sat, 29 Sep 2018 15:01:45 +0000 (15:01 +0000)]
[InstCombine] add test for vector widening of insertelements; NFC

The test shows a potential overreach with the fix from D52548.

llvm-svn: 343378

5 years ago[X86] getTargetConstantBitsFromNode - fix self-move assertions from gcc builds due...
Simon Pilgrim [Sat, 29 Sep 2018 14:51:09 +0000 (14:51 +0000)]
[X86] getTargetConstantBitsFromNode - fix self-move assertions from gcc builds due to rL343375

llvm-svn: 343377

5 years ago[X86] Regenerate fma comments.
Simon Pilgrim [Sat, 29 Sep 2018 14:31:00 +0000 (14:31 +0000)]
[X86] Regenerate fma comments.

llvm-svn: 343376

5 years ago[X86] getTargetConstantBitsFromNode - add support for peeking through ISD::EXTRACT_SU...
Simon Pilgrim [Sat, 29 Sep 2018 14:17:32 +0000 (14:17 +0000)]
[X86] getTargetConstantBitsFromNode - add support for peeking through ISD::EXTRACT_SUBVECTOR

llvm-svn: 343375

5 years agoAttempt to fix a -Wdocumentation-html warning. NFCI.
Simon Pilgrim [Sat, 29 Sep 2018 13:30:43 +0000 (13:30 +0000)]
Attempt to fix a -Wdocumentation-html warning. NFCI.

llvm-svn: 343374

5 years ago[X86][SSE] Fixed issue with v2i64 variable shifts on 32-bit targets
Simon Pilgrim [Sat, 29 Sep 2018 13:25:22 +0000 (13:25 +0000)]
[X86][SSE] Fixed issue with v2i64 variable shifts on 32-bit targets

The shift amount might have peeked through a extract_subvector, altering the number of vector elements in the 'Amt' variable - so we were incorrectly calculating the ratio when peeking through bitcasts, resulting in incorrectly detecting splats.

llvm-svn: 343373

5 years ago[clang][www] Fix typo. NFC
Kristina Brooks [Sat, 29 Sep 2018 09:45:21 +0000 (09:45 +0000)]
[clang][www] Fix typo. NFC

Fix a one letter typo in diagnostics.html. (Wanted to try it with
arcanist).

Patch by king6cong

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

llvm-svn: 343372

5 years agoFix comment indentation in addLandingPad
Heejin Ahn [Sat, 29 Sep 2018 09:22:25 +0000 (09:22 +0000)]
Fix comment indentation in addLandingPad

rL343018 messed up the comment indentation while moving it.

llvm-svn: 343371

5 years agoSwitch sanitizer_procmaps_bsd to internal_sysctl
Kamil Rytarowski [Sat, 29 Sep 2018 07:45:03 +0000 (07:45 +0000)]
Switch sanitizer_procmaps_bsd to internal_sysctl

Summary:
Stop using directly sysctl(3) routines in sanitizer_procmaps_bsd
and replace it with internal_sysctl().

This will allow to install interceptors for sysctl(3).

Reviewers: joerg, vitalybuka

Reviewed By: vitalybuka

Subscribers: kubamracek, llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 343370

5 years ago[cxx2a] Fix warning triggered by r343285
Vitaly Buka [Sat, 29 Sep 2018 02:17:12 +0000 (02:17 +0000)]
[cxx2a] Fix warning triggered by r343285

llvm-svn: 343369

5 years ago[SBAPI/Target] Expose SetStatistics(bool enable)/GetStatistics().
Davide Italiano [Fri, 28 Sep 2018 23:27:54 +0000 (23:27 +0000)]
[SBAPI/Target] Expose SetStatistics(bool enable)/GetStatistics().

<rdar://problem/44875808>

llvm-svn: 343368

5 years ago[ORC] Make MaterializationResponsibility::getRequestedSymbols() const.
Lang Hames [Fri, 28 Sep 2018 22:03:17 +0000 (22:03 +0000)]
[ORC] Make MaterializationResponsibility::getRequestedSymbols() const.

This makes it available for use in IRTransformLayer2::TransformFunction
instances (since a const MaterializationResponsibility& parameter was
added in r343365).

llvm-svn: 343367

5 years ago[LLD][COFF] Fix pdb loading when the path points to a removable device
Alexandre Ganea [Fri, 28 Sep 2018 21:53:40 +0000 (21:53 +0000)]
[LLD][COFF] Fix pdb loading when the path points to a removable device

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

llvm-svn: 343366

5 years ago[ORC] Add more utilities to aid debugging output.
Lang Hames [Fri, 28 Sep 2018 21:49:53 +0000 (21:49 +0000)]
[ORC] Add more utilities to aid debugging output.

(1) A const accessor for the LLVMContext held by a ThreadSafeContext.

(2) A const accessor for the ThreadSafeModules held by an IRMaterializationUnit.

(3) A const MaterializationResponsibility reference to IRTransformLayer2's
    transform function. This makes IRTransformLayer2 useful for JIT debugging
    (since it can inspect JIT state through the responsibility argument) as well
    as program transformations.

llvm-svn: 343365

5 years ago[ValueTracking] Allow select patterns to work on FP vectors
Thomas Lively [Fri, 28 Sep 2018 21:36:43 +0000 (21:36 +0000)]
[ValueTracking] Allow select patterns to work on FP vectors

Summary:
This CL allows constant vectors of floats to be recognized as non-NaN
and non-zero in select patterns. This change makes
`matchSelectPattern` more powerful generally, but was motivated
specifically because I wanted fminnan and fmaxnan to be created for
vector versions of the scalar patterns they are created for.

Tested with check-all on all targets. A testcase in the WebAssembly
backend that tests the non-nan codepath is in an upcoming CL.

Reviewers: aheejin, dschuff

Subscribers: sunfish, llvm-commits

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

llvm-svn: 343364

5 years ago[LLVM-C] Add an accessor for the "value type" of a global
Robert Widmann [Fri, 28 Sep 2018 20:54:29 +0000 (20:54 +0000)]
[LLVM-C] Add an accessor for the "value type" of a global

Summary: Before this, there was no reasonable way to retrieve the type of a global value (most notably, a function) that was created with  the C API.

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits

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

llvm-svn: 343363

5 years ago[WebAssembly] Fix memory leak on WasmEHFuncInfo
Heejin Ahn [Fri, 28 Sep 2018 20:54:04 +0000 (20:54 +0000)]
[WebAssembly] Fix memory leak on WasmEHFuncInfo

Summary: WasmEHFuncInfo objects were not being properly deleted.

Reviewers: dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 343362

5 years ago[ARM] Fix correctness checks in promoteToConstantPool.
Eli Friedman [Fri, 28 Sep 2018 20:27:31 +0000 (20:27 +0000)]
[ARM] Fix correctness checks in promoteToConstantPool.

Correctly check for relocations in the constant to promote. And don't
allow promoting a constant multiple times.

This partially fixes https://bugs.llvm.org//show_bug.cgi?id=32780 ;
it's not a complete fix because we also need to prevent
ARMConstantIslands from cloning the constant.

(-arm-promote-constant is currently off by default, and it stays off
with this patch. I'll look into turning it on again when all the known
issues are fixed.)

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

llvm-svn: 343361

5 years agoSupport enums with a fixed underlying type in all language modes.
Erik Pilkington [Fri, 28 Sep 2018 20:24:58 +0000 (20:24 +0000)]
Support enums with a fixed underlying type in all language modes.

Previously we supported these in C++, ObjC, and C with -fms-extensions.

rdar://43831380

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

llvm-svn: 343360

5 years ago[ARM] Use preferred alignment for constants in promoteToConstantPool.
Eli Friedman [Fri, 28 Sep 2018 20:21:51 +0000 (20:21 +0000)]
[ARM] Use preferred alignment for constants in promoteToConstantPool.

This mostly affects IR generated by non-clang frontends because clang
generally sets the alignment of globals explicitly.

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

(-arm-promote-constant is currently off by default, and it stays off
with this patch. I'll look into turning it on again when all the known
issues are fixed.)

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

llvm-svn: 343359

5 years ago[ORC] Narrow a cast: the block guarded by the condition only handles
Lang Hames [Fri, 28 Sep 2018 20:16:16 +0000 (20:16 +0000)]
[ORC] Narrow a cast: the block guarded by the condition only handles
GlobalVariables, not all GlobalValues.

llvm-svn: 343358

5 years ago[Driver] Remove unused declarations and "include" directives
Tatyana Krasnukha [Fri, 28 Sep 2018 19:58:03 +0000 (19:58 +0000)]
[Driver] Remove unused declarations and "include" directives

llvm-svn: 343357

5 years ago[OPENMP]Fix PR39084: Check datasharing attributes of reduction variables only.
Alexey Bataev [Fri, 28 Sep 2018 19:33:14 +0000 (19:33 +0000)]
[OPENMP]Fix PR39084: Check datasharing attributes of reduction variables only.

According to OpenMP, the reduction item must be shared in parent region.
But the item can be an array section or array subscript. In this case,
we should not check for the datasharing of the base declaration.

llvm-svn: 343356

5 years ago[X86] Add test cases for failures to use narrow test with immediate instructions...
Craig Topper [Fri, 28 Sep 2018 19:06:28 +0000 (19:06 +0000)]
[X86] Add test cases for failures to use narrow test with immediate instructions when a truncate is beteen the CMP and the AND and the sign flag is used.

The code in X86ISelDAGToDAG only looks through truncates if the sign flag isn't used, but that is overly restrictive. A future patch will improve this.

llvm-svn: 343355

5 years ago[AArch64] Split zero cycle feature more granularly
Evandro Menezes [Fri, 28 Sep 2018 19:05:09 +0000 (19:05 +0000)]
[AArch64] Split zero cycle feature more granularly

Split the `zcz` feature into specific ones got GP and FP registers, `zcz-gp`
and `zcz-fp`, respectively, while retaining the original feature option to
mean both.

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

llvm-svn: 343354

5 years ago[analyzer] [NFC] Remove unused parameters, as found by -Wunused-parameter
George Karpenkov [Fri, 28 Sep 2018 18:49:41 +0000 (18:49 +0000)]
[analyzer] [NFC] Remove unused parameters, as found by -Wunused-parameter

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

llvm-svn: 343353

5 years ago[analyzer] Provide an option to dump generated exploded graphs to a given file.
George Karpenkov [Fri, 28 Sep 2018 18:49:21 +0000 (18:49 +0000)]
[analyzer] Provide an option to dump generated exploded graphs to a given file.

Dumping graphs instead of opening them is often very useful,
e.g. for transfer or converting to SVG.

Basic sanity check for generated exploded graphs.

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

llvm-svn: 343352

5 years agoGraphWriter: Provide an API for writing a graph into a specified file
George Karpenkov [Fri, 28 Sep 2018 18:49:01 +0000 (18:49 +0000)]
GraphWriter: Provide an API for writing a graph into a specified file

Always generating a temporary file is not always suitable, especially for tests

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

llvm-svn: 343351

5 years ago[cxx2a] P0614R1: Support init-statements in range-based for loops.
Richard Smith [Fri, 28 Sep 2018 18:44:09 +0000 (18:44 +0000)]
[cxx2a] P0614R1: Support init-statements in range-based for loops.

We don't yet support this for the case where a range-based for loop is
implicitly rewritten to an ObjC for..in statement.

llvm-svn: 343350

5 years ago[DAGCombiner] [NFC] Improve X div/rem 1 fold
David Bolvansky [Fri, 28 Sep 2018 18:40:30 +0000 (18:40 +0000)]
[DAGCombiner] [NFC] Improve X div/rem 1 fold

Reviewers: spatel

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 343349

5 years agoClean-up usage of OptionDefinition arrays
Tatyana Krasnukha [Fri, 28 Sep 2018 17:58:16 +0000 (17:58 +0000)]
Clean-up usage of OptionDefinition arrays

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

llvm-svn: 343348

5 years agomake lit builtins a package
Chris Matthews [Fri, 28 Sep 2018 17:55:18 +0000 (17:55 +0000)]
make lit builtins a package

cat.py is not being installed when lit is installed from source. So
tests that use the internal shell fail when using cat.

llvm-svn: 343347

5 years ago[llvm-mca] Add a test for zero-idiom VPERM2F128rr. NFC
Andrea Di Biagio [Fri, 28 Sep 2018 17:47:09 +0000 (17:47 +0000)]
[llvm-mca] Add a test for zero-idiom VPERM2F128rr. NFC

We don't correctly model the latency and resource usage information for
zero-idiom VPERM2F128rr on Jaguar.

This is demonstrated by the incorrect numbers in the resource pressure view, and
the timeline view.
A follow up patch will fix this problem.

llvm-svn: 343346

5 years ago[bindings/go] Add Go bindings to the Token type
whitequark [Fri, 28 Sep 2018 17:39:59 +0000 (17:39 +0000)]
[bindings/go] Add Go bindings to the Token type

Summary: This type is necessary for implementing coroutines.

Reviewers: whitequark

Reviewed By: whitequark

Subscribers: modocache, llvm-commits

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

llvm-svn: 343345

5 years ago[OPENMP] Add the test to check that the libomptarget does not cause
Alexey Bataev [Fri, 28 Sep 2018 17:13:11 +0000 (17:13 +0000)]
[OPENMP] Add the test to check that the libomptarget does not cause
infinite loop on removing non-mapped pointer-with-object.

Added test to check that libomptarget does not cause infinite loop when
trying to unmap the pointer-with-object data that was not previously
mapped.

llvm-svn: 343344

5 years ago[X86] Add the movbe instruction intrinsics from icc.
Craig Topper [Fri, 28 Sep 2018 17:09:51 +0000 (17:09 +0000)]
[X86] Add the movbe instruction intrinsics from icc.

These intrinsics exist in icc. They can be found on the Intel Intrinsics Guide website.

All the backend support is in place to pattern match a load+bswap or a bswap+store pattern to the MOVBE instructions. So we just need to get the frontend to emit the correct IR. The pointer arguments in icc are declared as void so I had to jump through a packed struct to forcing a specific alignment on the load/store. Same trick we use in the unaligned vector load/store intrinsics

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

llvm-svn: 343343

5 years agoRevert r343318 together with llvm commit r343317
Luke Cheeseman [Fri, 28 Sep 2018 17:02:56 +0000 (17:02 +0000)]
Revert r343318 together with llvm commit r343317

llvm-svn: 343342

5 years agoRevert r343317
Luke Cheeseman [Fri, 28 Sep 2018 17:01:50 +0000 (17:01 +0000)]
Revert r343317

- asan buildbots are breaking and I need to investigate the issue

llvm-svn: 343341

5 years ago[WebAssembly] Preserve function signatures during LTO
Sam Clegg [Fri, 28 Sep 2018 16:50:14 +0000 (16:50 +0000)]
[WebAssembly] Preserve function signatures during LTO

With LTO when and undefined function (with a known signature)
in replaced by a defined bitcode function we were loosing the
signature information (since bitcode functions don't have
signatures).

With this change we preserve the original signature from the
undefined function and verify that the post LTO compiled
function has the correct signature.

This change improves the error handling in the case where
there is a signature mismatch with a function defined in
a bitcode file.

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

llvm-svn: 343340

5 years ago[bindings/go] Add Go bindings for inline assembly
whitequark [Fri, 28 Sep 2018 16:48:47 +0000 (16:48 +0000)]
[bindings/go] Add Go bindings for inline assembly

Reviewers: harlanhaskins, whitequark, pcc

Reviewed By: pcc

Subscribers: llvm-commits

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

llvm-svn: 343339

5 years agoAST: add missing ObjC extensions to MS style name decoration
Saleem Abdulrasool [Fri, 28 Sep 2018 16:47:53 +0000 (16:47 +0000)]
AST: add missing ObjC extensions to MS style name decoration

Add support for encoding type arguments for lightweight generics in
Objective-C++ mode.  Additionally, add support for the `__kindof` modifier.
This should complete the coverage of the ObjC extensions that clang currently
supports under the MS style name decoration scheme.

This is implemented similar to the Objective-C lifetime qualifiers decoration:
a template specialization in the `__ObjC` namespace so that we can interoperate
with Microsoft's tools as well as ensure that we do not accidentally collide
with new features in the Microsoft implementation.

Since the `__kindof` appertains to the type and not the pointer, we apply the
template specialization to the underlying type instead of the pointer type.

Unfortunately, until D52581 is resolved, the generated name is not really
compatible with the MS tools as well as breaks interoperability with
Objective-C++ and C++.

This resolves PR37754!

llvm-svn: 343338

5 years agoRevert "[LLVM-C] Add bindings for addCoroutinePassesToExtensionPoints"
whitequark [Fri, 28 Sep 2018 16:45:18 +0000 (16:45 +0000)]
Revert "[LLVM-C] Add bindings for addCoroutinePassesToExtensionPoints"

This reverts commit c4baf7c2f06ff5459c4f5998ce980346e72bff97.

Broke the bots, and should really be in Transforms/Coroutines
instead.

llvm-svn: 343337

5 years ago[LLVM-C] Add bindings for addCoroutinePassesToExtensionPoints
whitequark [Fri, 28 Sep 2018 16:38:11 +0000 (16:38 +0000)]
[LLVM-C] Add bindings for addCoroutinePassesToExtensionPoints

Summary: This patch adds bindings to C and Go for addCoroutinePassesToExtensionPoints, which is used to add coroutine passes to the correct locations in PassManagerBuilder.

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: mehdi_amini, modocache, llvm-commits

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

llvm-svn: 343336

5 years ago[DRIVER][OFFLOAD] Do not invoke unbundler on unsupported file types.
Alexey Bataev [Fri, 28 Sep 2018 16:17:59 +0000 (16:17 +0000)]
[DRIVER][OFFLOAD] Do not invoke unbundler on unsupported file types.

clang-offload-bundler should not be invoked with the unbundling action
when the input file type does not match the action type. For example,
.so files should be unbundled during linking phase and should be linked
only with the host code.

llvm-svn: 343335

5 years ago[LLVM-C] Fix broken build bots
Robert Widmann [Fri, 28 Sep 2018 16:02:26 +0000 (16:02 +0000)]
[LLVM-C] Fix broken build bots

Summary: Fix broken bots caused by the merge of D51522.

Reviewers: whitequark

Subscribers: llvm-commits

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

llvm-svn: 343334

5 years ago[utils] Cope with the binary having a .exe extension in update_mca_test_checks.py
Greg Bedwell [Fri, 28 Sep 2018 15:39:18 +0000 (15:39 +0000)]
[utils] Cope with the binary having a .exe extension in update_mca_test_checks.py

llvm-svn: 343333

5 years ago[utils] Stricter checking from update_mca_test_checks.py
Greg Bedwell [Fri, 28 Sep 2018 15:39:09 +0000 (15:39 +0000)]
[utils] Stricter checking from update_mca_test_checks.py

If any prefixes have been specified on the RUN lines that do not end up
ever actually getting printed, raise an Error. This is either an
indication that the run lines just need cleaning up, or that something
is more fundamentally wrong with the test.

Also raise an Error if there are any blocks which cannot be checked
because they are not uniquely covered by a prefix.

Fixed up a couple of tests where the extra checking flagged up issues.

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

llvm-svn: 343332