]> granicus.if.org Git - llvm/log
llvm
5 years ago[GlobalISel][Localizer] Rewrite localizer to run in 2 phases, inter & intra block.
Amara Emerson [Mon, 17 Jun 2019 23:20:29 +0000 (23:20 +0000)]
[GlobalISel][Localizer] Rewrite localizer to run in 2 phases, inter & intra block.

Inter-block localization is the same as what currently happens, except now it
only runs on the entry block because that's where the problematic constants with
long live ranges come from.

The second phase is a new intra-block localization phase which attempts to
re-sink the already localized instructions further right before one of the
multiple uses.

One additional change is to also localize G_GLOBAL_VALUE as they're constants
too. However, on some targets like arm64 it takes multiple instructions to
materialize the value, so some additional heuristics with a TTI hook have been
introduced attempt to prevent code size regressions when localizing these.

Overall, these changes improve CTMark code size on arm64 by 1.2%.

Full code size results:

Program                                         baseline       new       diff
------------------------------------------------------------------------------
 test-suite...-typeset/consumer-typeset.test    1249984      1217216     -2.6%
 test-suite...:: CTMark/ClamAV/clamscan.test    1264928      1232152     -2.6%
 test-suite :: CTMark/SPASS/SPASS.test          1394092      1361316     -2.4%
 test-suite...Mark/mafft/pairlocalalign.test    731320       714928      -2.2%
 test-suite :: CTMark/lencod/lencod.test        1340592      1324200     -1.2%
 test-suite :: CTMark/kimwitu++/kc.test         3853512      3820420     -0.9%
 test-suite :: CTMark/Bullet/bullet.test        3406036      3389652     -0.5%
 test-suite...ark/tramp3d-v4/tramp3d-v4.test    8017000      8016992     -0.0%
 test-suite...TMark/7zip/7zip-benchmark.test    2856588      2856588      0.0%
 test-suite...:: CTMark/sqlite3/sqlite3.test    765704       765704       0.0%
 Geomean difference                                                      -1.2%

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

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

5 years agoPropagate fmf in IRTranslate for fneg
Michael Berg [Mon, 17 Jun 2019 23:19:40 +0000 (23:19 +0000)]
Propagate fmf in IRTranslate for fneg

Summary: This case is related to D63405 in that we need to be propagating FMF on negates.

Reviewers: volkan, spatel, arsenm

Reviewed By: arsenm

Subscribers: wdng, javed.absar

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

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

5 years agoUse VR128X instead of FR32X/FR64X for the register class in VMOVSSZmrk/VMOVSDZmrk.
Craig Topper [Mon, 17 Jun 2019 23:08:29 +0000 (23:08 +0000)]
Use VR128X instead of FR32X/FR64X for the register class in VMOVSSZmrk/VMOVSDZmrk.

Removes COPY_TO_REGCLASS from some patterns.

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

5 years ago[X86] Make an assert in LowerSCALAR_TO_VECTOR stricter to make it clear what types...
Craig Topper [Mon, 17 Jun 2019 23:08:09 +0000 (23:08 +0000)]
[X86] Make an assert in LowerSCALAR_TO_VECTOR stricter to make it clear what types are allowed here. NFC

Make it clear that only integer type with i32 or smaller elements shoudl get to this part of the code.

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

5 years ago[AMDGPU] Use custom inserter for gfx10 VOP2b
Stanislav Mekhanoshin [Mon, 17 Jun 2019 22:37:37 +0000 (22:37 +0000)]
[AMDGPU] Use custom inserter for gfx10 VOP2b

This is part of the approved D63204 pending parent revision.
This small change is in fact a part of the VOP2b legalization which
does not technically belong to wave32 support, so extracted
separately.

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

5 years ago[AMDGPU] gfx1010 subvector test. NFC.
Stanislav Mekhanoshin [Mon, 17 Jun 2019 21:55:06 +0000 (21:55 +0000)]
[AMDGPU] gfx1010 subvector test. NFC.

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

5 years ago[test][AArch64] Relax the check line for G_BRJT in legalizer-info-validation.mir
Volkan Keles [Mon, 17 Jun 2019 21:25:25 +0000 (21:25 +0000)]
[test][AArch64] Relax the check line for G_BRJT in legalizer-info-validation.mir

Replace the specific number with a pattern to relax the test.

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

5 years agoTeach getSCEVAtScope how to handle loop phis w/invariant operands in loops w/taken...
Philip Reames [Mon, 17 Jun 2019 21:06:17 +0000 (21:06 +0000)]
Teach getSCEVAtScope how to handle loop phis w/invariant operands in loops w/taken backedges

This patch really contains two pieces:
    Teach SCEV how to fold a phi in the header of a loop to the value on the backedge when a) the backedge is known to execute at least once, and b) the value is safe to use globally within the scope dominated by the original phi.
    Teach IndVarSimplify's rewriteLoopExitValues to allow loop invariant expressions which already exist (and thus don't need new computation inserted) even in loops where we can't optimize away other uses.

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

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

5 years agoAdd convenience utility for replacing a range within a container with a
Richard Smith [Mon, 17 Jun 2019 21:01:09 +0000 (21:01 +0000)]
Add convenience utility for replacing a range within a container with a
different range, in preparation for use in Clang.

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

5 years ago[globalisel] Fix iterator invalidation in the extload combines
Daniel Sanders [Mon, 17 Jun 2019 20:56:31 +0000 (20:56 +0000)]
[globalisel] Fix iterator invalidation in the extload combines

Summary:
Change the way we deal with iterator invalidation in the extload combines as it
was still possible to neglect to visit a use. Even worse, it happened in the
in-tree test cases and the checks weren't good enough to detect it.

We now take a cheap copy of the use list before iterating over it. This
prevents iterator invalidation from occurring and has the nice side effect
of making the existing schedule-for-erase/schedule-for-insert mechanism
moot.

Reviewers: aditya_nandakumar

Reviewed By: aditya_nandakumar

Subscribers: rovka, kristof.beyls, javed.absar, volkan, Petar.Avramovic, llvm-commits

Tags: #llvm

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

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

5 years ago[AMDGPU] Propagate function attributes thru bitcasts
Stanislav Mekhanoshin [Mon, 17 Jun 2019 20:42:48 +0000 (20:42 +0000)]
[AMDGPU] Propagate function attributes thru bitcasts

