llvm
7 years agoMerging r323810:
Hans Wennborg [Wed, 31 Jan 2018 08:57:32 +0000 (08:57 +0000)]
Merging r323810:
------------------------------------------------------------------------
r323810 | mstorsjo | 2018-01-30 20:50:51 +0100 (Tue, 30 Jan 2018) | 3 lines

[AArch64] Properly handle dllimport of variables when using fast-isel

Differential Revision: https://reviews.llvm.org/D42567
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@323852 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r323706:
Hans Wennborg [Tue, 30 Jan 2018 15:29:20 +0000 (15:29 +0000)]
Merging r323706:
------------------------------------------------------------------------
r323706 | mareko | 2018-01-30 00:19:10 +0100 (Tue, 30 Jan 2018) | 15 lines

AMDGPU: Allow a SGPR for the conditional KILL operand

Patch by: Bas Nieuwenhuizen

Just use the _e64 variant if needed. This should be possible as per

def : Pat <
  (int_amdgcn_kill (i1 (setcc f32:$src, InlineFPImm<f32>:$imm, cond:$cond))),
  (SI_KILL_F32_COND_IMM_PSEUDO $src, (bitcast_fpimm_to_i32 $imm), (cond_as_i32imm $cond))
> ;

I don't think we can get an immediate for the other operand for which we
need the second 32-bit word.

https://reviews.llvm.org/D42302
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@323772 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r323515:
Hans Wennborg [Tue, 30 Jan 2018 15:25:02 +0000 (15:25 +0000)]
Merging r323515:
------------------------------------------------------------------------
r323515 | fhahn | 2018-01-26 11:36:50 +0100 (Fri, 26 Jan 2018) | 7 lines

[CallSiteSplitting] Fix infinite loop when recording conditions.

Fix infinite loop when recording conditions by correctly marking basic
blocks as visited.

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

------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@323771 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r323469:
Hans Wennborg [Tue, 30 Jan 2018 15:22:31 +0000 (15:22 +0000)]
Merging r323469:
------------------------------------------------------------------------
r323469 | ctopper | 2018-01-25 22:23:57 +0100 (Thu, 25 Jan 2018) | 3 lines

[X86] Teach Intel syntax InstPrinter to print lock prefixes that have been parsed from the asm parser.

The asm parser puts the lock prefix in the MCInst flags so we need to check that in addition to TSFlags. This matches what the ATT printer does.
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@323770 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r323355:
Hans Wennborg [Tue, 30 Jan 2018 11:17:13 +0000 (11:17 +0000)]
Merging r323355:
------------------------------------------------------------------------
r323355 | nha | 2018-01-24 19:02:05 +0100 (Wed, 24 Jan 2018) | 9 lines

Revert r321751, "StructurizeCFG: Fix broken backedge detection"

It causes regressions in various OpenGL test suites.

Keep the test cases introduced by r321751 as XFAIL, and add a test case
for the regression.

Change-Id: I90b4cc354f68cebe5fcef1f2422dc8fe1c6d3514
Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=36015
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@323749 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r323710:
Hans Wennborg [Tue, 30 Jan 2018 10:53:45 +0000 (10:53 +0000)]
Merging r323710:
------------------------------------------------------------------------
r323710 | qcolombet | 2018-01-30 00:42:37 +0100 (Tue, 30 Jan 2018) | 13 lines

[RAFast] Don't dereference MBB::end

When RAFast sees liveins in on a basic block, it uses that information
to initialize the availability of the registers. The called
method uses an instruction as one of its argument and in the liveins
case, RAFast was dereferencing MBB::begin which can be MBB::end for
empty basic block.

Change the API of definePhysReg to use MachineBasicBlock::iterator
instead of MachineInstr so that we don't dereference an
invalid iterator while making the call.

rdar://problem/36952401
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@323746 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r323672: (test-case re-generated)
Hans Wennborg [Tue, 30 Jan 2018 10:30:33 +0000 (10:30 +0000)]
Merging r323672: (test-case re-generated)
------------------------------------------------------------------------
r323672 | ctopper | 2018-01-29 18:56:57 +0100 (Mon, 29 Jan 2018) | 5 lines

[X86] Don't create SHRUNKBLEND when the condition is used by the true or false operand of the vselect.

Fixes PR34592.

Differential Revision: https://reviews.llvm.org/D42628
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@323743 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r323582:
Hans Wennborg [Tue, 30 Jan 2018 10:19:03 +0000 (10:19 +0000)]
Merging r323582:
------------------------------------------------------------------------
r323582 | aemerson | 2018-01-27 08:07:20 +0100 (Sat, 27 Jan 2018) | 6 lines

[GlobalISel][Legalizer] Convert the FP constants to the right APFloat type for G_FCONSTANT.

We weren't converting the immediate ConstantFP during legalization, which caused
the wrong bit patterns to be emitted for half type FP constants.

Fixes PR36106.
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@323742 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r322016:
Hans Wennborg [Tue, 30 Jan 2018 09:57:17 +0000 (09:57 +0000)]
Merging r322016:
------------------------------------------------------------------------
r322016 | spatel | 2018-01-08 19:31:13 +0100 (Mon, 08 Jan 2018) | 8 lines

[ValueTracking] remove overzealous assert

The test is derived from a failing fuzz test:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5008

Credit to @rksimon for pointing out the problem.

------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@323740 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert r323738; that was not the one I wanted to merge
Hans Wennborg [Tue, 30 Jan 2018 09:55:31 +0000 (09:55 +0000)]
Revert r323738; that was not the one I wanted to merge

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@323739 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r322006:
Hans Wennborg [Tue, 30 Jan 2018 09:52:39 +0000 (09:52 +0000)]
Merging r322006:
------------------------------------------------------------------------
r322006 | davide | 2018-01-08 17:34:06 +0100 (Mon, 08 Jan 2018) | 19 lines

[CVP] Replace incoming values from unreachable blocks with undef.

This is an attempt of fixing PR35807.
Due to the non-standard definition of dominance in LLVM, where uses in
unreachable blocks are dominated by anything, you can have, in an
unreachable block:

  %patatino = OP1 %patatino, CONSTANT

When `SimplifyInstruction` receives a PHI where an incoming value is of
the aforementioned form, in some cases, loops indefinitely.

What I propose here instead is keeping track of the incoming values
from unreachable blocks, and replacing them with undef. It fixes this
case, and it seems to be good regardless (even if we can't prove that
the value is constant, as it's coming from an unreachable block, we
can ignore it).

Differential Revision:  https://reviews.llvm.org/D41812
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@323738 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r323331:
Hans Wennborg [Tue, 30 Jan 2018 09:48:42 +0000 (09:48 +0000)]
Merging r323331:
------------------------------------------------------------------------
r323331 | spatel | 2018-01-24 16:20:37 +0100 (Wed, 24 Jan 2018) | 21 lines

[ValueTracking] add recursion depth param to matchSelectPattern

