OSDN Git Service

android-x86/external-llvm.git
6 years ago[ARM GlobalISel] Add inst selector tests for G_SITOFP and G_UITOFP
Diana Picus [Tue, 30 Jan 2018 09:15:27 +0000 (09:15 +0000)]
[ARM GlobalISel] Add inst selector tests for G_SITOFP and G_UITOFP

These are handled by the TableGen'erated code.

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

6 years ago[ARM GlobalISel] Map G_SITOFP and G_UITOFP
Diana Picus [Tue, 30 Jan 2018 09:15:23 +0000 (09:15 +0000)]
[ARM GlobalISel] Map G_SITOFP and G_UITOFP

Straightforward mapping (integer operand to GPR, floating point operand
to FPR).

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

6 years ago[ARM GlobalISel] Legalize G_SITOFP and G_UITOFP
Diana Picus [Tue, 30 Jan 2018 09:15:17 +0000 (09:15 +0000)]
[ARM GlobalISel] Legalize G_SITOFP and G_UITOFP

Legal if we have hardware support, libcall otherwise.

Also add supporting code to the legalizer helper for libcalls.

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

6 years ago[ARM GlobalISel] Add inst selector tests for G_FPTOSI and G_FPTOUI
Diana Picus [Tue, 30 Jan 2018 07:55:02 +0000 (07:55 +0000)]
[ARM GlobalISel] Add inst selector tests for G_FPTOSI and G_FPTOUI

The work is done by the TableGen'erated code.

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

6 years ago[ARM GlobalISel] Map G_FPTOSI and G_FPTOUI
Diana Picus [Tue, 30 Jan 2018 07:54:58 +0000 (07:54 +0000)]
[ARM GlobalISel] Map G_FPTOSI and G_FPTOUI

Straightforward mapping (integer operand goes to GPR, floating point
operand goes to FPR).

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

6 years ago[ARM GlobalISel] Legalize G_FPTOSI and G_FPTOUI
Diana Picus [Tue, 30 Jan 2018 07:54:52 +0000 (07:54 +0000)]
[ARM GlobalISel] Legalize G_FPTOSI and G_FPTOUI

Legal if we have hardware support for floating point, libcalls
otherwise.

Also add the necessary support for libcalls in the legalizer helper.

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

6 years ago[X86] Auto-generate complete checks. NFC
Craig Topper [Tue, 30 Jan 2018 07:02:29 +0000 (07:02 +0000)]
[X86] Auto-generate complete checks. NFC

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

6 years ago[DWARF] Corrected test committed in r323670 to use llc instead of llc_dwarf to avoid...
Wolfgang Pieb [Tue, 30 Jan 2018 01:11:46 +0000 (01:11 +0000)]
[DWARF] Corrected test committed in r323670 to use llc instead of llc_dwarf to avoid multiple triples.

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

6 years ago[utils] De-duplicate utils/update_{llc_,}test_checks.py
Fangrui Song [Tue, 30 Jan 2018 00:40:05 +0000 (00:40 +0000)]
[utils] De-duplicate utils/update_{llc_,}test_checks.py

Subscribers: llvm-commits

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

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

6 years ago[InstSimplify] (X * Y) / Y --> X for relaxed floating-point ops
Sanjay Patel [Tue, 30 Jan 2018 00:18:37 +0000 (00:18 +0000)]
[InstSimplify] (X * Y) / Y --> X for relaxed floating-point ops

This is the FP counterpart that was mentioned in PR35709:
https://bugs.llvm.org/show_bug.cgi?id=35709

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

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

6 years ago[SelectionDAG]: Ignore "returned" in the presence of an implicit sret.
Dan Gohman [Tue, 30 Jan 2018 00:14:40 +0000 (00:14 +0000)]
[SelectionDAG]: Ignore "returned" in the presence of an implicit sret.

When a function return value can't be directly lowered, such as
returning an i128 on WebAssembly, as indicated by the CanLowerReturn
target hook, SelectionDAGBuilder can translate it to return the
value through a hidden sret-like argument.

If such a function has an argument with the "returned" attribute,
the attribute can't be automatically lowered, because the function
no longer has a normal return value. For now, just discard the
"returned" attribute.

This fixes PR36128.

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

6 years ago[globalisel][legalizer] Fix a fallthrough case in the unittests debug printing
Daniel Sanders [Mon, 29 Jan 2018 23:47:41 +0000 (23:47 +0000)]
[globalisel][legalizer] Fix a fallthrough case in the unittests debug printing

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