AMDGPUPropagateAttributes will not work on function bitcatsts,
so move AMDGPUFixFunctionBitcasts before it.

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

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

5 years agoFix a bug w/inbounds invalidation in LFTR (recommit)
Philip Reames [Mon, 17 Jun 2019 20:32:22 +0000 (20:32 +0000)]
Fix a bug w/inbounds invalidation in LFTR (recommit)

Recommit r363289 with a bug fix for crash identified in pr42279.  Issue was that a loop exit test does not have to be an icmp, leading to a null dereference crash when new logic was exercised for that case.  Test case previously committed in r363601.

Original commit comment follows:

This contains fixes for two cases where we might invalidate inbounds and leave it stale in the IR (a miscompile). Case 1 is when switching to an IV with no dynamically live uses, and case 2 is when doing pre-to-post conversion on the same pointer type IV.

The basic scheme used is to prove that using the given IV (pre or post increment forms) would have to already trigger UB on the path to the test we're modifying. As such, our potential UB triggering use does not change the semantics of the original program.

As was pointed out in the review thread by Nikita, this is defending against a separate issue from the hasConcreteDef case. This is about poison, that's about undef. Unfortunately, the two are different, see Nikita's comment for a fuller explanation, he explains it well.

(Note: I'm going to address Nikita's last style comment in a separate commit just to minimize chance of subtle bugs being introduced due to typos.)

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

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

5 years agogn build: Merge r363483.
Peter Collingbourne [Mon, 17 Jun 2019 20:03:11 +0000 (20:03 +0000)]
gn build: Merge r363483.

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

5 years agogn build: Merge r363584.
Peter Collingbourne [Mon, 17 Jun 2019 19:59:16 +0000 (19:59 +0000)]
gn build: Merge r363584.

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

5 years agoAMDGPU/GFX10: Don't generate s_code_end padding in the asm-printer
Nicolai Haehnle [Mon, 17 Jun 2019 19:28:43 +0000 (19:28 +0000)]
AMDGPU/GFX10: Don't generate s_code_end padding in the asm-printer

Summary:
The purpose of the padding is to guard against stale code being
fetched into the instruction cache by the lowest level prefetching.
We're generating relocatable ELF here, and so the padding should
arguably be added by the linker. This is in fact what Mesa does.

This also fixes multi-part shaders for Mesa.

Change-Id: I6bfede58f20e9f337762ccf39ef9e0e263e69e82

Reviewers: arsenm, rampitec, t-tye

Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, llvm-commits

Tags: #llvm

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

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

5 years agoReduced test case for pr42279 in advance of the relevant re-commit + fix
Philip Reames [Mon, 17 Jun 2019 19:27:45 +0000 (19:27 +0000)]
Reduced test case for pr42279 in advance of the relevant re-commit + fix

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

5 years agoAMDGPU: Explicitly define a triple for some tests
Nicolai Haehnle [Mon, 17 Jun 2019 19:25:57 +0000 (19:25 +0000)]
AMDGPU: Explicitly define a triple for some tests

Summary:
This is related to the changes to the groupstaticsize intrinsic in
D61494 which would otherwise make the related tests in these files
fail or much less useful.

Note that for some reason, SOPK generation is less effective in the
amdhsa OS, which is why I chose PAL. I haven't investigated this
deeper.

Change-Id: I6bb99569338f7a433c28b4c9eb1e3e036b00d166

Reviewers: arsenm

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

Tags: #llvm

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

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

5 years ago[EarlyCSE] Fix hashing of self-compares
Joseph Tremoulet [Mon, 17 Jun 2019 19:11:28 +0000 (19:11 +0000)]
[EarlyCSE] Fix hashing of self-compares

Summary:
Update compare normalization in SimpleValue hashing to break ties (when
the same value is being compared to itself) by switching to the swapped
predicate if it has a lower numerical value.  This brings the hashing in
line with isEqual, which already recognizes the self-compares with
swapped predicates as equal.

Fixes PR 42280.

Reviewers: spatel, efriedma, nikic, fhahn, uabelho

Reviewed By: nikic

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[MemorySSA] Don't use template when the clone is a simplified instruction.
Alina Sbirlea [Mon, 17 Jun 2019 18:58:40 +0000 (18:58 +0000)]
[MemorySSA] Don't use template when the clone is a simplified instruction.

Summary:
LoopRotate doesn't create a faithful clone of an instruction, it may
simplify it beforehand. Hence the clone of an instruction that has a
MemoryDef associated may not be a definition, but a use or not a memory
alternig instruction.
Don't rely on the template when the clone may be simplified.

Reviewers: george.burgess.iv

Subscribers: jlebar, Prazek, llvm-commits

Tags: #llvm

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

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

5 years ago[GlobalISel][AArch64] Fold G_SUB into G_ICMP when it's safe to do so
Jessica Paquette [Mon, 17 Jun 2019 18:40:06 +0000 (18:40 +0000)]
[GlobalISel][AArch64] Fold G_SUB into G_ICMP when it's safe to do so

Basically porting over the behaviour in AArch64ISelLowering to GISel. See
emitComparison for reference.

When we have something like this:

```
  lhs = G_SUB 0, y
  ...
  G_ICMP lhs, rhs
```

We can fold away the G_SUB and produce a cmn instead, given that we produce
the same value in NZCV.

Add a test showing that the transformation works, and also showing that we
don't perform the transformation when it's unsafe.

Also factor out the CSet emission into emitCSetForICMP.

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

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

5 years ago[X86] Add TB_NO_REVERSE to some memory folding table entries where the register form...
Craig Topper [Mon, 17 Jun 2019 18:38:07 +0000 (18:38 +0000)]
[X86] Add TB_NO_REVERSE to some memory folding table entries where the register form requires 64-bit mode, but the memory form does not.

We don't know if its safe to unfold if we're in 32-bit mode.

This is simlar to what was done to some load opcodes in r363523.

I think its pretty unlikely we will try to unfold these anyway so
I don't think this is testable.

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

5 years agoLiveInterval.h: add LiveRange::findIndexesLiveAt function - return a list of SlotInde...
Valery Pykhtin [Mon, 17 Jun 2019 18:23:39 +0000 (18:23 +0000)]
LiveInterval.h: add LiveRange::findIndexesLiveAt function - return a list of SlotIndexes the LiveRange live at.

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

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