We're getting bug reports:
https://bugs.llvm.org/show_bug.cgi?id=35807
https://bugs.llvm.org/show_bug.cgi?id=35840
https://bugs.llvm.org/show_bug.cgi?id=36045
...where we blow up the stack in value tracking because other passes are sending
in selects that have an operand that is itself the select.

We don't currently have a reliable way to avoid analyzing dead code that may take
non-standard forms, so bail out when things go too far.

This mimics the recursion depth limitations in other parts of value tracking.

Unfortunately, this pushes the underlying problems for other passes (jump-threading,
simplifycfg, correlated-propagation) into hiding. If someone wants to uncover those
again, the first draft of this patch on Phab would do that (it would assert rather
than bail out).

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

------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@323737 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r322108, r322123 and r322131:
Hans Wennborg [Tue, 30 Jan 2018 09:31:00 +0000 (09:31 +0000)]
Merging r322108, r322123 and r322131:

------------------------------------------------------------------------
r322108 | rafael | 2018-01-09 20:29:33 +0100 (Tue, 09 Jan 2018) | 3 lines

Make one of the emitFill methods non virtual. NFC.

This is just preparatory work to fix PR35858.
------------------------------------------------------------------------

------------------------------------------------------------------------
r322123 | rafael | 2018-01-09 22:55:10 +0100 (Tue, 09 Jan 2018) | 3 lines

Don't create MCFillFragment directly.

Instead use higher level APIs that take care of most bookkeeping.
------------------------------------------------------------------------

------------------------------------------------------------------------
r322131 | rafael | 2018-01-09 23:48:37 +0100 (Tue, 09 Jan 2018) | 4 lines

Use a MCExpr for the size of MCFillFragment.

This allows the size to be found during ralaxation. This fixes
pr35858.
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@323735 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r323384:
Hans Wennborg [Fri, 26 Jan 2018 12:03:01 +0000 (12:03 +0000)]
Merging r323384:
------------------------------------------------------------------------
r323384 | aemerson | 2018-01-24 23:40:25 +0100 (Wed, 24 Jan 2018) | 1 line

[GlobalISel] Add a requires: asserts to a test.
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@323523 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r323369 and r323371:
Hans Wennborg [Thu, 25 Jan 2018 15:28:01 +0000 (15:28 +0000)]
Merging r323369 and r323371:

------------------------------------------------------------------------
r323369 | aemerson | 2018-01-24 20:59:29 +0100 (Wed, 24 Jan 2018) | 4 lines

[GlobalISel] Don't fall back to FastISel.

Apparently checking the pass structure isn't enough to ensure that we don't fall
back to FastISel, as it's set up as part of the SelectionDAGISel.
------------------------------------------------------------------------

------------------------------------------------------------------------
r323371 | aemerson | 2018-01-24 21:35:37 +0100 (Wed, 24 Jan 2018) | 12 lines

[AArch64][GlobalISel] Fall back during AArch64 isel if we have a volatile load.

The tablegen imported patterns for sext(load(a)) don't check for single uses
of the load or delete the original after matching. As a result two loads are
left in the generated code. This particular issue will be fixed by adding
support for a G_SEXTLOAD opcode in future.

There are however other potential issues around this that wouldn't be fixed by
a G_SEXTLOAD, so until we have a proper solution we don't try to handle volatile
loads at all in the AArch64 selector.

Fixes/works around PR36018.
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@323434 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r322900 and r323307:
Hans Wennborg [Wed, 24 Jan 2018 15:53:46 +0000 (15:53 +0000)]
Merging r322900 and r323307:

------------------------------------------------------------------------
r322900 | mstorsjo | 2018-01-18 22:21:48 +0100 (Thu, 18 Jan 2018) | 6 lines

[test] Actually check the common parts in CodeGen/ARM/global-merge-external.ll. NFC.

Previously, these parts weren't ever checked. The label patterns
need to be extended to match successfully on macho.

Differential Revision: https://reviews.llvm.org/D42126
------------------------------------------------------------------------

------------------------------------------------------------------------
r323307 | mstorsjo | 2018-01-24 07:40:04 +0100 (Wed, 24 Jan 2018) | 6 lines

[GlobalMerge] Don't merge dllexport globals

Merging such globals loses the dllexport attribute. Add a test
to check that normal globals still are merged.

Differential Revision: https://reviews.llvm.org/D42127
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@323337 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r323190:
Hans Wennborg [Wed, 24 Jan 2018 15:38:38 +0000 (15:38 +0000)]
Merging r323190:
------------------------------------------------------------------------
r323190 | rksimon | 2018-01-23 12:39:06 +0100 (Tue, 23 Jan 2018) | 5 lines

[X86][SSE] LowerBUILD_VECTORAsVariablePermute - fix PSHUFB source/index operand ordering

As detailed in rL317463, PSHUFB (like most variable shuffle instructions) uses Op[0] for the source vector and Op[1] for the shuffle index vector, VPERMV works in reverse which is probably where the confusion comes from.

Differential Revision: https://reviews.llvm.org/D42380
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@323335 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r322372 and r322767:
Hans Wennborg [Wed, 24 Jan 2018 15:33:33 +0000 (15:33 +0000)]
Merging r322372 and r322767:

------------------------------------------------------------------------
r322372 | nemanjai | 2018-01-12 15:58:41 +0100 (Fri, 12 Jan 2018) | 10 lines

[PowerPC] Zero-extend the compare operand for ATOMIC_CMP_SWAP

Part of the fix for https://bugs.llvm.org/show_bug.cgi?id=35812.
This patch ensures that the compare operand for the atomic compare and swap
is properly zero-extended to 32 bits if applicable.
A follow-up commit will fix the extension for the SETCC node generated when
expanding an ATOMIC_CMP_SWAP_WITH_SUCCESS. That will complete the bug fix.

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

------------------------------------------------------------------------

------------------------------------------------------------------------
r322767 | efriedma | 2018-01-17 23:04:36 +0100 (Wed, 17 Jan 2018) | 12 lines

[LegalizeDAG] Fix ATOMIC_CMP_SWAP_WITH_SUCCESS legalization.

The code wasn't zero-extending correctly, so the comparison could
spuriously fail.

Adds some AArch64 tests to cover this case.

Inspired by D41791.

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

------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@323334 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReleaseNotes: mention improved codeview quality
Hans Wennborg [Wed, 24 Jan 2018 15:24:14 +0000 (15:24 +0000)]
ReleaseNotes: mention improved codeview quality

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@323332 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd external project LDC to release notes.
Kai Nacke [Tue, 23 Jan 2018 11:03:55 +0000 (11:03 +0000)]
Add external project LDC to release notes.

LDC, the LLVM-based D compiler, is already ready for LLVM 6.0.0.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@323186 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r323034:
Hans Wennborg [Mon, 22 Jan 2018 15:16:37 +0000 (15:16 +0000)]
Merging r323034:
------------------------------------------------------------------------
r323034 | dmgreen | 2018-01-20 11:29:37 +0100 (Sat, 20 Jan 2018) | 9 lines