6 years ago[RAFast] Don't dereference MBB::end
Quentin Colombet [Mon, 29 Jan 2018 23:42:37 +0000 (23:42 +0000)]
[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/trunk@323710 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU: Move ADDRIndirect complex pattern into R600Instructions.td
Tom Stellard [Mon, 29 Jan 2018 23:29:26 +0000 (23:29 +0000)]
AMDGPU: Move ADDRIndirect complex pattern into R600Instructions.td

Summary: This is only used by R600.

Reviewers: arsenm

Reviewed By: arsenm

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

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

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

6 years ago[X86] Use VMOVDQA64 for aligned vXi32 stores.
Craig Topper [Mon, 29 Jan 2018 23:27:23 +0000 (23:27 +0000)]
[X86] Use VMOVDQA64 for aligned vXi32 stores.

I meant to do this with the unaligned stores in r322820, but looks like I missed it.

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

6 years agoAMDGPU: Allow a SGPR for the conditional KILL operand
Marek Olsak [Mon, 29 Jan 2018 23:19:10 +0000 (23:19 +0000)]
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/trunk@323706 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix some regular expressions in llvm-mode.el.
Rafael Espindola [Mon, 29 Jan 2018 22:56:41 +0000 (22:56 +0000)]
Fix some regular expressions in llvm-mode.el.

In some cases it was using "\" unnecessarily.  In another case it
needed an additional "\" to properly indicate a numbered sub-match.

Make comment-start buffer-local in llvm-mode.el

llvm-mode was setting comment-start globally.  However, it is better
to only set it locally in the current buffer.

Don't use purecopy in llvm-mode.el

There's no reason to use purecopy in llvm-mode.el.
purecopy is only needed for files that are dumped in emacs.

Add a version header to llvm-mode.el

Adding a version header to llvm-mode.el allows it to be installed by
the Emacs package manager.  There are not many requirements on the
version number; however it is useful to users to bump it when
something significant changes.  Here I've chosen just to start at 1.0.

Patch by Tom Tromey!

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

6 years ago[DSE] add test for PR36129; NFC
Sanjay Patel [Mon, 29 Jan 2018 22:50:08 +0000 (22:50 +0000)]
[DSE] add test for PR36129; NFC

We can miscompile because we're not checking is the memory might
me modified between the seemingly redundant store ops.

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

6 years agoLiveInterval: Print weight in print() function.
Matthias Braun [Mon, 29 Jan 2018 22:03:00 +0000 (22:03 +0000)]
LiveInterval: Print weight in print() function.

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

6 years agoStop tracking .debug_line_str in DWARFUnit. NFC.
Paul Robinson [Mon, 29 Jan 2018 22:02:56 +0000 (22:02 +0000)]
Stop tracking .debug_line_str in DWARFUnit. NFC.

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

6 years ago[X86] Add FeaturePOPCNTFalseDeps to skylake server CPU to match skylake client.
Craig Topper [Mon, 29 Jan 2018 21:56:48 +0000 (21:56 +0000)]
[X86] Add FeaturePOPCNTFalseDeps to skylake server CPU to match skylake client.

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

6 years ago[JumpThreading][NFC] Rename LoadInst variables
Brian M. Rzycki [Mon, 29 Jan 2018 21:29:44 +0000 (21:29 +0000)]
[JumpThreading][NFC] Rename LoadInst variables

Summary:
The JumpThreading pass has several locations where to the variable name LI
refers to a LoadInst type. This is confusing and inhibits the ability to use
LI for LoopInfo as a member of the JumpThreading class. Minor formatting
and comments were also altered to reflect this change.

Reviewers: dberlin, kuba, spop, sebpop

Reviewed by: sebpop

Subscribers: sebpop, hiraditya, llvm-commits

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

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

6 years ago[X86] Emit 11-byte or 15-byte NOPs on recent AMD targets, else default to 10-byte...
Simon Pilgrim [Mon, 29 Jan 2018 21:24:31 +0000 (21:24 +0000)]
[X86] Emit 11-byte or 15-byte NOPs on recent AMD targets, else default to 10-byte NOPs (PR22965)

We currently emit up to 15-byte NOPs on all targets (apart from Silvermont), which stalls performance on some targets with decoders that struggle with 2 or 3 more '66' prefixes.

This patch flags recent AMD targets (btver1/znver1) to still emit 15-byte NOPs and bdver* targets to emit 11-byte NOPs. All other targets now emit 10-byte NOPs apart from SilverMont CPUs which still emit 7-byte NOPS.

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

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

6 years ago[ARM][GISel] PR35965 Constrain RegClasses of nested instructions built from Dst Pattern
Daniel Sanders [Mon, 29 Jan 2018 21:09:12 +0000 (21:09 +0000)]
[ARM][GISel] PR35965 Constrain RegClasses of nested instructions built from Dst Pattern

Summary:
Apparently, we missed on constraining register classes of VReg-operands of all the instructions
built from a destination pattern but the root (top-level) one. The issue exposed itself
while selecting G_FPTOSI for armv7: the corresponding pattern generates VTOSIZS wrapped
into COPY_TO_REGCLASS, so top-level COPY_TO_REGCLASS gets properly constrained,
while nested VTOSIZS (or rather its destination virtual register to be exact) does not.

Fixing this by issuing GIR_ConstrainSelectedInstOperands for every nested GIR_BuildMI.

https://bugs.llvm.org/show_bug.cgi?id=35965
rdar://problem/36886530

Patch by Roman Tereshin

Reviewers: dsanders, qcolombet, rovka, bogner, aditya_nandakumar, volkan

Reviewed By: dsanders, qcolombet, rovka

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

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

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

6 years ago[DWARFv5] Re-enable dumping a line table with no CU.
Paul Robinson [Mon, 29 Jan 2018 20:57:43 +0000 (20:57 +0000)]
[DWARFv5] Re-enable dumping a line table with no CU.

r323476 added support for DW_FORM_line_strp, and incorrectly made that
depend on having a DWARFUnit available.  We shouldn't be tracking
.debug_line_str in DWARFUnit after all.  After this patch, I can do an
NFC follow up and undo a bunch of the "plumbing" part of r323476.

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

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

6 years ago[X86] Avoid using high register trick for test instruction
Amaury Sechet [Mon, 29 Jan 2018 20:54:33 +0000 (20:54 +0000)]
[X86] Avoid using high register trick for test instruction

Summary:
It seems it's main effect is to create addition copies when values are inr register that do not support this trick, which increase register pressure and makes the code bigger.

The main noteworthy regression I was able to observe was pattern of the type (setcc (trunc (and X, C)), 0) where C is such as it would benefit from the hi register trick. To prevent this, a new pattern is added to materialize such pattern using a 32 bits test. This has the added benefit of working with any constant that is materializable as a 32bits immediate, not just the ones that can leverage the high register trick, as demonstrated by the test case in test-shrink.ll using the constant 2049 .

Reviewers: craig.topper, niravd, spatel, hfinkel

Subscribers: llvm-commits

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

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

6 years ago[globalisel][legalizer] Change identity() to changeTo() to clarify that it changes...
Daniel Sanders [Mon, 29 Jan 2018 20:46:16 +0000 (20:46 +0000)]
[globalisel][legalizer] Change identity() to changeTo() to clarify that it changes things. NFC

Prior to committing r323681, we decided to change pick() to identity() since
it wasn't clear from the name what pick() did. However, identity() isn't a very
good name either since it implies that no changes are made. For some reason,
naming it changeTo() didn't occur to me until just after the commit. This
should resolve the lack of clarity that pick() had while still implying that
it changes the MIR.

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

6 years ago[CodeGen] Simplify conditional. NFC
Shoaib Meenai [Mon, 29 Jan 2018 20:28:04 +0000 (20:28 +0000)]
[CodeGen] Simplify conditional. NFC

Rafael pointed out that `hasInternalLinkage() || hasPrivateLinkage()` is
equivalent to `hasLocalLinkage()` in post-commit review.

I'm intentionally not updating the comment, partly because I like it
being explicit, and partly because "global symbols with local linkage"
sounds like an oxymoron.

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

6 years ago[X86] Add test case to ensure testw is generated when optimizing for size. NFC
Amaury Sechet [Mon, 29 Jan 2018 20:22:46 +0000 (20:22 +0000)]
[X86] Add test case to ensure testw is generated when optimizing for size. NFC

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

6 years ago[AArch64] Change the filename of the Exynos M1 scheduling defs
Evandro Menezes [Mon, 29 Jan 2018 20:22:24 +0000 (20:22 +0000)]
[AArch64] Change the filename of the Exynos M1 scheduling defs

After request by Matthias Braun in https://reviews.llvm.org/D42387.

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

6 years agoRevert "AArch64: Omit callframe setup/destroy when not necessary"
Jun Bum Lim [Mon, 29 Jan 2018 19:56:42 +0000 (19:56 +0000)]
Revert "AArch64: Omit callframe setup/destroy when not necessary"

This reverts commit r322917 due to multiple performance regressions in spec2006
and spec2017. XFAILed llvm/test/CodeGen/AArch64/big-callframe.ll which initially
motivated this change.

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

6 years ago[globalisel][legalizer] Adapt LegalizerInfo to support inter-type dependencies and...
Daniel Sanders [Mon, 29 Jan 2018 19:54:49 +0000 (19:54 +0000)]
[globalisel][legalizer] Adapt LegalizerInfo to support inter-type dependencies and other things.

Summary:
As discussed in D42244, we have difficulty describing the legality of some
operations. We're not able to specify relationships between types.
For example, declaring the following
  setAction({..., 0, s32}, Legal)
  setAction({..., 0, s64}, Legal)
  setAction({..., 1, s32}, Legal)
  setAction({..., 1, s64}, Legal)
currently declares these type combinations as legal:
  {s32, s32}
  {s64, s32}
  {s32, s64}
  {s64, s64}
but we currently have no means to say that, for example, {s64, s32} is
not legal. Some operations such as G_INSERT/G_EXTRACT/G_MERGE_VALUES/
G_UNMERGE_VALUES have relationships between the types that are currently
described incorrectly.

Additionally, G_LOAD/G_STORE currently have no means to legalize non-atomics
differently to atomics. The necessary information is in the MMO but we have no
way to use this in the legalizer. Similarly, there is currently no way for the
register type and the memory type to differ so there is no way to cleanly
represent extending-load/truncating-store in a way that can't be broken by
optimizers (resulting in illegal MIR).

It's also difficult to control the legalization strategy. We've added support
for legalizing non-power of 2 types but there's still some hardcoded assumptions
about the strategy. The main one I've noticed is that type0 is always legalized
before type1 which is not a good strategy for `type0 = G_EXTRACT type1, ...` if
you need to widen the container. It will converge on the same result eventually
but it will take a much longer route when legalizing type0 than if you legalize
type1 first.

Lastly, the definition of legality and the legalization strategy is kept
separate which is not ideal. It's helpful to be able to look at a one piece of
code and see both what is legal and the method the legalizer will use to make
illegal MIR more legal.

This patch adds a layer onto the LegalizerInfo (to be removed when all targets
have been migrated) which resolves all these issues.

Here are the rules for shift and division:
  for (unsigned BinOp : {G_LSHR, G_ASHR, G_SDIV, G_UDIV})
    getActionDefinitions(BinOp)
        .legalFor({s32, s64})     // If type0 is s32/s64 then it's Legal
        .clampScalar(0, s32, s64) // If type0 is <s32 then WidenScalar to s32
                                  // If type0 is >s64 then NarrowScalar to s64
        .widenScalarToPow2(0)     // Round type0 scalars up to powers of 2
        .unsupported();           // Otherwise, it's unsupported
This describes everything needed to both define legality and describe how to
make illegal things legal.

Here's an example of a complex rule:
  getActionDefinitions(G_INSERT)
      .unsupportedIf([=](const LegalityQuery &Query) {
        // If type0 is smaller than type1 then it's unsupported
        return Query.Types[0].getSizeInBits() <= Query.Types[1].getSizeInBits();
      })
      .legalIf([=](const LegalityQuery &Query) {
        // If type0 is s32/s64/p0 and type1 is a power of 2 other than 2 or 4 then it's legal
        // We don't need to worry about large type1's because unsupportedIf caught that.
        const LLT &Ty0 = Query.Types[0];
        const LLT &Ty1 = Query.Types[1];
        if (Ty0 != s32 && Ty0 != s64 && Ty0 != p0)
          return false;
        return isPowerOf2_32(Ty1.getSizeInBits()) &&
               (Ty1.getSizeInBits() == 1 || Ty1.getSizeInBits() >= 8);
      })
      .clampScalar(0, s32, s64)
      .widenScalarToPow2(0)
      .maxScalarIf(typeInSet(0, {s32}), 1, s16) // If type0 is s32 and type1 is bigger than s16 then NarrowScalar type1 to s16
      .maxScalarIf(typeInSet(0, {s64}), 1, s32) // If type0 is s64 and type1 is bigger than s32 then NarrowScalar type1 to s32
      .widenScalarToPow2(1)                     // Round type1 scalars up to powers of 2
      .unsupported();
This uses a lambda to say that G_INSERT is unsupported when type0 is bigger than
type1 (in practice, this would be a default rule for G_INSERT). It also uses one
to describe the legal cases. This particular predicate is equivalent to:
  .legalFor({{s32, s1}, {s32, s8}, {s32, s16}, {s64, s1}, {s64, s8}, {s64, s16}, {s64, s32}})

In terms of performance, I saw a slight (~6%) performance improvement when
AArch64 was around 30% ported but it's pretty much break even right now.
I'm going to take a look at constexpr as a means to reduce the initialization
cost.

Future work:
* Make it possible for opcodes to share rulesets. There's no need for
  G_LSHR/G_ASHR/G_SDIV/G_UDIV to have separate rule and ruleset objects. There's
  no technical barrier to this, it just hasn't been done yet.
* Replace the type-index numbers with an enum to get .clampScalar(Type0, s32, s64)
* Better names for things like .maxScalarIf() (clampMaxScalar?) and the vector rules.
* Improve initialization cost using constexpr

Possible future work:
* It's possible to make these rulesets change the MIR directly instead of
  returning a description of how to change the MIR. This should remove a little
  overhead caused by parsing the description and routing to the right code, but
  the real motivation is that it removes the need for LegalizeAction::Custom.
  With Custom removed, there's no longer a requirement that Custom legalization
  change the opcode to something that's considered legal.

Reviewers: ab, t.p.northover, qcolombet, rovka, aditya_nandakumar, volkan, reames, bogner

Reviewed By: bogner

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

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

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

6 years agoImprove testcase.
Rafael Espindola [Mon, 29 Jan 2018 19:37:27 +0000 (19:37 +0000)]
Improve testcase.

We now test that pic and static produce different results for bar.
The function names were demangled.
The attributes are written inline.

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

6 years ago[MachineVerifier] Add check that renamable operands aren't reserved registers.
Geoff Berry [Mon, 29 Jan 2018 18:57:07 +0000 (18:57 +0000)]
[MachineVerifier] Add check that renamable operands aren't reserved registers.

Summary:

Reviewers: qcolombet, MatzeB

Subscribers: arsenm, sdardis, nhaehnle, mcrosier, llvm-commits

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

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

6 years ago[AMDGPU][X86][Mips] Make sure renamable bit not set for reserved regs
Geoff Berry [Mon, 29 Jan 2018 18:47:48 +0000 (18:47 +0000)]
[AMDGPU][X86][Mips] Make sure renamable bit not set for reserved regs

Summary:
Fix a few places that were modifying code after register
allocation to set the renamable bit correctly to avoid failing the
validation added in D42449.

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

6 years agoMove getPlatformFlags to ELFObjectFileBase and simplify.
Rafael Espindola [Mon, 29 Jan 2018 18:27:30 +0000 (18:27 +0000)]
Move getPlatformFlags to ELFObjectFileBase and simplify.

This removes a few std::error_code results that were ignored on every
call.

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

6 years ago[X86] Don't create SHRUNKBLEND when the condition is used by the true or false operan...
Craig Topper [Mon, 29 Jan 2018 17:56:57 +0000 (17:56 +0000)]
[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/trunk@323672 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Add test case for pr34592
Craig Topper [Mon, 29 Jan 2018 17:56:55 +0000 (17:56 +0000)]
[X86] Add test case for pr34592

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

6 years ago[DWARF] Recommitting a test reverted in r323560. Moved to x86 directory with explicit...
Wolfgang Pieb [Mon, 29 Jan 2018 17:49:10 +0000 (17:49 +0000)]
[DWARF] Recommitting a test reverted in r323560. Moved to x86 directory with explicit triple.
ELF support is required for type units.

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

6 years ago[globalisel] Make LegalizerInfo::LegalizeAction available outside of LegalizerInfo...
Daniel Sanders [Mon, 29 Jan 2018 17:37:29 +0000 (17:37 +0000)]
[globalisel] Make LegalizerInfo::LegalizeAction available outside of LegalizerInfo. NFC

Summary:
The improvements to the LegalizerInfo discussed in D42244 require that
LegalizerInfo::LegalizeAction be available for use in other classes. As such,
it needs to be moved out of LegalizerInfo. This has been done separately to the
next patch to minimize the noise in that patch.

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

6 years ago[AccelTable] Workaround for MSVC bug
Jonas Devlieghere [Mon, 29 Jan 2018 17:28:51 +0000 (17:28 +0000)]
[AccelTable] Workaround for MSVC bug

Microsoft Visual Studio rejects the static constexpr static list of
atoms even though it's valid C++. This provides a workaround to unbreak
the bots.

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

6 years agoAdd myself to CREDITS.txt
Tony Jiang [Mon, 29 Jan 2018 17:02:34 +0000 (17:02 +0000)]
Add myself to CREDITS.txt

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

6 years agoAdd test case for truncated and promotion to test. NFC
Amaury Sechet [Mon, 29 Jan 2018 16:13:01 +0000 (16:13 +0000)]
Add test case for truncated and promotion to test. NFC

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

6 years ago[SLP] Fix for PR32086: Count InsertElementInstr of the same elements as shuffle.
Alexey Bataev [Mon, 29 Jan 2018 16:08:52 +0000 (16:08 +0000)]
[SLP] Fix for PR32086: Count InsertElementInstr of the same elements as shuffle.

Summary:
If the same value is going to be vectorized several times in the same
tree entry, this entry is considered to be a gather entry and cost of
this gather is counter as cost of InsertElementInstrs for each gathered
value. But we can consider these elements as ShuffleInstr with
SK_PermuteSingle shuffle kind.

Reviewers: spatel, RKSimon, mkuper, hfinkel

Subscribers: llvm-commits

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

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

6 years ago[SLP] Add a test with extract for PR32086, NFC.
Alexey Bataev [Mon, 29 Jan 2018 15:56:52 +0000 (15:56 +0000)]
[SLP] Add a test with extract for PR32086, NFC.

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

6 years ago[AccelTable] Try making MSVC happy
Jonas Devlieghere [Mon, 29 Jan 2018 15:23:34 +0000 (15:23 +0000)]
[AccelTable] Try making MSVC happy

MSVC complains that the constexpr "expression did not evaluate to a
constant". Trying to make it happy by adding a `const` specifier as
suggested in https://stackoverflow.com/questions/37574343.

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

6 years ago[AccelTable] Fix undefined reference
Jonas Devlieghere [Mon, 29 Jan 2018 15:07:55 +0000 (15:07 +0000)]
[AccelTable] Fix undefined reference

Fixes the missing reference in AppleAccelTableData by making the method
pure virtual as intended.

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

6 years ago[dsymutil] Generate Apple accelerator tables
Jonas Devlieghere [Mon, 29 Jan 2018 14:52:50 +0000 (14:52 +0000)]
[dsymutil] Generate Apple accelerator tables

This patch adds support for generating accelerator tables in dsymutil.
This feature was already present in our internal repository but not yet
upstreamed because it requires changes to the Apple accelerator table
implementation.

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

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

6 years ago[NFC] Rename DwarfAccelTable and move header.
Jonas Devlieghere [Mon, 29 Jan 2018 14:52:41 +0000 (14:52 +0000)]
[NFC] Rename DwarfAccelTable and move header.

This patch renames DwarfAccelTable.{h,cpp} to AccelTable.{h,cpp} and
moves the header to the include dir so it is accessible by the
dsymutil implementation.

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

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

6 years ago[NFC] Refactor Apple Accelerator Tables
Jonas Devlieghere [Mon, 29 Jan 2018 14:52:34 +0000 (14:52 +0000)]
[NFC] Refactor Apple Accelerator Tables

This patch refactors the way data is stored in the accelerator table and
makes them truly generic. There have been several attempts to do this in
the past:

 - D8215 & D8216: Using a union and partial hardcoding.
 - D11805: Using inheritance.
 - D42246: Using a callback.

In the end I didn't like either of them, because for some reason or
another parts of it felt hacky or decreased runtime performance. I
didn't want to completely rewrite them as I was hoping that we could
reuse parts for the successor in the DWARF standard. However, it seems
less and less likely that there will be a lot of opportunities for
sharing code and/or an interface.

Originally I choose to template the whole class, because it introduces
no performance overhead compared to the original implementation.

We ended up settling on a hybrid between a templated method and a
virtual call to emit the data. The motivation is that we don't want to
increase code size for a feature that should soon be superseded by the
DWARFv5 accelerator tables. While the code will continue to be used for
compatibility, it won't be on the hot path. Furthermore this does not
regress performance compared to Apple's internal implementation that
already uses virtual calls for this.

A quick summary for why these changes are necessary: dsymutil likes to
reuse the current implementation of the Apple accelerator tables.
However, LLDB expects a slightly different interface than what is
currently emitted. Additionally, in dsymutil we only have offsets and no
actual DIEs.

Although the patch suggests a lot of code has changed, this change is
pretty straightforward:

 - We created an abstract class `AppleAccelTableData` to serve as an
   interface for the different data classes.
 - We created two implementations of this class, one for type tables and
   one for everything else. There will be a third one for dsymutil that
   takes just the offset.
 - We use the supplied class to deduct the atoms for the header which
   makes the structure of the table fully self contained, although not
   enforced by the interface as was the case for the fully templated
   approach.
 - We renamed the prefix from DWARF- to Apple- to make space for the
   future implementation of .debug_names.

This change is NFC and relies on the existing tests.

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

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

6 years ago[AMDGPU][MC] Corrected parsing of image opcode modifiers r128 and d16
Dmitry Preobrazhensky [Mon, 29 Jan 2018 14:20:42 +0000 (14:20 +0000)]
[AMDGPU][MC] Corrected parsing of image opcode modifiers r128 and d16

See bugs 36092, 36093:
    https://bugs.llvm.org/show_bug.cgi?id=36092
    https://bugs.llvm.org/show_bug.cgi?id=36093

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

Reviewers: vpykhtin, artem.tamazov, arsenm

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

6 years agoFix windows test failure caused by r323638
Pavel Labath [Mon, 29 Jan 2018 13:53:48 +0000 (13:53 +0000)]
Fix windows test failure caused by r323638

The test was failing because of an incorrect sizeof check in the name
index parsing code. This code was meant to check that we have enough
input to parse the fixed-size part of the dwarf header, which it did by
comparing the input to sizeof(Header). Originally struct Header only
contained the fixed-size part, but during review, we've moved additional
members into it, which rendered the sizeof check invalid.

I resolve this by moving the fixed-size part to a separate struct and
updating the sizeof-expression to use that.

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

6 years ago[AArch64][AsmParser] NFC: Generalize LogicalImm[Not](32|64) code
Sander de Smalen [Mon, 29 Jan 2018 13:05:38 +0000 (13:05 +0000)]
[AArch64][AsmParser] NFC: Generalize LogicalImm[Not](32|64) code

Summary:
All variants of isLogicalImm[Not](32|64) can be combined into a single templated function, same for printLogicalImm(32|64).
By making it use a template instead, further SVE patches can use it for other data types as well (e.g. 8, 16 bits).

Reviewers: fhahn, rengolin, aadg, echristo, kristof.beyls, samparker

Reviewed By: samparker

Subscribers: aemerson, javed.absar, llvm-commits

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

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

6 years ago[DebugInfo] Fix fragment offset emission order for symbol locations
Mikael Holmen [Mon, 29 Jan 2018 12:37:30 +0000 (12:37 +0000)]
[DebugInfo] Fix fragment offset emission order for symbol locations

Summary:
When emitting the location for a global variable with fragmented debug
expressions, make sure that the offset pieces, which represent
optimized-out parts of the variable, are emitted before their succeeding
fragments' expressions. Previously, if the succeeding fragment's
location was a symbol, the offset piece was emitted after, rather than
before, that symbol's expression. This effectively meant that the symbols
were associated with the wrong parts of the variable.

This fixes PR36085.

Patch by: David Stenberg

Reviewers: aprantl, probinson, dblaikie

Reviewed By: aprantl

Subscribers: JDevlieghere, llvm-commits

Tags: #debug-info

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

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

6 years ago[Sparc] Account for bias in stack readjustment
Jonas Devlieghere [Mon, 29 Jan 2018 12:10:32 +0000 (12:10 +0000)]
[Sparc] Account for bias in stack readjustment

Summary: This was broken long ago in D12208, which failed to account for
the fact that 64-bit SPARC uses a stack bias of 2047, and it is the
*unbiased* value which should be aligned, not the biased one. This was
seen to be an issue with Rust.

Patch by: jrtc27 (James Clarke)

Reviewers: jyknight, venkatra

Reviewed By: jyknight

Subscribers: jacob_hansen, JDevlieghere, fhahn, fedor.sergeev, llvm-commits

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

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

6 years agoFix build broken by r323641
Pavel Labath [Mon, 29 Jan 2018 11:53:46 +0000 (11:53 +0000)]
Fix build broken by r323641

The call to ScopedPrinter::printNumber with size_t argument was
ambiguous (I think) on 32-bit builds. Explicitly cast to a 64-bit int to
avoid this.

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

6 years agoRefactor dwarfdump -apple-names output
Pavel Labath [Mon, 29 Jan 2018 11:33:17 +0000 (11:33 +0000)]
Refactor dwarfdump -apple-names output

Summary:
This modifies the dwarfdump output to align it with the new .debug_names
dump. It also renames two header fields to match similar fields in the
dwarf5 header.

A couple of tests needed to be updated to match new output. The changes
were fairly straight-forward, although not really automatable.

Reviewers: JDevlieghere, aprantl

Subscribers: llvm-commits

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

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

6 years ago[ARM] FP16Pat and FullFP16Pat patterns. NFC.
Sjoerd Meijer [Mon, 29 Jan 2018 11:28:06 +0000 (11:28 +0000)]
[ARM] FP16Pat and FullFP16Pat patterns. NFC.

Create and use FP16Pat FullFP16Pat helper patterns to make the difference
explicit.

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

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

6 years ago[DebugInfo] Basic .debug_names dumping support
Pavel Labath [Mon, 29 Jan 2018 11:08:32 +0000 (11:08 +0000)]
[DebugInfo] Basic .debug_names dumping support

Summary:
This commit renames DWARFAcceleratorTable to AppleAcceleratorTable to free up
the first name as an interface for the different accelerator tables.
Then I add a DWARFDebugNames class for the dwarf5 table.

Presently, the only common functionality of the two classes is the dump()
method, because this is the only method that was necessary to implement
dwarfdump -debug-names; and because the rest of the
AppleAcceleratorTable interface does not directly transfer to the dwarf5
tables (the main reason for that is that the present interface assumes
the tables are homogeneous, but the dwarf5 tables can have different
keys associated with each entry).

I expect to make the common interface richer as I add more functionality
to the new class (and invent a way to represent it in generic way).

In terms of sharing the implementation, I found the format of the two
tables sufficiently different to frustrate any attempts to have common
parsing or dumping code, so presently the implementations share just low
level code for formatting dwarf constants.

Reviewers: vleschuk, JDevlieghere, clayborg, aprantl, probinson, echristo, dblaikie

Subscribers: llvm-commits

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

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

6 years ago[X86FixupBWInsts] Fix miscompilation if sibling sub-register is live.
Andrei Elovikov [Mon, 29 Jan 2018 09:26:04 +0000 (09:26 +0000)]
[X86FixupBWInsts] Fix miscompilation if sibling sub-register is live.

Summary: The issues was found during D40524.

Reviewers: andrew.w.kaylor, craig.topper, MatzeB

Reviewed By: andrew.w.kaylor

Subscribers: aivchenk, llvm-commits

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

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

6 years ago[AArch64] Generate the CASP instruction for 128-bit cmpxchg
Oliver Stannard [Mon, 29 Jan 2018 09:18:37 +0000 (09:18 +0000)]
[AArch64] Generate the CASP instruction for 128-bit cmpxchg

The Large System Extension added an atomic compare-and-swap instruction
that operates on a pair of 64-bit registers, which we can use to
implement a 128-bit cmpxchg.

Because i128 is not a legal type for AArch64 we have to do all of the
instruction selection in C++, and the instruction requires even/odd
register pairs, so we have to wrap it in REG_SEQUENCE and EXTRACT_SUBREG
nodes. This is very similar to what we do for 64-bit cmpxchg in the ARM
backend.

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

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

6 years ago[ThinLTO] - Stop internalizing and drop non-prevailing symbols.
George Rimar [Mon, 29 Jan 2018 08:03:30 +0000 (08:03 +0000)]
[ThinLTO] - Stop internalizing and drop non-prevailing symbols.

Implementation marks non-prevailing symbols as not live in the summary.
Then them are dropped in backends.

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

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

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

6 years ago[X86] Make foldLogicOfSetCCs work better for vectors pre legal types/operations
Craig Topper [Mon, 29 Jan 2018 07:52:55 +0000 (07:52 +0000)]
[X86] Make foldLogicOfSetCCs work better for vectors pre legal types/operations

Summary:
There's a check in the code to only check getSetCCResultType after LegalOperations or if the type is MVT::i1. But the i1 check is only allowing scalar types through. I think it should check that the scalar type is MVT::i1 so that it will work for vectors.

The changed test already does this combine with AVX512VL where getSetCCResultType returns vXi1. But with avx512f and no VLX getSetCCResultType returns a type matching the width of the input type.

Reviewers: spatel, RKSimon

Reviewed By: spatel

Subscribers: llvm-commits

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

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

6 years ago[CVP] Don't Replace incoming values from unreachable blocks with undef.
Davide Italiano [Mon, 29 Jan 2018 05:59:55 +0000 (05:59 +0000)]
[CVP] Don't Replace incoming values from unreachable blocks with undef.

This pretty much reverts r322006, except that we keep the test,
because we work around the issue exposed in a different way (a
recursion limit in value tracking). There's still probably some
sequence that exposes this problem, and the proper way to fix that
for somebody who has time is outlined in the code review.

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

6 years ago[NFC] fix trivial typos in comments and documents
Hiroshi Inoue [Mon, 29 Jan 2018 05:17:03 +0000 (05:17 +0000)]
[NFC] fix trivial typos in comments and documents

"to to" -> "to"

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

6 years ago[InlineCost] Mark functions accessing varargs as not viable.
Florian Hahn [Sun, 28 Jan 2018 19:11:49 +0000 (19:11 +0000)]
[InlineCost] Mark functions accessing varargs as not viable.

This prevents functions accessing varargs from being inlined if they
have the alwaysinline attribute.

Reviewers: efriedma, rnk, davide

Reviewed By: efriedma

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

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

6 years ago[Support] Move DJB hash to support. NFC
Jonas Devlieghere [Sun, 28 Jan 2018 11:05:10 +0000 (11:05 +0000)]
[Support] Move DJB hash to support. NFC

This patch moves the DJB hash to support. This is consistent with other
hashing algorithms living there. The hash is used by the DWARF
accelerator tables. We're doing this now because the hashing function is
needed by dsymutil and we don't want to link against libBinaryFormat.

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

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

6 years ago[X86] Fix a crash that can occur in combineExtractVectorElt due to not checking the...
Craig Topper [Sun, 28 Jan 2018 07:29:35 +0000 (07:29 +0000)]
[X86] Fix a crash that can occur in combineExtractVectorElt due to not checking the width of a ConstantSDNode before calling getConstantOperandVal.

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

6 years ago[X86] Remove VPTESTM/VPTESTNM ISD opcodes. Use isel patterns matching cmpm eq/ne...
Craig Topper [Sun, 28 Jan 2018 00:56:30 +0000 (00:56 +0000)]
[X86] Remove VPTESTM/VPTESTNM ISD opcodes. Use isel patterns matching cmpm eq/ne with immallzeros.

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

6 years ago[X86] Add patterns for using masked vptestnmd for 256-bit vectors without VLX.
Craig Topper [Sat, 27 Jan 2018 23:49:14 +0000 (23:49 +0000)]
[X86] Add patterns for using masked vptestnmd for 256-bit vectors without VLX.

We can widen the mask and extract it back down.

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

6 years ago[X86] Add test to demonstrate missed opportunity to merge kand into testnm when using...
Craig Topper [Sat, 27 Jan 2018 23:49:11 +0000 (23:49 +0000)]
[X86] Add test to demonstrate missed opportunity to merge kand into testnm when using 512-bit instruction due to lack of VLX.

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

6 years agoAdd triples or specify REQUIRES: default_triple to some tests
Justin Bogner [Sat, 27 Jan 2018 23:31:09 +0000 (23:31 +0000)]
Add triples or specify REQUIRES: default_triple to some tests

These were all failing when building the X86 backend but specifying
LLVM_DEFAULT_TARGET_TRIPLE=''.

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

6 years ago[X86][AVX512] Add avx512dq fp2int/int2fp tests (PR31630)
Simon Pilgrim [Sat, 27 Jan 2018 22:08:27 +0000 (22:08 +0000)]
[X86][AVX512] Add avx512dq fp2int/int2fp tests (PR31630)

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

6 years ago[X86] Use vptestm/vptestnm for comparisons with zero to avoid creating a zero vector.
Craig Topper [Sat, 27 Jan 2018 20:19:09 +0000 (20:19 +0000)]
[X86] Use vptestm/vptestnm for comparisons with zero to avoid creating a zero vector.

We can use the same input for both operands to get a free compare with zero.

We already use this trick in a couple places where we explicitly create PTESTM with the same input twice. This generalizes it.

I'm hoping to remove the ISD opcodes and move this to isel patterns like we do for scalar cmp/test.

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

6 years ago[X86] Remove X86ISD::PCMPGTM/PCMPEQM and instead just use X86ISD::PCMPM and pattern...
Craig Topper [Sat, 27 Jan 2018 20:19:02 +0000 (20:19 +0000)]
[X86] Remove X86ISD::PCMPGTM/PCMPEQM and instead just use X86ISD::PCMPM and pattern match the immediate value during isel.

Legalization is still biased to turn LT compares in to GT by swapping operands to avoid needing extra isel patterns to commute.

I'm hoping to remove TESTM/TESTNM next and this should simplify that by making EQ/NE more similar.

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

6 years agoRegenerate test. NFCI
Simon Pilgrim [Sat, 27 Jan 2018 19:49:46 +0000 (19:49 +0000)]
Regenerate test. NFCI

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

6 years ago[X86][SSE] Simplify demanded elements from BROADCAST shuffle source.
Simon Pilgrim [Sat, 27 Jan 2018 19:48:13 +0000 (19:48 +0000)]
[X86][SSE] Simplify demanded elements from BROADCAST shuffle source.

If broadcasting from another shuffle, attempt to simplify it.

We can probably generalize this a lot more (embedding in combineX86ShufflesRecursively), but BROADCAST is one of the more troublesome as it accepts inputs of different sizes to the result.

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

6 years agoAdd IRBuilder API to create memcpy/memmove calls with differing source and dest align...
Daniel Neilson [Sat, 27 Jan 2018 17:59:10 +0000 (17:59 +0000)]
Add IRBuilder API to create memcpy/memmove calls with differing source and dest alignments

Summary:
  This change is step two in the series of changes to remove alignment argument from
memcpy/memmove/memset in favour of alignment attributes. Steps:

Step 1) Remove alignment parameter and create alignment parameter attributes for
   memcpy/memmove/memset. ( rL322965 )
Step 2) Expand the IRBuilder API to allow creation of memcpy/memmove with differing
   source and dest alignments.