5 years ago[X86][SSE] Scalarize under-aligned XMM vector nt-stores (PR42026)
Simon Pilgrim [Mon, 17 Jun 2019 18:20:04 +0000 (18:20 +0000)]
[X86][SSE] Scalarize under-aligned XMM vector nt-stores (PR42026)

If a XMM non-temporal store has less than natural alignment, scalarize the vector - with SSE4A we can stay on the vector and use MOVNTSD(f64), else we must move to GPRs and use MOVNTI(i32/i64).

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

5 years agoAMDGPU: Make getreg intrinsic inaccessiblememonly
Matt Arsenault [Mon, 17 Jun 2019 18:17:25 +0000 (18:17 +0000)]
AMDGPU: Make getreg intrinsic inaccessiblememonly

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

5 years ago[MemorySSA] Add all MemoryPhis before filling their values.
Alina Sbirlea [Mon, 17 Jun 2019 18:16:53 +0000 (18:16 +0000)]
[MemorySSA] Add all MemoryPhis before filling their values.

Summary:
Add all MemoryPhis in IDF before filling in their incomign values.
Otherwise, a new Phi can be added that needs to become the incoming
value of another Phi.
Test fails the verification in verifyPrevDefInPhis.

Reviewers: george.burgess.iv

Subscribers: jlebar, Prazek, zzheng, llvm-commits

Tags: #llvm

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

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

5 years ago[AMDGPU] gfx1010 wavefrontsize intrinsic folding
Stanislav Mekhanoshin [Mon, 17 Jun 2019 17:57:50 +0000 (17:57 +0000)]
[AMDGPU] gfx1010 wavefrontsize intrinsic folding

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

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

5 years agoAMDGPU: Fold readlane/readfirstlane calls
Matt Arsenault [Mon, 17 Jun 2019 17:52:35 +0000 (17:52 +0000)]
AMDGPU: Fold readlane/readfirstlane calls

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

5 years ago[AMDGPU] Pass to propagate ABI attributes from kernels to the functions
Stanislav Mekhanoshin [Mon, 17 Jun 2019 17:47:28 +0000 (17:47 +0000)]
[AMDGPU] Pass to propagate ABI attributes from kernels to the functions

The pass works in two modes:

Mode 1: Just set attributes starting from kernels. This can work at
the very beginning of opt and llc pipeline, but cannot clone functions
because it must be a function pass.

Mode 2: Actually clone functions for new attributes. This can only work
after all function passes in the opt pipeline because it has to be a
module pass.

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

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

5 years agogn build: Merge r363541
Nico Weber [Mon, 17 Jun 2019 17:45:12 +0000 (17:45 +0000)]
gn build: Merge r363541

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

5 years ago[X86][AVX] Split under-aligned vector nt-stores.
Simon Pilgrim [Mon, 17 Jun 2019 17:22:38 +0000 (17:22 +0000)]
[X86][AVX] Split under-aligned vector nt-stores.

If a YMM/ZMM non-temporal store has less than natural alignment, split the vector - either they will be satisfactorily aligned or will continue to be split until they are XMMs - at which point the legalizer will scalarize it.

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

5 years ago[LV] Suppress vectorization in some nontemporal cases
Warren Ristow [Mon, 17 Jun 2019 17:20:08 +0000 (17:20 +0000)]
[LV] Suppress vectorization in some nontemporal cases

When considering a loop containing nontemporal stores or loads for
vectorization, suppress the vectorization if the corresponding
vectorized store or load with the aligment of the original scaler
memory op is not supported with the nontemporal hint on the target.

This adds two new functions:
  bool isLegalNTStore(Type *DataType, unsigned Alignment) const;
  bool isLegalNTLoad(Type *DataType, unsigned Alignment) const;

to TTI, leaving the target independent default implementation as
returning true, but with overriding implementations for X86 that
check the legality based on available Subtarget features.

This fixes https://llvm.org/PR40759

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

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

5 years agoGlobalISel: Ignore callsite attributes when picking intrinsic type
Matt Arsenault [Mon, 17 Jun 2019 17:01:35 +0000 (17:01 +0000)]
GlobalISel: Ignore callsite attributes when picking intrinsic type

A target intrinsic may be defined as possibly reading memory, but the
call site may have additional knowledge that it doesn't read
memory. The intrinsic lowering will expect the pessimistic assumption
of the intrinsic definition, so the chain should still be used.

I fixed the same bug in SelectionDAG in r287593.

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

5 years agoGlobalISel: Verify intrinsics
Matt Arsenault [Mon, 17 Jun 2019 17:01:32 +0000 (17:01 +0000)]
GlobalISel: Verify intrinsics

I keep using the wrong instruction when manually writing tests. This
really needs to check the number of operands, but I don't see an easy
way to do that right now.

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

5 years agoAMDGPU/GlobalISel: Account for multiple defs when finding intrinsic ID
Matt Arsenault [Mon, 17 Jun 2019 17:01:27 +0000 (17:01 +0000)]
AMDGPU/GlobalISel: Account for multiple defs when finding intrinsic ID

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

5 years ago[AMDGPU] gfx1010 wave32 metadata
Stanislav Mekhanoshin [Mon, 17 Jun 2019 16:48:56 +0000 (16:48 +0000)]
[AMDGPU] gfx1010 wave32 metadata

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

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

5 years agoAMDGPU/GlobalISel: Implement select for G_ICMP and G_SELECT
Tom Stellard [Mon, 17 Jun 2019 16:27:43 +0000 (16:27 +0000)]
AMDGPU/GlobalISel: Implement select for G_ICMP and G_SELECT

Reviewers: arsenm

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, rovka, kristof.beyls, dstuttard, tpr, t-tye, hiraditya, Petar.Avramovic, llvm-commits

Tags: #llvm

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

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

5 years ago[Remarks] Extend -fsave-optimization-record to specify the format
Francis Visoiu Mistrih [Mon, 17 Jun 2019 16:06:00 +0000 (16:06 +0000)]
[Remarks] Extend -fsave-optimization-record to specify the format

Use -fsave-optimization-record=<format> to specify a different format
than the default, which is YAML.

For now, only YAML is supported.

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