[Dominators] Fix some edge cases for PostDomTree updating

These fix some odd cfg cases where batch-updating the post
dom tree fails. Usually around infinite loops and roots
ending up being different.

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

------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@323121 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r322993:
Hans Wennborg [Mon, 22 Jan 2018 13:01:28 +0000 (13:01 +0000)]
Merging r322993:
------------------------------------------------------------------------
r322993 | kuhar | 2018-01-19 22:27:24 +0100 (Fri, 19 Jan 2018) | 16 lines

[Dominators] Visit affected node candidates found at different root levels

Summary:
This patch attempts to fix the DomTree incremental insertion bug found here [[ https://bugs.llvm.org/show_bug.cgi?id=35969 | PR35969 ]] .

When performing an insertion into a piece of unreachable CFG, we may find the same not at different levels. When this happens, the node can turn out to be affected when we find it starting from a node with a lower level in the tree. The level at which we start visitation affects if we consider a node affected or not.

This patch tracks the lowest level at which each node was visited during insertion and allows it to be visited multiple times, if it can cause it to be considered affected.

Reviewers: brzycki, davide, dberlin, grosser

Reviewed By: brzycki

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D42231
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@323110 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r322973:
Hans Wennborg [Mon, 22 Jan 2018 12:48:06 +0000 (12:48 +0000)]
Merging r322973:
------------------------------------------------------------------------
r322973 | mgorny | 2018-01-19 18:47:03 +0100 (Fri, 19 Jan 2018) | 7 lines

[cmake] Include LLVM_LIBXML2_ENABLED in LLVMConfig.cmake, PR36006

Include the LLVM_LIBXML2_ENABLED cache variable in LLVMConfig.cmake
in order to make it available for other LLVM packages to query. This
is necessary to fix stand-alone testing of LLD.

Differential Revision: https://reviews.llvm.org/D42252
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@323107 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r322878:
Hans Wennborg [Mon, 22 Jan 2018 11:56:34 +0000 (11:56 +0000)]
Merging r322878:
------------------------------------------------------------------------
r322878 | aemerson | 2018-01-18 20:21:27 +0100 (Thu, 18 Jan 2018) | 5 lines

[AArch64][GlobalISel] Add isel support for global values in the large code model.

Fixes PR35958.

Differential Revision: https://reviews.llvm.org/D42175
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@323103 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r322875:
Dimitry Andric [Sat, 20 Jan 2018 12:20:35 +0000 (12:20 +0000)]
Merging r322875:
------------------------------------------------------------------------
r322875 | dim | 2018-01-18 19:39:13 +0100 (Thu, 18 Jan 2018) | 9 lines

Add a -no-libcxxabi option to the test-release.sh script.

On FreeBSD, it is currently not possible to build libcxxabi and link
against it, so we have been building releases with -no-libs for quite
some time.

However, libcxx and libunwind should build without problems, so provide
an option to skip just libcxxabi.

------------------------------------------------------------------------
Merging r322879:
------------------------------------------------------------------------
r322879 | dim | 2018-01-18 20:30:30 +0100 (Thu, 18 Jan 2018) | 2 lines

Follow-up to rL322875 by initializing the do_libcxxabi variable properly.

------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@323038 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r322053:
Hans Wennborg [Fri, 19 Jan 2018 15:59:49 +0000 (15:59 +0000)]
Merging r322053:
------------------------------------------------------------------------
r322053 | echristo | 2018-01-09 03:38:17 +0100 (Tue, 09 Jan 2018) | 1 line

Remove unused function HvxSelector::zerous.
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@322953 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r322644:
Hans Wennborg [Thu, 18 Jan 2018 11:37:05 +0000 (11:37 +0000)]
Merging r322644:
------------------------------------------------------------------------
r322644 | d0k | 2018-01-17 05:01:06 -0800 (Wed, 17 Jan 2018) | 7 lines

[X86] Don't mutate shuffle arguments after early-out for AVX512

The match* functions have the annoying behavior of modifying its inputs.
Save and restore the inputs, just in case the early out for AVX512 is
hit. This is still not great and its only a matter of time this kind of
bug happens again, but I couldn't come up with a better pattern without
rewriting significant chunks of this code. Fixes PR35977.
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@322840 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r322724:
Hans Wennborg [Thu, 18 Jan 2018 11:16:33 +0000 (11:16 +0000)]
Merging r322724:
------------------------------------------------------------------------
r322724 | ctopper | 2018-01-17 10:46:01 -0800 (Wed, 17 Jan 2018) | 7 lines

[X86] When legalizing (v64i1 select i8, v64i1, v64i1) make sure not to introduce bitcasts to i64 in 32-bit mode

We legalize selects of masks with scalar conditions using a bitcast to an integer type. But if we are in 32-bit mode we can't convert v64i1 to i64. So instead split the v64i1 to v32i1 and concat it back together. Each half will then be legalized by bitcasting to i32 which is fine.

The test case is a little indirect. If we have the v64i1 select in IR it will get legalized by legalize vector ops which has a run of type legalization after it. That type legalization run is able to fix this i64 bitcast. So in order to avoid that we need a build_vector of a splat which legalize vector ops will ignore. Legalize DAG will then turn that into a select via LowerBUILD_VECTORvXi1. And the select will get legalized. In this case there is no type legalizer run to cleanup the bitcast.

This fixes pr35972.
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@322835 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r322003:
Hans Wennborg [Wed, 17 Jan 2018 17:48:09 +0000 (17:48 +0000)]
Merging r322003:
------------------------------------------------------------------------
r322003 | niravd | 2018-01-08 08:21:35 -0800 (Mon, 08 Jan 2018) | 11 lines

[DAG] Teach BaseIndexOffset to correctly handle with indexed operations

BaseIndexOffset address analysis incorrectly ignores offsets folded
into indexed memory operations causing potential errors in alias
analysis of pre-indexed operations.

Reviewers: efriedma, RKSimon, hfinkel, jyknight

Subscribers: hiraditya, javed.absar, llvm-commits

Differential Revision: https://reviews.llvm.org/D41701
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@322693 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r321751, r321806, and r321878:
Hans Wennborg [Wed, 17 Jan 2018 16:33:44 +0000 (16:33 +0000)]
Merging r321751, r321806, and r321878:

------------------------------------------------------------------------
r321751 | arsenm | 2018-01-03 10:45:37 -0800 (Wed, 03 Jan 2018) | 25 lines

StructurizeCFG: Fix broken backedge detection

The work order was changed in r228186 from SCC order
to RPO with an arbitrary sorting function. The sorting
function attempted to move inner loop nodes earlier. This
was was apparently relying on an assumption that every block
in a given loop / the same loop depth would be seen before
visiting another loop. In the broken testcase, a block
outside of the loop was encountered before moving onto
another block in the same loop. The testcase would then
structurize such that one blocks unconditional successor
could never be reached.

Revert to plain RPO for the analysis phase. This fixes
detecting edges as backedges that aren't really.

The processing phase does use another visited set, and
I'm unclear on whether the order there is as important.
An arbitrary order doesn't work, and triggers some infinite
loops. The reversed RPO list seems to work and is closer
to the order that was used before, minus the arbitary
custom sorting.

A few of the changed tests now produce smaller code,
and a few are slightly worse looking.
------------------------------------------------------------------------

------------------------------------------------------------------------
r321806 | arsenm | 2018-01-04 09:23:24 -0800 (Thu, 04 Jan 2018) | 4 lines

StructurizeCFG: xfail one of the testcases from r321751

It fails with -verify-region-info. This seems to be a issue
with RegionInfo itself which existed before.
------------------------------------------------------------------------

------------------------------------------------------------------------
r321878 | arsenm | 2018-01-05 09:51:36 -0800 (Fri, 05 Jan 2018) | 4 lines

RegionInfo: Use report_fatal_error instead of llvm_unreachable

Otherwise when using -verify-region-info in a release build the
error won't be emitted.
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@322686 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r322313:
Hans Wennborg [Wed, 17 Jan 2018 16:29:10 +0000 (16:29 +0000)]
Merging r322313:
------------------------------------------------------------------------
r322313 | matze | 2018-01-11 13:57:03 -0800 (Thu, 11 Jan 2018) | 18 lines

PeepholeOptimizer: Do not form PHI with subreg arguments

When replacing a PHI the PeepholeOptimizer currently takes the register
class of the register at the first operand. This however is not correct
if this argument has a subregister index.

As there is currently no API to query the register class resulting from
applying a subregister index to all registers in a class, we can only
abort in these cases and not perform the transformation.

This changes findNextSource() to require the end of all copy chains to
not use a subregister if there is any PHI in the chain. I had to rewrite
the overly complicated inner loop there to have a good place to insert
the new check.

This fixes https://llvm.org/PR33071 (aka rdar://32262041)

Differential Revision: https://reviews.llvm.org/D40758
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@322684 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r322223:
Hans Wennborg [Wed, 17 Jan 2018 16:24:35 +0000 (16:24 +0000)]
Merging r322223:
------------------------------------------------------------------------
r322223 | matze | 2018-01-10 12:49:57 -0800 (Wed, 10 Jan 2018) | 5 lines

TargetLoweringBase: The ios simulator has no bzero function.

Make sure I really get back to the beahvior before my rewrite in r321035
which turned out not to be completely NFC as I changed the behavior for
the ios simulator environment.
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@322681 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r322106:
Hans Wennborg [Wed, 17 Jan 2018 16:20:48 +0000 (16:20 +0000)]
Merging r322106:
------------------------------------------------------------------------
r322106 | abataev | 2018-01-09 11:08:22 -0800 (Tue, 09 Jan 2018) | 11 lines

[COST]Fix PR35865: Fix cost model evaluation for shuffle on X86.

Summary:
If the vector type is transformed to non-vector single type, the compile
may crash trying to get vector information about non-vector type.

Reviewers: RKSimon, spatel, mkuper, hfinkel

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D41862
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@322680 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r322272:
Hans Wennborg [Wed, 17 Jan 2018 16:18:37 +0000 (16:18 +0000)]
Merging r322272:
------------------------------------------------------------------------
r322272 | zvi | 2018-01-11 04:26:52 -0800 (Thu, 11 Jan 2018) | 15 lines

X86: Fix LowerBUILD_VECTORAsVariablePermute for case Src is smaller than Indices

Summary:
As RKSimon suggested in pr35820, in the case that Src is smaller in
bit-size than Indices, need to widen Src to avoid type mismatch.

Fixes pr35820

Reviewers: RKSimon, craig.topper

Reviewed By: RKSimon

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D41865
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@322679 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r321870, r321872, and r321994:
Hans Wennborg [Wed, 17 Jan 2018 16:04:05 +0000 (16:04 +0000)]
Merging r321870, r321872, and r321994:

------------------------------------------------------------------------
r321870 | abataev | 2018-01-05 07:20:40 -0800 (Fri, 05 Jan 2018) | 1 line

[SLP] Update test checks, NFC.
------------------------------------------------------------------------

------------------------------------------------------------------------
r321872 | abataev | 2018-01-05 08:15:17 -0800 (Fri, 05 Jan 2018) | 1 line

[SLP] Update more test checks, NFC.
------------------------------------------------------------------------

------------------------------------------------------------------------
r321994 | abataev | 2018-01-08 06:43:06 -0800 (Mon, 08 Jan 2018) | 13 lines

[SLP] Fix PR35777: Incorrect handling of aggregate values.

Summary:
Fixes the bug with incorrect handling of InsertValue|InsertElement
instrucions in SLP vectorizer. Currently, we may use incorrect
ExtractElement instructions as the operands of the original
InsertValue|InsertElement instructions.

Reviewers: mkuper, hfinkel, RKSimon, spatel

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D41767
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@322675 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r322473:
Hans Wennborg [Wed, 17 Jan 2018 15:57:43 +0000 (15:57 +0000)]
Merging r322473:
------------------------------------------------------------------------
r322473 | a.elovikov | 2018-01-15 02:56:07 -0800 (Mon, 15 Jan 2018) | 23 lines

[LV] Don't call recordVectorLoopValueForInductionCast for newly-created IV from a trunc.

Summary:
This method is supposed to be called for IVs that have casts in their use-def
chains that are completely ignored after vectorization under PSE. However, for
truncates of such IVs the same InductionDescriptor is used during
creation/widening of both original IV based on PHINode and new IV based on
TruncInst.

This leads to unintended second call to recordVectorLoopValueForInductionCast
with a VectorLoopVal set to the newly created IV for a trunc and causes an
assert due to attempt to store new information for already existing entry in the
map. This is wrong and should not be done.

Fixes PR35773.

Reviewers: dorit, Ayal, mssimpso

Reviewed By: dorit

Subscribers: RKSimon, dim, dcaballe, hsaito, llvm-commits, hiraditya

Differential Revision: https://reviews.llvm.org/D41913
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@322673 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r321791 and r321862:
Hans Wennborg [Wed, 17 Jan 2018 15:54:25 +0000 (15:54 +0000)]
Merging r321791 and r321862:
------------------------------------------------------------------------
r321791 | sam_parker | 2018-01-04 01:42:27 -0800 (Thu, 04 Jan 2018) | 4 lines

[X86] Codegen test for PR37563

Adding test to ease review of D41628.

------------------------------------------------------------------------

------------------------------------------------------------------------
r321862 | sam_parker | 2018-01-05 00:47:23 -0800 (Fri, 05 Jan 2018) | 10 lines

[DAGCombine] Fix for PR37563

While searching for loads to be narrowed, equal sized loads were not
added to the list, resulting in anyext loads not being converted to
zext loads.

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

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

------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@322671 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r321991:
Hans Wennborg [Wed, 17 Jan 2018 15:50:27 +0000 (15:50 +0000)]
Merging r321991:
------------------------------------------------------------------------
r321991 | sam_parker | 2018-01-08 05:21:24 -0800 (Mon, 08 Jan 2018) | 9 lines

[DAGCombine] Fix for PR35761

I had falsely assumed that constant operands would be operand(1) of
the bin ops that may need their constant operand to be masked.

Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=35761

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

------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@322670 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r321993:
Hans Wennborg [Wed, 17 Jan 2018 15:47:38 +0000 (15:47 +0000)]
Merging r321993:
------------------------------------------------------------------------
r321993 | abataev | 2018-01-08 06:33:11 -0800 (Mon, 08 Jan 2018) | 11 lines

[SLP] Fix PR35628: Count external uses on extra reduction arguments.

Summary:
If the vectorized value is marked as extra reduction argument, its users
are not considered as external users. Patch fixes this.

Reviewers: mkuper, hfinkel, RKSimon, spatel

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D41786
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@322669 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r322623:
Hans Wennborg [Wed, 17 Jan 2018 13:56:34 +0000 (13:56 +0000)]
Merging r322623:
------------------------------------------------------------------------
r322623 | avt77 | 2018-01-17 02:12:06 -0800 (Wed, 17 Jan 2018) | 3 lines

Allow usage of X86-prefixes as separate instrs.
Differential Revision: https://reviews.llvm.org/D42102

------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@322654 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r322056:
Hans Wennborg [Wed, 17 Jan 2018 13:01:33 +0000 (13:01 +0000)]
Merging r322056:
------------------------------------------------------------------------
r322056 | skatkov | 2018-01-08 20:37:06 -0800 (Mon, 08 Jan 2018) | 13 lines

[CGP] Fix Complex addressing mode for offset

If the offset is differ in two addressing mode we can continue only if
ScaleReg is not set due to we will use it as merge of different offsets.

It should fix PR35799 and PR35805.

Reviewers: john.brawn, reames
Reviewed By: reames
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D41227

------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@322645 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReleaseNotes: add Zig to External Open Source Projects
Hans Wennborg [Tue, 16 Jan 2018 15:50:14 +0000 (15:50 +0000)]
ReleaseNotes: add Zig to External Open Source Projects

Patch by Andrew Kelley!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@322567 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r321980:
Hans Wennborg [Tue, 16 Jan 2018 15:29:26 +0000 (15:29 +0000)]
Merging r321980:
------------------------------------------------------------------------
r321980 | phosek | 2018-01-07 18:23:10 -0800 (Sun, 07 Jan 2018) | 5 lines

[llvm-readobj] Support -needed-libs option for Mach-O files

This implements the -needed-libs option in Mach-O dumper.

Differential Revision: https://reviews.llvm.org/D41527
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@322561 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r321789:
Hans Wennborg [Tue, 16 Jan 2018 15:00:51 +0000 (15:00 +0000)]
Merging r321789:
------------------------------------------------------------------------
r321789 | hiraditya | 2018-01-03 23:47:24 -0800 (Wed, 03 Jan 2018) | 8 lines

[GVNHoist] Fix: PR35222 gvn-hoist incorrectly erases load in case of a loop

Reviewers:
    dberlin
    sebpop
    eli.friedman

Differential Revision: https://reviews.llvm.org/D41453
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@322558 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMerging r322103:
Hans Wennborg [Tue, 16 Jan 2018 12:06:38 +0000 (12:06 +0000)]
Merging r322103:
------------------------------------------------------------------------
r322103 | tejohnson | 2018-01-09 10:32:53 -0800 (Tue, 09 Jan 2018) | 25 lines

Fix crash when linking metadata with ODR type uniquing

Summary:
With DebugTypeODRUniquing enabled, during IR linking debug metadata
in the destination module may be reached from the source module.
This means that ConstantAsMetadata nodes (e.g. on DITemplateValueParameter)
may contain a value the destination module. When trying to map such
metadata nodes, we will attempt to map a GV already in the dest module.
linkGlobalValueProto will end up with a source GV that is the same as
the dest GV as well as the new GV. Trying to access the TypeMap for the
source GV type, which is actually a dest GV type, hits an assertion
since it appears that we have mapped into the source module (because the
type is the value not a key into the map).

Detect that we don't need to access the TypeMap in this case, since
there is no need to create a bitcast from the new GV to the source GV
type as they GV are the same.

Fixes PR35722.

Reviewers: mehdi_amini, pcc

Subscribers: probinson, llvm-commits, eraman

Differential Revision: https://reviews.llvm.org/D41624
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@322545 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[docs] Add JFS as an external project built againt LLVM 6.0.
Dan Liew [Thu, 11 Jan 2018 16:24:04 +0000 (16:24 +0000)]
[docs] Add JFS as an external project built againt LLVM 6.0.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@322287 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[docs] Mention SjLj fixes in the release notes
Martin Storsjo [Tue, 9 Jan 2018 07:09:28 +0000 (07:09 +0000)]
[docs] Mention SjLj fixes in the release notes

Enabling SjLj on x86 on platforms where it isn't used by default
was partially implemented before 6.0, but didn't actually fully
work until now.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@322059 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDrop 'svn' suffix from the version number.
Hans Wennborg [Wed, 3 Jan 2018 16:58:58 +0000 (16:58 +0000)]
Drop 'svn' suffix from the version number.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@321742 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCreating release_60 branch off revision 321711
Hans Wennborg [Wed, 3 Jan 2018 14:54:30 +0000 (14:54 +0000)]
Creating release_60 branch off revision 321711

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@321713 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove left-over debug printout from r321692
Hans Wennborg [Wed, 3 Jan 2018 14:48:19 +0000 (14:48 +0000)]
Remove left-over debug printout from r321692

Besides the unsightly print-out, it was causing some buildbots to fail,
e.g. http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/9311

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321711 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstSimplify] Missed optimization in math expression: squashing exp(log), log(exp)
Dmitry Venikov [Wed, 3 Jan 2018 14:37:42 +0000 (14:37 +0000)]
[InstSimplify] Missed optimization in math expression: squashing exp(log), log(exp)

Summary: This patch enables folding following expressions under -ffast-math flag: exp(log(x)) -> x, exp2(log2(x)) -> x, log(exp(x)) -> x, log2(exp2(x)) -> x

Reviewers: spatel, hfinkel, davide

Reviewed By: spatel, hfinkel, davide

Subscribers: scanon, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321710 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ARM][NFC] Avoid recreating MCSubtargetInfo in ARMAsmBackend
Alex Bradbury [Wed, 3 Jan 2018 13:46:21 +0000 (13:46 +0000)]
[ARM][NFC] Avoid recreating MCSubtargetInfo in ARMAsmBackend