Step 3) Update Clang to use the new IRBuilder API.
Step 4) Update Polly to use the new IRBuilder API.
Step 5) Update LLVM passes that create memcpy/memmove calls to use the new IRBuilder API,
        and those that use use MemIntrinsicInst::[get|set]Alignment() to use
        getDestAlignment() and getSourceAlignment() instead.
Step 6) Remove the single-alignment IRBuilder API for memcpy/memmove, and the
        MemIntrinsicInst::[get|set]Alignment() methods.

Reference
   http://lists.llvm.org/pipermail/llvm-dev/2015-August/089384.html
   http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151109/312083.html

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

6 years agoRegenerate test result for vastart-defs-eflags.ll. NFC.
Amaury Sechet [Sat, 27 Jan 2018 17:52:32 +0000 (17:52 +0000)]
Regenerate test result for vastart-defs-eflags.ll. NFC.

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

6 years agoRegenerate test result for testb-je-fusion.ll. NFC.
Amaury Sechet [Sat, 27 Jan 2018 17:19:16 +0000 (17:19 +0000)]
Regenerate test result for testb-je-fusion.ll. NFC.

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

6 years agoRegenerate test result for stateppint-vector.ll. NFC.
Amaury Sechet [Sat, 27 Jan 2018 17:16:26 +0000 (17:16 +0000)]
Regenerate test result for stateppint-vector.ll. NFC.

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