5 years ago[X86] combineLoad - begun making the load split code more generic. NFCI.
Simon Pilgrim [Mon, 17 Jun 2019 15:54:36 +0000 (15:54 +0000)]
[X86] combineLoad - begun making the load split code more generic. NFCI.

This is currently only used for ymm->xmm splitting but we shouldn't hardcode the offsets/alignment.

This is necessary for an upcoming patch to split under-aligned non-temporal vector loads.

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

5 years agoPHINode: introduce setIncomingValueForBlock() function, and use it.
Whitney Tsang [Mon, 17 Jun 2019 14:38:56 +0000 (14:38 +0000)]
PHINode: introduce setIncomingValueForBlock() function, and use it.

Summary:
There is PHINode::getBasicBlockIndex() and PHINode::setIncomingValue()
but no function to replace incoming value for a specified BasicBlock*
predecessor.
Clearly, there are a lot of places that could use that functionality.

Reviewer: craig.topper, lebedev.ri, Meinersbur, kbarton, fhahn
Reviewed By: Meinersbur, fhahn
Subscribers: fhahn, hiraditya, zzheng, jsji, llvm-commits
Tag: LLVM
Differential Revision: https://reviews.llvm.org/D63338

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

5 years ago[X86][SSE] Add tests for underaligned nt loads
Simon Pilgrim [Mon, 17 Jun 2019 14:38:17 +0000 (14:38 +0000)]
[X86][SSE] Add tests for underaligned nt loads

Test both 'unaligned' (which we should just use regular unaligned loads) and 'subvector aligned' (which we should split)

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

5 years ago[X86][SSE] Prevent misaligned non-temporal vector load/store combines
Simon Pilgrim [Mon, 17 Jun 2019 14:26:10 +0000 (14:26 +0000)]
[X86][SSE] Prevent misaligned non-temporal vector load/store combines

For loads, pre-SSE41 we can't perform NT loads at all, and after that we can only perform vector aligned loads, so if the alignment is less than for a xmm we'll just end up using the regular unaligned vector loads anyway.

First step towards fixing PR42026 - the next step for stores will be to use SSE4A movntsd where possible and to avoid the stack spill on SSE2 targets.

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

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

5 years agoInferAddressSpaces: Fix cloning original addrspacecast
Matt Arsenault [Mon, 17 Jun 2019 14:13:29 +0000 (14:13 +0000)]
InferAddressSpaces: Fix cloning original addrspacecast

If an addrspacecast needed to be inserted again, this was creating a
clone of the original cast for each user. Just use the original, which
also saves losing the value name.

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

5 years agoAMDGPU: Ignore subtarget for InferAddressSpaces
Matt Arsenault [Mon, 17 Jun 2019 14:13:24 +0000 (14:13 +0000)]
AMDGPU: Ignore subtarget for InferAddressSpaces

Even if the target doesn't have flat instructions, addrspace(0) is
still flat. It just happens to not work.

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

5 years agoAMDGPU: Mark exp/exp.compr as inaccessiblememonly
Matt Arsenault [Mon, 17 Jun 2019 13:52:24 +0000 (13:52 +0000)]
AMDGPU: Mark exp/exp.compr as inaccessiblememonly

Should also be marked writeonly, but I think that would require
splitting the version with done set to a separate intrinsic

Test change is only from renumbering the attribute group numbers,
which for some reason the generated check lines consider.

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

5 years agoAMDGPU/GlobalISel: Fix default mapping for non-register operands
Matt Arsenault [Mon, 17 Jun 2019 13:52:19 +0000 (13:52 +0000)]
AMDGPU/GlobalISel: Fix default mapping for non-register operands

Tests will be in future commits when new intrinsics are handled here.

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

5 years agoAMDGPU: Cleanup custom PseudoSourceValue definitions
Matt Arsenault [Mon, 17 Jun 2019 13:52:15 +0000 (13:52 +0000)]
AMDGPU: Cleanup custom PseudoSourceValue definitions

Use separate enums for each kind, avoid repeating overloads, and add
missing classof implementation.

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

5 years ago[CodeGen] Check for HardwareLoop Latch ExitBlock
Sam Parker [Mon, 17 Jun 2019 13:39:28 +0000 (13:39 +0000)]
[CodeGen] Check for HardwareLoop Latch ExitBlock

The HardwareLoops pass finds exit blocks with a scevable exit count.
If the target specifies to update the loop counter in a register,
through a phi, we need to ensure that the exit block is a latch so
that we can insert the phi with the correct value for the incoming
edge.

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

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

5 years ago[X86][SSE] Avoid unnecessary stack codegen in NT store codegen tests.
Simon Pilgrim [Mon, 17 Jun 2019 12:35:26 +0000 (12:35 +0000)]
[X86][SSE] Avoid unnecessary stack codegen in NT store codegen tests.

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

5 years agoAsmPrinter: add doc-string for EmitLinkage
Nicolai Haehnle [Mon, 17 Jun 2019 12:24:04 +0000 (12:24 +0000)]
AsmPrinter: add doc-string for EmitLinkage

Change-Id: I376fcbd58f84a2aac6aaf744bc1665c92d312b25

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

5 years agogn build: Merge r363530
Nico Weber [Mon, 17 Jun 2019 12:18:27 +0000 (12:18 +0000)]
gn build: Merge r363530

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

5 years ago[LV] Deny irregular types in interleavedAccessCanBeWidened
Bjorn Pettersson [Mon, 17 Jun 2019 12:02:24 +0000 (12:02 +0000)]
[LV] Deny irregular types in interleavedAccessCanBeWidened

Summary:
Avoid that loop vectorizer creates loads/stores of vectors
with "irregular" types when interleaving. An example of
an irregular type is x86_fp80 that is 80 bits, but that
may have an allocation size that is 96 bits. So an array
of x86_fp80 is not bitcast compatible with a vector
of the same type.

Not sure if interleavedAccessCanBeWidened is the best
place for this check, but it solves the problem seen
in the added test case. And it is the same kind of check
that already exists in memoryInstructionCanBeWidened.

Reviewers: fhahn, Ayal, craig.topper

Reviewed By: fhahn

Subscribers: hiraditya, rkruppe, llvm-commits

Tags: #llvm

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

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