After D41349, we can now directly access MCSubtargetInfo from
createARM*AsmBackend. This patch makes use of this, avoiding the need to
create a fresh MCSubtargetInfo (which was previously always done with a blank
CPU and feature string). Given the total size of the change remains pretty
tiny and we're removing the old explicit destructor, I changed the STI field
to a reference rather than a pointer.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321707 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] Add test to remove VarArg casts (NFC)
Florian Hahn [Wed, 3 Jan 2018 13:35:43 +0000 (13:35 +0000)]
[InstCombine] Add test to remove VarArg casts (NFC)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321706 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[TableGen] Add support of Intrinsics with multiple returns
Hal Finkel [Wed, 3 Jan 2018 11:35:09 +0000 (11:35 +0000)]
[TableGen] Add support of Intrinsics with multiple returns

This change deals with intrinsics with multiple outputs, for example load
instrinsic with address updated.

DAG selection for Instrinsics could be done either through source code or
tablegen. Handling all intrinsics in source code would introduce a huge chunk
of repetitive code if we have a large number of intrinsic that return multiple
values (see NVPTX as an example). While intrinsic class in tablegen supports
multiple outputs, tablegen only supports Intrinsics with zero or one output on
TreePattern. This appears to be a simple bug in tablegen that is fixed by this
change.