6 years agoRegenrate brcond.ll test results. NFC
Amaury Sechet [Sat, 27 Jan 2018 16:57:15 +0000 (16:57 +0000)]
Regenrate brcond.ll test results. NFC

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

6 years agoRegenrate test results for avx-brcond.ll . NFC
Amaury Sechet [Sat, 27 Jan 2018 16:44:00 +0000 (16:44 +0000)]
Regenrate test results for avx-brcond.ll . NFC

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

6 years ago[X86][SSE] Regenerate fp2int/int2fp tests
Simon Pilgrim [Sat, 27 Jan 2018 16:39:12 +0000 (16:39 +0000)]
[X86][SSE] Regenerate fp2int/int2fp tests

Cleanup check prefixes and check full codegen

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

6 years agoRegenerate test results for and-su.ll . NFC
Amaury Sechet [Sat, 27 Jan 2018 16:00:10 +0000 (16:00 +0000)]
Regenerate test results for and-su.ll . NFC

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

6 years ago[X86][SSE] Add broadcast from v2i32 memory tests (PR34394)
Simon Pilgrim [Sat, 27 Jan 2018 15:54:57 +0000 (15:54 +0000)]
[X86][SSE] Add broadcast from v2i32 memory tests (PR34394)

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

6 years ago[TargetLowering] Teach TargetLowering::SimplifySetCC to simplify setcc of vXi1 vector...
Craig Topper [Sat, 27 Jan 2018 09:10:58 +0000 (09:10 +0000)]
[TargetLowering] Teach TargetLowering::SimplifySetCC to simplify setcc of vXi1 vectors into logic ops.