5 years agoTest forward references in IntrinsicEmitter on Neon LD(2|3|4)
Sander de Smalen [Mon, 17 Jun 2019 12:01:53 +0000 (12:01 +0000)]
Test forward references in IntrinsicEmitter on Neon LD(2|3|4)

This patch tests the forward-referencing added in D62995 by changing
some existing intrinsics to use forward referencing of overloadable
parameters, rather than backward referencing.

This patch changes the TableGen definition/implementation of
llvm.aarch64.neon.ld2lane and llvm.aarch64.neon.ld2lane intrinsics
(and similar for ld3 and ld4). This change is intended to be
non-functional, since the behaviour of the intrinsics is
expected to be the same.

Reviewers: arsenm, dmgreen, RKSimon, greened, rnk

Reviewed By: RKSimon

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

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

5 years ago[DAGCombiner] [CodeGenPrepare] More comprehensive GEP splitting
Luis Marques [Mon, 17 Jun 2019 10:54:12 +0000 (10:54 +0000)]
[DAGCombiner] [CodeGenPrepare] More comprehensive GEP splitting

Some GEPs were not being split, presumably because that split would just be
undone by the DAGCombiner. Not performing those splits can prevent important
optimizations, such as preventing the element indices / member offsets from
being (partially) folded into load/store instruction immediates. This patch:

- Makes the splits also occur in the cases where the base address and the GEP
  are in the same BB.
- Ensures that the DAGCombiner doesn't reassociate them back again.

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

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

5 years agoFix clang -Wcovered-switch-default after stack-id change by D60137
Fangrui Song [Mon, 17 Jun 2019 10:20:20 +0000 (10:20 +0000)]
Fix clang -Wcovered-switch-default after stack-id change by D60137

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

5 years ago[SelectionDAG] Fold insert_subvector(undef, extract_subvector(v, c), c) -> v in getNode
Simon Pilgrim [Mon, 17 Jun 2019 10:14:52 +0000 (10:14 +0000)]
[SelectionDAG] Fold insert_subvector(undef, extract_subvector(v, c), c) -> v in getNode

This is already done in DAGCombiner::visitINSERT_SUBVECTOR, but this helps a number of shuffles across different vector widths recognise when they come from the same source.

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

5 years ago[SCEV] Use NoWrapFlags when expanding a simple mul
Sam Parker [Mon, 17 Jun 2019 10:05:18 +0000 (10:05 +0000)]
[SCEV] Use NoWrapFlags when expanding a simple mul

Second functional change following on from rL362687. Pass the
NoWrapFlags from the MulExpr to InsertBinop when we're generating a
shl or mul.

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

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

5 years ago[llvm-objdump] Use %08 instead of %016 to print leading addresses for 32-bit binaries
Fangrui Song [Mon, 17 Jun 2019 09:59:55 +0000 (09:59 +0000)]
[llvm-objdump] Use %08 instead of %016 to print leading addresses for 32-bit binaries

Reviewed By: grimar

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

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

5 years ago[lit] Delete empty lines at the end of lit.local.cfg NFC
Fangrui Song [Mon, 17 Jun 2019 09:51:07 +0000 (09:51 +0000)]
[lit] Delete empty lines at the end of lit.local.cfg NFC

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

5 years ago[NFC][Codegen] Standalone tests for icmp eq/ne (urem %x, C), 0 -> icmp eq/ne %x,...
Roman Lebedev [Mon, 17 Jun 2019 09:50:50 +0000 (09:50 +0000)]
[NFC][Codegen] Standalone tests for icmp eq/ne (urem %x, C), 0 -> icmp eq/ne %x, 0 fold (D63390)

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

5 years ago[ARM] Fix another -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after...
Fangrui Song [Mon, 17 Jun 2019 09:29:50 +0000 (09:29 +0000)]
[ARM] Fix another -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after D63265

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

5 years ago[ARM] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after D63265
Fangrui Song [Mon, 17 Jun 2019 09:26:50 +0000 (09:26 +0000)]
[ARM] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after D63265

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

5 years agoDescribe stack-id as an enum
Sander de Smalen [Mon, 17 Jun 2019 09:13:29 +0000 (09:13 +0000)]
Describe stack-id as an enum

This patch changes MIR stack-id from an integer to an enum,
and adds printing/parsing support for this in MIR files. The default
stack-id '0' is now renamed to 'default'.

This should make MIR tests that have stack objects with different stack-ids
more descriptive. It also clarifies code operating on StackID.

Reviewers: arsenm, thegameg, qcolombet

Reviewed By: arsenm

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

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

5 years ago[ARM] Remove ARMComputeBlockSize
Sam Parker [Mon, 17 Jun 2019 09:13:10 +0000 (09:13 +0000)]
[ARM] Remove ARMComputeBlockSize

Forgot to remove file!

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

5 years ago[ARM] Add ARMBasicBlockInfo.cpp
Sam Parker [Mon, 17 Jun 2019 09:05:43 +0000 (09:05 +0000)]
[ARM] Add ARMBasicBlockInfo.cpp

Forgot to add file!

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

5 years ago[ARM] Extract some code from ARMConstantIslandPass
Sam Parker [Mon, 17 Jun 2019 08:49:09 +0000 (08:49 +0000)]
[ARM] Extract some code from ARMConstantIslandPass

Create the ARMBasicBlockUtils class for tracking and querying basic
blocks sizes so we can use them when generating low-overhead loops.

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

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

5 years agoRe-commit r357452 (take 3): "SimplifyCFG SinkCommonCodeFromPredecessors: Also sink...
Hans Wennborg [Mon, 17 Jun 2019 07:47:28 +0000 (07:47 +0000)]
Re-commit r357452 (take 3): "SimplifyCFG SinkCommonCodeFromPredecessors: Also sink function calls without used results (PR41259)"

Third time's the charm.

This was reverted in r363220 due to being suspected of an internal benchmark
regression and a test failure, none of which turned out to be caused by this.

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

5 years ago[SimplifyCFG] Fix prof branch_weights MD while removing unreachable switch cases
Yevgeny Rouban [Mon, 17 Jun 2019 05:55:12 +0000 (05:55 +0000)]
[SimplifyCFG] Fix prof branch_weights MD while removing unreachable switch cases