For Intrinsics defined as:

  def int_xxx_load_addr_updated: Intrinsic<[llvm_i32_ty, llvm_ptr_ty], [llvm_ptr_ty, llvm_i32_ty], []>;

Instruction will be defined as:

  def L32_X: Inst<(outs reg:$d1, reg:$d2), (ins reg:$s1, reg:$s2), "ld32_x $d1, $d2, $s2", [(set i32:$d1, i32:$d2, (int_xxx_load_addr_updated i32:$s1, i32:$s2))]>;

Patch by Wenbo Sun, thanks!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321704 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AArch64][SVE] Asm: Add restricted register classes for SVE predicate vectors.
Sander de Smalen [Wed, 3 Jan 2018 10:15:46 +0000 (10:15 +0000)]
[AArch64][SVE] Asm: Add restricted register classes for SVE predicate vectors.

Summary:
Add a register class for SVE predicate operands that can only be p0-p7 (as opposed to p0-p15)

Patch [1/3] in a series to add predicated ADD/SUB instructions for SVE.

Reviewers: rengolin, mcrosier, evandro, fhahn, echristo, olista01, SjoerdMeijer, javed.absar

Reviewed By: fhahn

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321699 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix build of WebAssembly and AVR backends after r321692
Alex Bradbury [Wed, 3 Jan 2018 09:30:39 +0000 (09:30 +0000)]
Fix build of WebAssembly and AVR backends after r321692