This transform was already being done for setcc of scalar i1. This extends it to vectors.

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

6 years ago[SelectionDAG] Make DAGTypeLegalizer::PromoteSetCCOperands handle SETEQ/SETNE correct...
Craig Topper [Sat, 27 Jan 2018 08:41:03 +0000 (08:41 +0000)]
[SelectionDAG] Make DAGTypeLegalizer::PromoteSetCCOperands handle SETEQ/SETNE correctly for vector types.

The code was using getValueSizeInBits and combining with the result of a call to DAG.ComputeNumSignBits. But for vector types getValueSizeInBits returns the width of the full vector while ComputeNumSignBits is going to give a number no larger than the width of a single element. So we should be using getScalarValueSizeInBits to get the element width.

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

6 years ago[GlobalISel][Legalizer] Convert the FP constants to the right APFloat type for G_FCON...
Amara Emerson [Sat, 27 Jan 2018 07:07:20 +0000 (07:07 +0000)]
[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/trunk@323582 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "[SLP] Fix for PR32086: Count InsertElementInstr of the same elements as shuffle."
Alexey Bataev [Sat, 27 Jan 2018 02:42:21 +0000 (02:42 +0000)]
Revert "[SLP] Fix for PR32086: Count InsertElementInstr of the same elements as shuffle."

This reverts commit r323530 to fix possible problems in users code.

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

6 years agoRevert "[SLP] Removed the warning about unused variable, NFC."
Alexey Bataev [Sat, 27 Jan 2018 02:42:17 +0000 (02:42 +0000)]
Revert "[SLP] Removed the warning about unused variable, NFC."

This reverts commit r323533 to fix possible problems in users code.

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

6 years ago[InstrProfiling] Don't exit early when an unused intrinsic is found
Vedant Kumar [Sat, 27 Jan 2018 00:01:04 +0000 (00:01 +0000)]
[InstrProfiling] Don't exit early when an unused intrinsic is found

This fixes a think-o in r323574.

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

6 years ago[LangRef] Update out-of-date instrprof names
Vedant Kumar [Fri, 26 Jan 2018 23:54:25 +0000 (23:54 +0000)]
[LangRef] Update out-of-date instrprof names

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

6 years ago[InstrProfiling] Improve compile time when there is no work
Vedant Kumar [Fri, 26 Jan 2018 23:54:24 +0000 (23:54 +0000)]
[InstrProfiling] Improve compile time when there is no work

When there are no uses of profiling intrinsics in a module, and there's
no coverage data to lower, InstrProfiling has no work to do.

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

6 years agoupdate_mir_test_checks: Accept "." in function names
Justin Bogner [Fri, 26 Jan 2018 22:56:31 +0000 (22:56 +0000)]
update_mir_test_checks: Accept "." in function names

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

6 years ago[X86] Use vpternlog to implement vector not under AVX512.
Craig Topper [Fri, 26 Jan 2018 22:17:40 +0000 (22:17 +0000)]
[X86] Use vpternlog to implement vector not under AVX512.

Previously we had to materialize all 1s in a register using vpternlog or pcmpeq and then xor with that. By using vpternlog directly we can do it in one operation.

This is implemented using isel patterns, but we should maybe consider creating a generalized vpternlog combiner.

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

6 years ago[x86] auto-generate complete checks; NFC
Sanjay Patel [Fri, 26 Jan 2018 22:06:07 +0000 (22:06 +0000)]
[x86] auto-generate complete checks; NFC

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

6 years ago[InstCombine] Preserve debug values for eliminable casts
Vedant Kumar [Fri, 26 Jan 2018 22:02:52 +0000 (22:02 +0000)]
[InstCombine] Preserve debug values for eliminable casts

A cast from A to B is eliminable if its result is casted to C, and if
the pair of casts could just be expressed as a single cast. E.g here,
%c1 is eliminable:

  %c1 = zext i16 %A to i32
  %c2 = sext i32 %c1 to i64

InstCombine optimizes away eliminable casts. This patch teaches it to
insert a dbg.value intrinsic pointing to the final result, so that local
variables pointing to the eliminable result are preserved.

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

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

6 years agoInline variable only used within assert.
Richard Trieu [Fri, 26 Jan 2018 21:55:13 +0000 (21:55 +0000)]
Inline variable only used within assert.

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

6 years ago[Hexagon] Generate constant splats instead of loads from constant pool
Krzysztof Parzyszek [Fri, 26 Jan 2018 21:54:56 +0000 (21:54 +0000)]
[Hexagon] Generate constant splats instead of loads from constant pool

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