SimplifyCFG has a bug that results in inconsistent prof branch_weights metadata
if unreachable switch cases are removed. This patch fixes this bug by making use
of the newly introduced SwitchInstProfUpdateWrapper class (see patch D62122).
A new test is created.

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

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

5 years agoPowerPC: Optimize SPE double parameter calling setup
Justin Hibbits [Mon, 17 Jun 2019 03:15:23 +0000 (03:15 +0000)]
PowerPC: Optimize SPE double parameter calling setup

Summary:
SPE passes doubles the same as soft-float, in register pairs as i32
types.  This is all handled by the target-independent layer.  However,
this is not optimal when splitting or reforming the doubles, as it
pushes to the stack and loads from, on either side.

For instance, to pass a double argument to a function, assuming the
double value is in r5, the sequence currently looks like this:

    evstdd      5, X(1)
    lwz         3, X(1)
    lwz         4, X+4(1)

Likewise, to form a double into r5 from args in r3 and r4:

    stw         3, X(1)
    stw         4, X+4(1)
    evldd       5, X(1)

This optimizes the fence to use SPE instructions.  Now, to pass a double
to a function:

    mr          4, 5
    evmergehi   3, 5, 5

And to form a double into r5 from args in r3 and r4:

    evmergelo   5, 3, 4

This is comparable to the way that gcc generates the double splits.

This also fixes a bug with expanding builtins to libcalls, where the
LowerCallTo() code path was generating intermediate illegal type nodes.

Reviewers: nemanjai, hfinkel, joerg

Subscribers: kbarton, jfb, jsji, llvm-commits

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

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

5 years ago[yaml2obj][MachO] Don't fill dummy data for virtual sections
Seiya Nuta [Mon, 17 Jun 2019 02:07:20 +0000 (02:07 +0000)]
[yaml2obj][MachO] Don't fill dummy data for virtual sections

Summary:
Currently, MachOWriter::writeSectionData writes dummy data (0xdeadbeef) to fill section data areas in the file even if the section is a virtual one. Since virtual sections don't occupy any space in the file, writing dummy data could results the  "OS.tell() - fileStart <= Sec.offset" assertion failure.

This patch fixes the bug by simply not writing any dummy data for virtual sections.

Reviewers: beanz, jhenderson, rupprecht, alexshap

Reviewed By: alexshap

Subscribers: compnerd, llvm-commits

Tags: #llvm

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

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

5 years ago[llvm-objcopy] Add elf32-sparc and elf32-sparcel target
Seiya Nuta [Mon, 17 Jun 2019 02:03:45 +0000 (02:03 +0000)]
[llvm-objcopy] Add elf32-sparc and elf32-sparcel target

Summary:
The "sparc"/"sparcel" architectures appears in ArchMap (used by -B option) but not in OutputFormatMap (used by -I/-O option). Add their targets into OutputFormatMap for consistency.

Note that AFAIK there're no targets for 32-bit little-endian SPARC ("elf32-sparcel") in GNU binutils.

Reviewers: espindola, alexshap, rupprecht, jhenderson, compnerd, jakehehrlich

Reviewed By: jhenderson, compnerd, jakehehrlich

Subscribers: jyknight, emaste, arichardson, fedor.sergeev, jakehehrlich, MaskRay, llvm-commits

Tags: #llvm

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

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

5 years ago[X86] Add TB_NO_REVERSE to some folding table entries where the register from uses...
Craig Topper [Sun, 16 Jun 2019 22:33:09 +0000 (22:33 +0000)]
[X86] Add TB_NO_REVERSE to some folding table entries where the register from uses the REX prefix, but the memory form does not.

It would not be safe to unfold the memory form the register form
without checking that we are compiling for 64-bit mode.

This probaby isn't a real functional issue since we are unlikely
to unfold any of these instructions since they don't have any
tied registers, aren't commutable, and don't have any inputs
other than the address.

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

5 years ago[InstSimplify] Fix addo/subo undef folds (PR42209)
Roman Lebedev [Sun, 16 Jun 2019 20:39:45 +0000 (20:39 +0000)]
[InstSimplify] Fix addo/subo undef folds (PR42209)

Fix folds of addo and subo with an undef operand to be:

`@llvm.{u,s}{add,sub}.with.overflow` all fold to `{ undef, false }`,
 as per LLVM undef rules.
Same for commuted variants.

Based on the original version of the patch by @nikic.

Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=42209 | PR42209 ]]

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

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

5 years ago[AsmPrinter] Make EmitLinkage and EmitVisibility public
Nicolai Haehnle [Sun, 16 Jun 2019 18:30:42 +0000 (18:30 +0000)]
[AsmPrinter] Make EmitLinkage and EmitVisibility public

Summary:
This allows target to implement custom emit of global variables if
required. See subsequent patch for a use case.

Change-Id: I9654197e3df24503104a54c41fff06845aed37fe

Reviewers: arsenm, kzhuravl

Subscribers: wdng, llvm-commits

Tags: #llvm

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

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

5 years agoAMDGPU: Prepare for explicit absolute relocations in code generation
Nicolai Haehnle [Sun, 16 Jun 2019 17:43:37 +0000 (17:43 +0000)]
AMDGPU: Prepare for explicit absolute relocations in code generation

Summary:
We will use absolute relocations for LDS symbols.

Change-Id: I9a32795ed0ea835e433a787129cfe3c57ee9a325

Reviewers: arsenm, rampitec

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

Tags: #llvm

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

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

5 years agoAMDGPU: Be explicit about whether the high-word in SI_PC_ADD_REL_OFFSET is 0
Nicolai Haehnle [Sun, 16 Jun 2019 17:32:01 +0000 (17:32 +0000)]
AMDGPU: Be explicit about whether the high-word in SI_PC_ADD_REL_OFFSET is 0

Summary:
Instead of encoding a high-word of 0 using a fake TargetGlobalAddress,
just use a literal target constant. This simplifies some subsequent changes.

The generated assembly is now more explicit about the kind of relocation
that is to be used.

Change-Id: I066835202d23b5941fa7a358eb4b89e9b71ab6f8

Reviewers: arsenm, rampitec

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

Tags: #llvm

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

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

5 years agoAMDGPU/GFX10: Support DLC bit in llvm.amdgcn.s.buffer.load intrinsic
Nicolai Haehnle [Sun, 16 Jun 2019 17:14:12 +0000 (17:14 +0000)]
AMDGPU/GFX10: Support DLC bit in llvm.amdgcn.s.buffer.load intrinsic