As experimental backends, I didn't have them configured to build in my local
build config.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321696 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix incorrect documentation comment left after r321692
Alex Bradbury [Wed, 3 Jan 2018 09:14:02 +0000 (09:14 +0000)]
Fix incorrect documentation comment left after r321692

TargetRegistryInfo::createMCAsmBackend no longer takes a TheTriple parameter.
The majory of the TargetRegistryInfo::create* functions have no or very
limitied per-parameter doc comments, and adding a comment for the
MCSubtargetInfo, MCRegisterInfo and MCTargetOptions parameters seems like it
would add no real value beyond reading the function signature. As such, I've
just deleted the doc comment for TheTriple.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321694 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoThread MCSubtargetInfo through Target::createMCAsmBackend
Alex Bradbury [Wed, 3 Jan 2018 08:53:05 +0000 (08:53 +0000)]
Thread MCSubtargetInfo through Target::createMCAsmBackend

Currently it's not possible to access MCSubtargetInfo from a TgtMCAsmBackend.
D20830 threaded an MCSubtargetInfo reference through
MCAsmBackend::relaxInstruction, but this isn't the only function that would
benefit from access. This patch removes the Triple and CPUString arguments
from createMCAsmBackend and replaces them with MCSubtargetInfo.

This patch just changes the interface without making any intentional
functional changes. Once in, several cleanups are possible:
* Get rid of the awkward MCSubtargetInfo handling in ARMAsmBackend
* Support 16-bit instructions when valid in MipsAsmBackend::writeNopData
* Get rid of the CPU string parsing in X86AsmBackend and just use a SubtargetFeature for HasNopl
* Emit 16-bit nops in RISCVAsmBackend::writeNopData if the compressed instruction set extension is enabled (see D41221)

This change initially exposed PR35686, which has since been resolved in r321026.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321692 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[GlobalISel][Legalizer] Fix legalization of llvm.smul.with.overflow
Amara Emerson [Wed, 3 Jan 2018 04:56:56 +0000 (04:56 +0000)]
[GlobalISel][Legalizer] Fix legalization of llvm.smul.with.overflow

Previously the code for handling G_SMULO didn't properly check for the signed
multiply overflow, instead treating it the same as the unsigned G_UMULO.

Fixes PR35800.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321690 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[llvm-objcopy] Add support for visibility
Jake Ehrlich [Tue, 2 Jan 2018 23:01:24 +0000 (23:01 +0000)]
[llvm-objcopy] Add support for visibility

I have no clue how this was missed when symbol table support was added. This
change ensures that the visibility of symbols is preserved by default.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321681 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoHandle the case of live 16-bit subregisters in X86FixupBWInsts
Andrew Kaylor [Tue, 2 Jan 2018 21:04:38 +0000 (21:04 +0000)]
Handle the case of live 16-bit subregisters in X86FixupBWInsts

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

Change-Id: Ie3a405b28503ceae999f5f3ba07a68fa733a2400

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321674 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AArch64] fix typos in comments; NFC
Sanjay Patel [Tue, 2 Jan 2018 21:04:08 +0000 (21:04 +0000)]
[AArch64] fix typos in comments; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321673 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ValueTracking] recognize min/max of min/max patterns
Sanjay Patel [Tue, 2 Jan 2018 20:56:45 +0000 (20:56 +0000)]
[ValueTracking] recognize min/max of min/max patterns

This is part of solving PR35717:
https://bugs.llvm.org/show_bug.cgi?id=35717

The larger IR optimization is proposed in D41603, but we can show
the improvement in ValueTracking using codegen tests because
SelectionDAG creates min/max nodes based on ValueTracking.

Any target with min/max ops should show wins here. I chose AArch64
vector ops because they're clean and uniform.

Some Alive proofs for the tests (can't put more than 2 tests in 1
page currently because the web app says it's too long):
https://rise4fun.com/Alive/WRN
https://rise4fun.com/Alive/iPm
https://rise4fun.com/Alive/HmY
https://rise4fun.com/Alive/CNm
https://rise4fun.com/Alive/LYf

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321672 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AArch64] add tests for min/max of min/max (PR35717); NFC
Sanjay Patel [Tue, 2 Jan 2018 20:16:45 +0000 (20:16 +0000)]
[AArch64] add tests for min/max of min/max (PR35717); NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321668 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AArch64][GlobalISel] Fix assert fail with unknown intrinsic.
Amara Emerson [Tue, 2 Jan 2018 18:56:39 +0000 (18:56 +0000)]
[AArch64][GlobalISel] Fix assert fail with unknown intrinsic.

A call may have an intrinsic name but not have a valid intrinsic ID,
for example with llvm.invariant.group.barrier. If so, treat it as a
normal call like FastISel does.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321662 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[opt-viewer] Check for pygments.lexer.c_cpp
Jonas Hahnfeld [Tue, 2 Jan 2018 17:53:08 +0000 (17:53 +0000)]
[opt-viewer] Check for pygments.lexer.c_cpp

Some systems still don't have this module which was introduced in
version 2.0 (CentOS 7, sigh).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321659 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[x86] allow pairs of PCMPEQ for vector-sized integer equality comparisons (PR33325)
Sanjay Patel [Tue, 2 Jan 2018 16:38:29 +0000 (16:38 +0000)]
[x86] allow pairs of PCMPEQ for vector-sized integer equality comparisons (PR33325)

This is an extension of D31156 with the goal that we'll allow memcmp() == 0 expansion
for x86 to use 2 pairs of loads per block.

The memcmp expansion pass (formerly part of CGP) will generate this kind of pattern
with oversized integer compares, so we want to transform these into x86-specific vector
nodes before legalization splits things into scalar chunks.

See PR33325 for more details:
https://bugs.llvm.org/show_bug.cgi?id=33325

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321656 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AArch64][GlobalISel] Enable GlobalISel at -O0 by default
Amara Emerson [Tue, 2 Jan 2018 16:30:47 +0000 (16:30 +0000)]
[AArch64][GlobalISel] Enable GlobalISel at -O0 by default

Tests updated to explicitly use fast-isel at -O0 instead of implicitly.

This change also allows an explicit -fast-isel option to override an
implicitly enabled global-isel. Otherwise -fast-isel would have no effect at -O0.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321655 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[BasicBlockUtils] Check for unreachable preds before updating LI in UpdateAnalysisInf...
Anna Thomas [Tue, 2 Jan 2018 16:25:50 +0000 (16:25 +0000)]
[BasicBlockUtils] Check for unreachable preds before updating LI in UpdateAnalysisInformation

Summary:
We are incorrectly updating the LI when loop-simplify generates
dedicated exit blocks for a loop. The issue is that there's an implicit
assumption that the Preds passed into UpdateAnalysisInformation are
reachable. However, this is not true and breaks LI by incorrectly
updating the header of a loop.

One such case is when we generate dedicated exits when the exit block is
a landing pad (through SplitLandingPadPredecessors). There maybe other
cases as well, since we do not guarantee that Preds passed in are
reachable basic blocks.

The added test case shows how loop-simplify breaks LI for the outer loop (and DT in turn)
after we try to generate the LoopSimplifyForm.

Reviewers: davide, chandlerc, sanjoy

Reviewed By: davide

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321653 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Hexagon] Fix generation of vector sign extensions
Krzysztof Parzyszek [Tue, 2 Jan 2018 15:28:49 +0000 (15:28 +0000)]
[Hexagon] Fix generation of vector sign extensions

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321650 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert r321089: "[DAG] Elide overlapping store" (and subsequent fix in r321204)
Daniel Jasper [Tue, 2 Jan 2018 14:38:52 +0000 (14:38 +0000)]
Revert r321089: "[DAG] Elide overlapping store" (and subsequent fix in r321204)

Our internal testing has revealed has discovered bugs in PPC builds.
I have forward reproduction instructions to the original author (Nirav).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321649 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoNFC. Add description comments to Function header
Dmitry Venikov [Tue, 2 Jan 2018 14:13:16 +0000 (14:13 +0000)]
NFC. Add description comments to Function header

Reviewers: ruiu, davidxl, silvas, brzycki

Reviewed By: brzycki

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321648 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AArch64][AsmParser] Add isScalarReg() and repurpose isReg()
Sander de Smalen [Tue, 2 Jan 2018 13:39:44 +0000 (13:39 +0000)]
[AArch64][AsmParser] Add isScalarReg() and repurpose isReg()

Summary:
isReg() in AArch64AsmParser.cpp is a bit of a misnomer, and would be better named 'isScalarReg()' instead.

Patch [1/3] in a series to add operand constraint checks for SVE's predicated ADD/SUB.

Reviewers: rengolin, mcrosier, evandro, fhahn, echristo

Reviewed By: fhahn

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321646 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoStrip trailing whitespace. NFCI
Simon Pilgrim [Tue, 2 Jan 2018 12:41:29 +0000 (12:41 +0000)]
Strip trailing whitespace. NFCI

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321644 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[RISCV] Add Defs Uses information for c.jal and c.addi4spn
Alex Bradbury [Tue, 2 Jan 2018 12:09:29 +0000 (12:09 +0000)]
[RISCV] Add Defs Uses information for c.jal and c.addi4spn

Differential Revision: https://reviews.llvm.org/D41339
Patch by Shiva Chen.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321643 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[RISCV][NFC] Resolve unused variable warning in RISCVISelLowering
Alex Bradbury [Tue, 2 Jan 2018 11:54:59 +0000 (11:54 +0000)]
[RISCV][NFC] Resolve unused variable warning in RISCVISelLowering

XLenVT in LowerFormalArguments is used only in an assert.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321642 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DAGCombine] Fix for PR35765
Sam Parker [Tue, 2 Jan 2018 10:19:01 +0000 (10:19 +0000)]
[DAGCombine] Fix for PR35765

Remove the acceptance of ANY_EXTEND nodes while trying to move and
nodes back to loads.

Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=35765

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321641 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Codegen test for pr35765
Sam Parker [Tue, 2 Jan 2018 10:14:00 +0000 (10:14 +0000)]
[X86] Codegen test for pr35765

Committing reproducer test for pr35765, fix to follow.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321640 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SelectionDAG] Teach WidenVecOp_Convert to widen the operation if a widened result...
Craig Topper [Tue, 2 Jan 2018 07:30:53 +0000 (07:30 +0000)]
[SelectionDAG] Teach WidenVecOp_Convert to widen the operation if a widened result type would still be legal.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321638 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] Missed optimization in math expression: squashing sqrt functions
Dmitry Venikov [Tue, 2 Jan 2018 05:58:11 +0000 (05:58 +0000)]
[InstCombine] Missed optimization in math expression: squashing sqrt functions

Summary: This patch enables folding under -ffast-math flag sqrt(a) * sqrt(b) -> sqrt(a*b)

Reviewers: hfinkel, spatel, davide

Reviewed By: spatel, davide

Subscribers: davide, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321637 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoTest commit
Dmitry Venikov [Tue, 2 Jan 2018 05:47:42 +0000 (05:47 +0000)]
Test commit

Reviewers: Quolyk

Reviewed By: Quolyk

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321636 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SelectionDAG] Remove ifs on getTypeAction being TypeWidenVector from some of the...
Craig Topper [Tue, 2 Jan 2018 01:55:07 +0000 (01:55 +0000)]
[SelectionDAG] Remove ifs on getTypeAction being TypeWidenVector from some of the WideVecOp handlers.