Summary: Change-Id: Ie4c971462a7749740938c687144e77441dac2539

Reviewers: rampitec, arsenm

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

Tags: #llvm

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

Change-Id: Iae59523edd75c74918d2118df6571a7b671717a0

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

5 years ago[AMDGPU] gfx10 conditional registers handling
Stanislav Mekhanoshin [Sun, 16 Jun 2019 17:13:09 +0000 (17:13 +0000)]
[AMDGPU] gfx10 conditional registers handling

This is cpp source part of wave32 support, excluding overriden
getRegClass().

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

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

5 years ago[CodeGenPrepare][x86] shift both sides of a vector select when profitable
Sanjay Patel [Sun, 16 Jun 2019 15:29:03 +0000 (15:29 +0000)]
[CodeGenPrepare][x86] shift both sides of a vector select when profitable

This is based on the example/discussion in PR37428:
https://bugs.llvm.org/show_bug.cgi?id=37428

Proper vector shift instructions don't appear until AVX2, so we may generate several
extra instructions within a loop trying to compensate for that. It's difficult to
recover from that shift expansion later than this, so use the existing TLI hook and
splat analysis to enable better codegen.

This extends CGP functionality introduced with:
rL201655

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

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

5 years ago[x86] split 256-bit vector selects if operands are vector concats
Sanjay Patel [Sun, 16 Jun 2019 14:04:49 +0000 (14:04 +0000)]
[x86] split 256-bit vector selects if operands are vector concats

This is similar logic/motivation to the select splitting in D62969.

In D63233, the pattern changes so that we no longer have an extract_subvector of vselect,
but the operands of the select are still being concatenated.

The closest case is represented in either the first or last test diffs here - we have an
extra instruction, but we converted 3-4 ymm instructions into 4-5 xmm instructions.
I think that's the right trade-off for most AVX1 targets.

In the example based on PR37428:
https://bugs.llvm.org/show_bug.cgi?id=37428
...this makes the loop about 30% faster (tested on Haswell by compiling with -mavx).

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

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

5 years ago[X86] CombineShuffleWithExtract - handle cases with different vector extract sources
Simon Pilgrim [Sun, 16 Jun 2019 08:00:41 +0000 (08:00 +0000)]
[X86] CombineShuffleWithExtract - handle cases with different vector extract sources

Insert the shorter vector source into an undef vector of the longer vector source's type.

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

5 years agogn build: Merge r363444
Nico Weber [Sun, 16 Jun 2019 02:24:01 +0000 (02:24 +0000)]
gn build: Merge r363444

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

5 years ago[X86] CombineShuffleWithExtract - assert all src ops types are multiples of rootsize...
Simon Pilgrim [Sat, 15 Jun 2019 19:12:44 +0000 (19:12 +0000)]
[X86] CombineShuffleWithExtract - assert all src ops types are multiples of rootsize. NFCI.

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