We should only be in the handler if the tyep action is TypeWidenVector. There's no reason to try to do anything else.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321635 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ValueTracking] Don't assume shift values are in range
Simon Pilgrim [Mon, 1 Jan 2018 22:44:59 +0000 (22:44 +0000)]
[ValueTracking] Don't assume shift values are in range

Reduced (as best I could...) from oss-fuzz #4857 test case

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321634 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] Regenerate udiv tests.
Simon Pilgrim [Mon, 1 Jan 2018 22:27:49 +0000 (22:27 +0000)]
[InstCombine] Regenerate udiv tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321633 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Promote vXi1 fp_to_uint/fp_to_sint to vXi32 to avoid scalarization.
Craig Topper [Mon, 1 Jan 2018 21:12:18 +0000 (21:12 +0000)]
[X86] Promote vXi1 fp_to_uint/fp_to_sint to vXi32 to avoid scalarization.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321632 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Add test cases for vXi1 fptosi/fptoui.
Craig Topper [Mon, 1 Jan 2018 21:12:10 +0000 (21:12 +0000)]
[X86] Add test cases for vXi1 fptosi/fptoui.

Currently we do a lot of scalarization in these test cases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321631 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Replace custom lowering of vXi1 SINT_TO_FP/UINT_TO_FP with promotion.
Craig Topper [Mon, 1 Jan 2018 20:08:43 +0000 (20:08 +0000)]
[X86] Replace custom lowering of vXi1 SINT_TO_FP/UINT_TO_FP with promotion.

The custom lowering was just doing the same thing promotion would do.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321630 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SelectionDAG][X86][AArch64] Require targets to specify the promotion type when using...
Craig Topper [Mon, 1 Jan 2018 19:21:35 +0000 (19:21 +0000)]
[SelectionDAG][X86][AArch64] Require targets to specify the promotion type when using setOperationAction Promote for INT_TO_FP and FP_TO_INT

Currently the promotion for these ignores the normal getTypeToPromoteTo and instead just tries to double the element width. This is because the default behavior of getTypeToPromote to just adds 1 to the SimpleVT, which has the affect of increasing the element count while keeping the scalar size the same.

If multiple steps are required to get to a legal operation type, int_to_fp will be promoted multiple times. And fp_to_int will keep trying wider types in a loop until it finds one that works.

getTypeToPromoteTo does have the ability to query a promotion map to get the type and not do the increasing behavior. It seems better to just let the target specify the promotion type in the map explicitly instead of letting the legalizer iterate via widening.

FWIW, it's worth I think for any other vector operations that need to be promoted, we have to specify the type explicitly because the default behavior of getTypeToPromote isn't useful for vectors. The other types of promotion already require either the element count is constant or the total vector width is constant, but neither happens by incrementing the SimpleVT enum.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321629 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[x86] add runs for more vector variants; NFC
Sanjay Patel [Mon, 1 Jan 2018 16:36:47 +0000 (16:36 +0000)]
[x86] add runs for more vector variants; NFC

Preliminary step to see what the effects of D41618 look like.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321624 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86][SSE] Add test case from PR32160
Simon Pilgrim [Mon, 1 Jan 2018 13:04:04 +0000 (13:04 +0000)]
[X86][SSE] Add test case from PR32160

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321620 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Regenerate test checks in sse-intrinsics-x86-upgrade with update-llc
Uriel Korach [Mon, 1 Jan 2018 09:00:13 +0000 (09:00 +0000)]
[X86] Regenerate test checks in sse-intrinsics-x86-upgrade with update-llc

Removing outdated checks.
NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321619 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Regenerate test checks in sse2-intrinsics-x86-upgrade with update-llc
Uriel Korach [Mon, 1 Jan 2018 08:47:50 +0000 (08:47 +0000)]
[X86] Regenerate test checks in sse2-intrinsics-x86-upgrade with update-llc

Removing outdated checks.
NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321618 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] In LowerTruncateVecI1, don't add SHL if the input is known to be all sign bits.
Craig Topper [Mon, 1 Jan 2018 04:52:58 +0000 (04:52 +0000)]
[X86] In LowerTruncateVecI1, don't add SHL if the input is known to be all sign bits.

If the input is all sign bits then the LSB through MSB are all the same so we don't need to be move the LSB to the MSB.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321617 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Add missing NoVLX predicate around some patterns that use zmm registers to...
Craig Topper [Mon, 1 Jan 2018 01:11:32 +0000 (01:11 +0000)]
[X86] Add missing NoVLX predicate around some patterns that use zmm registers to implement 128/256-bit operations without VLX.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321613 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Add patterns for using zmm registers for v8i32/v8f32 vselect with the false...
Craig Topper [Mon, 1 Jan 2018 01:11:29 +0000 (01:11 +0000)]
[X86] Add patterns for using zmm registers for v8i32/v8f32 vselect with the false input being zero.

We can use zmm move with zero masking for this. We already had patterns for using a masked move, but we didn't check for the zero masking case separately.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321612 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Use CONCAT_VECTORS instead of INSERT_SUBVECTOR for padding v4i1/v2i1 vector...
Craig Topper [Sun, 31 Dec 2017 19:17:52 +0000 (19:17 +0000)]
[X86] Use CONCAT_VECTORS instead of INSERT_SUBVECTOR for padding v4i1/v2i1 vector to v8i1 pre-legalize.

The CONCAT_VECTORS will be lowered to INSERT_SUBVECTOR later. In the modified cases this seems to be enough to trick a later DAG combine into running in a different order than allows the ANDs to be removed.

I'll admit this is a bit of a hack that happens to work, but using CONCAT_VECTORS is more consistent with other legalization code anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321611 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86][AVX2] Combine extract(broadcast(scalar_value)) --> scalar_value
Simon Pilgrim [Sun, 31 Dec 2017 18:59:30 +0000 (18:59 +0000)]
[X86][AVX2] Combine extract(broadcast(scalar_value)) --> scalar_value

As it has a scalar source we don't treat it as a target shuffle so needs special handling.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321610 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86][AVX] Add test case from PR33740
Simon Pilgrim [Sun, 31 Dec 2017 17:16:48 +0000 (17:16 +0000)]
[X86][AVX] Add test case from PR33740

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321608 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86][SSE] Don't vectorize splat buildvector of binops (PR30780)
Simon Pilgrim [Sun, 31 Dec 2017 17:07:47 +0000 (17:07 +0000)]
[X86][SSE] Don't vectorize splat buildvector of binops (PR30780)

Don't combine buildvector(binop(),binop(),binop(),binop()) -> binop(buildvector(), buildvector()) if its a splat - keep the binop scalar and just splat the result to avoid large vector constants.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321607 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SimplifyCFG] Return to the pass manager the correct value.
Davide Italiano [Sun, 31 Dec 2017 16:54:03 +0000 (16:54 +0000)]
[SimplifyCFG] Return to the pass manager the correct value.

I wanted to commit this with r321603, but I failed to squash
the two commits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321606 91177308-0d34-0410-b5e6-96231b3b80d8