5 years ago[X86][AVX] Handle lane-crossing shuffle(extract_subvector(x,c1),extract_subvector...
Simon Pilgrim [Sat, 15 Jun 2019 18:30:43 +0000 (18:30 +0000)]
[X86][AVX] Handle lane-crossing shuffle(extract_subvector(x,c1),extract_subvector(y,c2),m1) shuffles

Pull out the existing (non)lane-crossing fold into a helper lambda and use for lane-crossing unary shuffles as well.

Fixes PR34380

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

5 years ago[X86][AVX] Decode constant bits from insert_subvector(c1, c2, c3)
Simon Pilgrim [Sat, 15 Jun 2019 17:05:24 +0000 (17:05 +0000)]
[X86][AVX] Decode constant bits from insert_subvector(c1, c2, c3)

This mostly happens due to SimplifyDemandedVectorElts reducing a vector to insert_subvector(undef, c1, 0)

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

5 years ago[NFC][MCA][X86] Add one more 'clear super register' pattern - movss/movsd load clears...
Roman Lebedev [Sat, 15 Jun 2019 16:12:13 +0000 (16:12 +0000)]
[NFC][MCA][X86] Add one more 'clear super register' pattern - movss/movsd load clears high XMM bits

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

5 years ago[NFC][MCA][X86] Add baseline test coverage for AMD Barcelona (aka K10, fam10h)
Roman Lebedev [Sat, 15 Jun 2019 16:12:05 +0000 (16:12 +0000)]
[NFC][MCA][X86] Add baseline test coverage for AMD Barcelona (aka K10, fam10h)

Looking into sched model for that CPU ...

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

5 years ago[Clang] Harmonize Split DWARF options with llc
Aaron Puchert [Sat, 15 Jun 2019 15:38:51 +0000 (15:38 +0000)]
[Clang] Harmonize Split DWARF options with llc

Summary:
With Split DWARF the resulting object file (then called skeleton CU)
contains the file name of another ("DWO") file with the debug info.
This can be a problem for remote compilation, as it will contain the
name of the file on the compilation server, not on the client.

To use Split DWARF with remote compilation, one needs to either

* make sure only relative paths are used, and mirror the build directory
  structure of the client on the server,
* inject the desired file name on the client directly.

Since llc already supports the latter solution, we're just copying that
over. We allow setting the actual output filename separately from the
value of the DW_AT_[GNU_]dwo_name attribute in the skeleton CU.

Fixes PR40276.

Reviewers: dblaikie, echristo, tejohnson

Reviewed By: dblaikie

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

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

5 years ago[PowerPC] Set the innermost hot loop to align 32 bytes
Kang Zhang [Sat, 15 Jun 2019 15:10:24 +0000 (15:10 +0000)]
[PowerPC] Set the innermost hot loop to align 32 bytes

Summary:
If the nested loop is an innermost loop, prefer to a 32-byte alignment, so that
we can decrease cache misses and branch-prediction misses. Actual alignment of
 the loop will depend on the hotness check and other logic in alignBlocks.

The old code will only align hot loop to 32 bytes when the LoopSize larger than
16 bytes and smaller than 32 bytes, this patch will align the innermost hot loop
 to 32 bytes not only for the hot loop whose size is 16~32 bytes.

Reviewed By: steven.zhang, jsji

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

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

5 years ago[clang] Add storage for APValue in ConstantExpr
Gauthier Harnisch [Sat, 15 Jun 2019 10:24:47 +0000 (10:24 +0000)]
[clang] Add storage for APValue in ConstantExpr

Summary:
When using ConstantExpr we often need the result of the expression to be kept in the AST. Currently this is done on a by the node that needs the result and has been done multiple times for enumerator, for constexpr variables... . This patch adds to ConstantExpr the ability to store the result of evaluating the expression. no functional changes expected.

Changes:
 - Add trailling object to ConstantExpr that can hold an APValue or an uint64_t. the uint64_t is here because most ConstantExpr yield integral values so there is an optimized layout for integral values.
 - Add basic* serialization support for the trailing result.
 - Move conversion functions from an enum to a fltSemantics from clang::FloatingLiteral to llvm::APFloatBase. this change is to make it usable for serializing APValues.
 - Add basic* Import support for the trailing result.
 - ConstantExpr created in CheckConvertedConstantExpression now stores the result in the ConstantExpr Node.
 - Adapt AST dump to print the result when present.

basic* : None, Indeterminate, Int, Float, FixedPoint, ComplexInt, ComplexFloat,
the result is not yet used anywhere but for -ast-dump.

Reviewers: rsmith, martong, shafik

Reviewed By: rsmith

Subscribers: rnkovacs, hiraditya, dexonsmith, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years ago[BranchProbability] Delete a redundant overflow check
Fangrui Song [Sat, 15 Jun 2019 10:09:59 +0000 (10:09 +0000)]
[BranchProbability] Delete a redundant overflow check

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

5 years ago[SCEV] Use unsigned/signed intersection type in SCEV
Nikita Popov [Sat, 15 Jun 2019 09:15:52 +0000 (09:15 +0000)]
[SCEV] Use unsigned/signed intersection type in SCEV

Based on D59959, this switches SCEV to use unsigned/signed range
intersection based on the sign hint. This will prefer non-wrapping
ranges in the relevant domain. I've left the one intersection in
getRangeForAffineAR() to use the smallest intersection heuristic,
as there doesn't seem to be any obvious preference there.

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

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

5 years ago[SimplifyIndVar] Simplify non-overflowing saturating add/sub
Nikita Popov [Sat, 15 Jun 2019 08:48:52 +0000 (08:48 +0000)]
[SimplifyIndVar] Simplify non-overflowing saturating add/sub

If we can detect that saturating math that depends on an IV cannot
overflow, replace it with simple math. This is similar to the CVP
optimization from D62703, just based on a different underlying
analysis (SCEV vs LVI) that catches different cases.

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

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

5 years ago[RISCV] Regenerate remat.ll and atomic-rmw.ll after D43256
Fangrui Song [Sat, 15 Jun 2019 07:49:14 +0000 (07:49 +0000)]
[RISCV] Regenerate remat.ll and atomic-rmw.ll after D43256

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

5 years ago[RISCV] Simplify RISCVAsmBackend::writeNopData(). NFC
Fangrui Song [Sat, 15 Jun 2019 06:14:15 +0000 (06:14 +0000)]
[RISCV] Simplify RISCVAsmBackend::writeNopData(). NFC

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

5 years ago[objcopy] Error when --preserve-dates is specified with standard streams
Alex Brachet [Sat, 15 Jun 2019 05:32:23 +0000 (05:32 +0000)]
[objcopy] Error when --preserve-dates is specified with standard streams

Summary: llvm-objcopy/strip now error when -p is specified when reading from stdin or writing to stdout

Reviewers: jhenderson, rupprecht, espindola, alexshap

Reviewed By: jhenderson, rupprecht

Subscribers: emaste, arichardson, jakehehrlich, MaskRay, llvm-commits

Tags: #llvm

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

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

5 years agoadding more fmf propagation for selects plus updated tests
Michael Berg [Sat, 15 Jun 2019 04:53:51 +0000 (04:53 +0000)]
adding more fmf propagation for selects plus updated tests

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

5 years agoRevert "adding more fmf propagation for selects plus tests"
Fangrui Song [Sat, 15 Jun 2019 03:51:08 +0000 (03:51 +0000)]
Revert "adding more fmf propagation for selects plus tests"

This reverts rL363474. -debug-only=isel was added to some tests that
don't specify `REQUIRES: asserts`. This causes failures on
-DLLVM_ENABLE_ASSERTIONS=off builds.

I chose to revert instead of fixing the tests because I'm not sure
whether we should add `REQUIRES: asserts` to more tests.

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

5 years ago[InstCombine] Add tests to show missing fold opportunity for "icmp and shift" (nfc).
Huihui Zhang [Sat, 15 Jun 2019 00:33:41 +0000 (00:33 +0000)]
[InstCombine] Add tests to show missing fold opportunity for "icmp and shift" (nfc).

Summary:
For icmp pred (and (sh X, Y), C), 0

  When C is signbit, expect to fold (X << Y) & signbit ==/!= 0 into (X << Y) >=/< 0,
  rather than (X & (signbit >> Y)) != 0.

  When C+1 is power of 2, expect to fold (X << Y) & ~C ==/!= 0 into (X << Y) </>= C+1,
  rather than (X & (~C >> Y)) == 0.

For icmp pred (and X, (sh signbit, Y)), 0

  Expect to fold (X & (signbit l>> Y)) ==/!= 0 into (X << Y) >=/< 0
  Expect to fold (X & (signbit << Y)) ==/!= 0 into (X l>> Y) >=/< 0

  Reviewers: lebedev.ri, efriedma, spatel, craig.topper

  Reviewed By: lebedev.ri

  Subscribers: llvm-commits

  Tags: #llvm

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

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

5 years agoReapply "GlobalISel: Avoid producing Illegal copies in RegBankSelect"
Matt Arsenault [Sat, 15 Jun 2019 00:33:26 +0000 (00:33 +0000)]
Reapply "GlobalISel: Avoid producing Illegal copies in RegBankSelect"

This reapplies r363410, avoiding null dereference if there is no
AltRegBank.

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

5 years agoAdd a map_range function for applying map_iterator to a range.
Richard Smith [Fri, 14 Jun 2019 23:56:40 +0000 (23:56 +0000)]
Add a map_range function for applying map_iterator to a range.

In preparation for use in Clang.

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