]> granicus.if.org Git - llvm/log
llvm
7 years agoDAG: Fix naming crime
Matt Arsenault [Fri, 25 Aug 2017 01:26:13 +0000 (01:26 +0000)]
DAG: Fix naming crime

Because isOperationCustom was only checking for custom
lowering on illegal types, this was behaving inconsistently
with the other isOperation* functions, so that
isOperationLegalOrCustom != (isOperationLegal || isOperationCustom)

Luckily this is only used in one place which already checks the
type legality on its own.

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

7 years ago[sanitizer-coverage] Make sure pc-tables aren't dead stripped
Justin Bogner [Fri, 25 Aug 2017 01:24:54 +0000 (01:24 +0000)]
[sanitizer-coverage] Make sure pc-tables aren't dead stripped

Add a reference to the PC array in llvm.used so that linkers that
aggressively dead strip (like ld64) don't remove it.

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

7 years ago[unittests] Remove reverse iteration tests which use pointer-like keys
Mandeep Singh Grang [Fri, 25 Aug 2017 01:11:28 +0000 (01:11 +0000)]
[unittests] Remove reverse iteration tests which use pointer-like keys

Summary: The expected order of pointer-like keys is hash-function-dependent which in turn depends on the platform/environment. Need to come up with a better way to test reverse iteration of containers with pointer-like keys.

Reviewers: dblaikie, mehdi_amini, efriedma, mgrang

Reviewed By: mgrang

Subscribers: llvm-commits

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

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

7 years ago[x86] Back out one aspect of r311318: don't generically set
Chandler Carruth [Fri, 25 Aug 2017 00:56:05 +0000 (00:56 +0000)]
[x86] Back out one aspect of r311318: don't generically set
FeatureSlowUAMem32.

The idea was to mark things that are slow on widely available processors
as slow in the generic CPU so that the code generated for that CPU would
be fast across those processors. However, for this feature that doesn't
work out very well at all.

The problem here is that you can very easily enable AVX or AVX2 on top
of this generic CPU. For example, this can happen just by using AVX2
intrinsics from Clang within a region of code guarded by a dynamic CPU
feature test. When you do that, the generated code with SlowUAMem32 set
is ... amazingly slower. The problem is that there really aren't very
good alternatives to the unaligned loads, and so our vector codegen
regresses significantly.

The other issue is that there are plenty of AMD CPUs with AVX1 that
don't set FeatureSlowUAMem32 and so we shouldn't just check for AVX2
instead of this special feature. =/

It would be nice to have the target attriute logic be able to
enable/disable more than just one feature at a time and control this in
a more fine grained and useful way, but that doesn't seem easy. Given
that it is only Sandybridge and Ivybridge that set this feature, for now
I'm just backing it out of the generic CPU. That has the additional
advantage of going back to the previous state that people seemed vaguely
happy with.

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

7 years agoFix two (three) more issues with unchecked Error.
Stephen Hines [Fri, 25 Aug 2017 00:48:21 +0000 (00:48 +0000)]
Fix two (three) more issues with unchecked Error.

Summary:
If assertions are disabled, but LLVM_ABI_BREAKING_CHANGES is enabled,
this will cause an issue with an unchecked Success. Switching to
consumeError() is the correct way to bypass the check. This patch also
includes disabling 2 tests that can't work without assertions enabled,
since llvm_unreachable() with NDEBUG won't crash.

Reviewers: llvm-commits, lhames

Reviewed By: lhames

Subscribers: lhames, pirama

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

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

7 years ago[x86] Fix an amazing goof in the handling of sub, or, and xor lowering.
Chandler Carruth [Fri, 25 Aug 2017 00:34:07 +0000 (00:34 +0000)]
[x86] Fix an amazing goof in the handling of sub, or, and xor lowering.

The comment for this code indicated that it should work similar to our
handling of add lowering above: if we see uses of an instruction other
than flag usage and store usage, it tries to avoid the specialized
X86ISD::* nodes that are designed for flag+op modeling and emits an
explicit test.

Problem is, only the add case actually did this. In all the other cases,
the logic was incomplete and inverted. Any time the value was used by
a store, we bailed on the specialized X86ISD node. All of this appears
to have been historical where we had different logic here. =/

Turns out, we have quite a few patterns designed around these nodes. We
should actually form them. I fixed the code to match what we do for add,
and it has quite a positive effect just within some of our test cases.
The only thing close to a regression I see is using:

  notl %r
  testl %r, %r

instead of:

  xorl -1, %r

But we can add a pattern or something to fold that back out. The
improvements seem more than worth this.

I've also worked with Craig to update the comments to no longer be
actively contradicted by the code. =[ Some of this still remains
a mystery to both Craig and myself, but this seems like a large step in
the direction of consistency and slightly more accurate comments.

Many thanks to Craig for help figuring out this nasty stuff.

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

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

7 years ago[DAG] convert vector select-of-constants to logic/math
Sanjay Patel [Thu, 24 Aug 2017 23:24:43 +0000 (23:24 +0000)]
[DAG] convert vector select-of-constants to logic/math

This goes back to a discussion about IR canonicalization. We'd like to preserve and convert
more IR to 'select' than we currently do because that's likely the best choice in IR:
http://lists.llvm.org/pipermail/llvm-dev/2016-September/105335.html
...but that's often not true for codegen, so we need to account for this pattern coming in
to the backend and transform it to better DAG ops.

Steps in this patch:

  1. Add an EVT param to the existing convertSelectOfConstantsToMath() TLI hook to more finely
     enable this transform. Other targets will probably want that anyway to distinguish scalars
     from vectors. We're using that here to exclude AVX512 targets, but it may not be necessary.

  2. Convert a vselect to ext+add. This eliminates a constant load/materialization, and the
     vector ext is often free.

Implementing a more general fold using xor+and can be a follow-up for targets that don't have
a legal vselect. It's also possible that we can remove the TLI hook for the special case fold
implemented here because we're eliminating a constant, but it needs to be tested on other
targets.

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

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

7 years ago[ADT] Enable reverse iteration for DenseMap
Mandeep Singh Grang [Thu, 24 Aug 2017 23:02:48 +0000 (23:02 +0000)]
[ADT] Enable reverse iteration for DenseMap

Reviewers: mehdi_amini, dexonsmith, dblaikie, davide, chandlerc, davidxl, echristo, efriedma

Reviewed By: dblaikie

Subscribers: rsmith, mgorny, emaste, llvm-commits

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

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

7 years ago[Profile] backward propagate profile info in JumpThreading
Xinliang David Li [Thu, 24 Aug 2017 22:54:01 +0000 (22:54 +0000)]
[Profile] backward propagate profile info in JumpThreading

Take-2 after fixing bugs in the original patch.

Differential Revsion: http://reviews.llvm.org/D36864

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

7 years ago[InstCombine] fix and enhance udiv/urem narrowing
Sanjay Patel [Thu, 24 Aug 2017 22:54:01 +0000 (22:54 +0000)]
[InstCombine] fix and enhance udiv/urem narrowing

There are 3 small independent changes here:

  1. Account for multiple uses in the pattern matching: avoid the transform if it increases the instruction count.
  2. Add a missing fold for the case where the numerator is the constant: http://rise4fun.com/Alive/E2p
  3. Enable all folds for vector types.

There's still one more potential change - use "shouldChangeType()" to keep from transforming to an illegal integer type.

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

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

7 years agoMove accurate-sample-profile into the function attribute.
Dehao Chen [Thu, 24 Aug 2017 21:37:04 +0000 (21:37 +0000)]
Move accurate-sample-profile into the function attribute.

Summary: We need to have accurate-sample-profile in function attribute so that it works with LTO.

Reviewers: davidxl, rsmith

Reviewed By: davidxl

Subscribers: sanjoy, mehdi_amini, javed.absar, llvm-commits, eraman

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

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

7 years ago[CodeGen] Fix some Clang-tidy modernize-use-using and Include What You Use warnings...
Eugene Zelenko [Thu, 24 Aug 2017 21:21:39 +0000 (21:21 +0000)]
[CodeGen] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).

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

7 years ago[PartialInlining] Formatting. NFC.
Chad Rosier [Thu, 24 Aug 2017 21:21:09 +0000 (21:21 +0000)]
[PartialInlining] Formatting. NFC.

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

7 years agotest commit: fix typo in comment
Nathan Hawes [Thu, 24 Aug 2017 21:20:41 +0000 (21:20 +0000)]
test commit: fix typo in comment

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

7 years ago[PartialInlining] Type. NFC.
Chad Rosier [Thu, 24 Aug 2017 20:29:02 +0000 (20:29 +0000)]
[PartialInlining] Type. NFC.

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

7 years agoAMDGPU: Fix gfx801 features
Konstantin Zhuravlyov [Thu, 24 Aug 2017 20:03:07 +0000 (20:03 +0000)]
AMDGPU: Fix gfx801 features

gfx801 has 1/2 rate F64, Fast F32 FMA

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

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

7 years ago[WebAssembly] FastISel : Bail to SelectionDAG for constexpr calls
Jacob Gravelle [Thu, 24 Aug 2017 19:53:44 +0000 (19:53 +0000)]
[WebAssembly] FastISel : Bail to SelectionDAG for constexpr calls

Summary: Currently FastISel lowers constexpr calls as indirect calls.
We'd like those to direct calls, and falling back to SelectionDAGISel
handles that.

Reviewers: dschuff, sunfish

Subscribers: jfb, sbc100, llvm-commits, aheejin

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

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

7 years ago[WebAssembly] Update GCC test suite failure expectations
Heejin Ahn [Thu, 24 Aug 2017 19:43:09 +0000 (19:43 +0000)]
[WebAssembly] Update GCC test suite failure expectations

Summary:
Update GCC test suite failure expectations as we add -O0 to the bare tests in
WebAssembly waterfall. There are still several untriaged lld failures.

Reviewers: sbc100, jgravelle-google, dschuff

Reviewed By: dschuff

Subscribers: jfb

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

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

7 years ago[Hexagon] Set access size for vector pseudo loads/stores
Krzysztof Parzyszek [Thu, 24 Aug 2017 19:19:24 +0000 (19:19 +0000)]
[Hexagon] Set access size for vector pseudo loads/stores

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

7 years ago[globalisel][tablegen] Predicates should start from GIPFP_Invalid+1 not GIPFP_Invalid
Daniel Sanders [Thu, 24 Aug 2017 18:54:16 +0000 (18:54 +0000)]
[globalisel][tablegen] Predicates should start from GIPFP_Invalid+1 not GIPFP_Invalid

This fixes a warning when there are zero defined predicates and also fixes an
unnoticed bug where the first predicate in the table was unusable.

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

7 years agoRemove duplicate code
Victor Leschuk [Thu, 24 Aug 2017 17:02:38 +0000 (17:02 +0000)]
Remove duplicate code

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

7 years agoAdd missing break in switch
Victor Leschuk [Thu, 24 Aug 2017 16:57:10 +0000 (16:57 +0000)]
Add missing break in switch

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

7 years ago[ARC] Add ARC backend.
Pete Couperus [Thu, 24 Aug 2017 15:40:33 +0000 (15:40 +0000)]
[ARC] Add ARC backend.

Add the ARC backend as an experimental target to lib/Target.
Reviewed at: https://reviews.llvm.org/D36331

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

7 years ago[X86AsmParser] Refactor AsmRewrite constructors, NFCI
Krasimir Georgiev [Thu, 24 Aug 2017 15:03:18 +0000 (15:03 +0000)]
[X86AsmParser] Refactor AsmRewrite constructors, NFCI

Summary:
This is a follow-up of https://reviews.llvm.org/D37105, where a slight refactoring
of the constructors of AsmRewrite is proposed.

Reviewers: coby

Reviewed By: coby

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

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

7 years agofix typo; NFC
Sanjay Patel [Thu, 24 Aug 2017 15:00:13 +0000 (15:00 +0000)]
fix typo; NFC

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

7 years ago[AArch64] Add FMOVH0: materialize 0 using zero register for f16 values
Sjoerd Meijer [Thu, 24 Aug 2017 14:47:06 +0000 (14:47 +0000)]
[AArch64] Add FMOVH0: materialize 0 using zero register for f16 values

Instead of loading 0 from a constant pool, it's of course much better to
materialize it using an fmov and the zero register.

Thanks to Ahmed Bougacha for the suggestion.

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

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

7 years ago[BypassSlowDivision] move map helper code to header; NFC
Sanjay Patel [Thu, 24 Aug 2017 14:43:33 +0000 (14:43 +0000)]
[BypassSlowDivision] move map helper code to header; NFC

We can reuse this code with other div/rem transforms as shown in:
https://reviews.llvm.org/D31037
https://bugs.llvm.org/show_bug.cgi?id=31028

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

7 years ago[TargetParser][AArch64] Add support for RDM feature in the target parser.
Chad Rosier [Thu, 24 Aug 2017 14:30:44 +0000 (14:30 +0000)]
[TargetParser][AArch64] Add support for RDM feature in the target parser.

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

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

7 years agoAdding base lit test for x86interleaved
Michael Zuckerman [Thu, 24 Aug 2017 14:11:28 +0000 (14:11 +0000)]
Adding base lit test for x86interleaved

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

7 years ago[fixup][rL311639]
Coby Tayree [Thu, 24 Aug 2017 14:10:50 +0000 (14:10 +0000)]
[fixup][rL311639]

rL311639 created X86AsmParser a dependency in X86AsmPrinter, which broke builds
this fix adds the necessary dep

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

7 years ago[X86AsmParser] Fix msan: use-of-uninitialized-value after r311639
Krasimir Georgiev [Thu, 24 Aug 2017 13:38:18 +0000 (13:38 +0000)]
[X86AsmParser] Fix msan: use-of-uninitialized-value after r311639

Summary:
CodeGen/ms-inline-asm.c test triggers msan use-of-uninitialized-value here:
llvm/lib/MC/MCParser/AsmParser.cpp:5629:7

Reviewers: bkramer, coby

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

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

7 years ago[Hexagon] Generate correct runtime check when recognizing memmove
Krzysztof Parzyszek [Thu, 24 Aug 2017 11:59:53 +0000 (11:59 +0000)]
[Hexagon] Generate correct runtime check when recognizing memmove

The check (assuming positive stride) for validity of memmove should be
(a) the destination is at a lower address than the source, or
(b) the distance between the source and destination is greater than or
    equal the number of bytes copied.

For the second part it is sufficient to assume that the destination
is at a higher address, since the opposite case is covered by (a).
The distance calculation was previously done by subtracting the
pointers in the wrong order.

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

7 years ago[ARM, Thumb1] Prevent ARMTargetLowering::isLegalAddressingMode from accepting illegal...
Evgeny Astigeevich [Thu, 24 Aug 2017 10:00:25 +0000 (10:00 +0000)]
[ARM, Thumb1] Prevent ARMTargetLowering::isLegalAddressingMode from accepting illegal modes

ARMTargetLowering::isLegalAddressingMode can accept illegal addressing modes
for the Thumb1 target. This causes generation of redundant code and affects
performance.

This fixes PR34106: https://bugs.llvm.org/show_bug.cgi?id=34106

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

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

7 years agoModel cache size and associativity in TargetTransformInfo
Tobias Grosser [Thu, 24 Aug 2017 09:46:25 +0000 (09:46 +0000)]
Model cache size and associativity in TargetTransformInfo

Summary:
We add the precise cache sizes and associativity for the following Intel
architectures:

  - Penry
  - Nehalem
  - Westmere
  - Sandy Bridge
  - Ivy Bridge
  - Haswell
  - Broadwell
  - Skylake
  - Kabylake

Polly uses since several months a performance model for BLAS computations that
derives optimal cache and register tile sizes from cache and latency
information (based on ideas from "Analytical Modeling Is Enough for High-Performance BLIS", by Tze Meng Low published at TOMS 2016).
While bootstrapping this model, these target values have been kept in Polly.
However, as our implementation is now rather mature, it seems time to teach
LLVM itself about cache sizes.

Interestingly, L1 and L2 cache sizes are pretty constant across
micro-architectures, hence a set of architecture specific default values
seems like a good start. They can be expanded to more target specific values,
in case certain newer architectures require different values. For now a set
of Intel architectures are provided.

Just as a little teaser, for a simple gemm kernel this model allows us to
improve performance from 1.2s to 0.27s. For gemm kernels with less optimal
memory layouts even larger speedups can be reported.

Reviewers: Meinersbur, bollu, singam-sanjay, hfinkel, gareevroman, fhahn, sebpop, efriedma, asb

Reviewed By: fhahn, asb

Subscribers: lsaba, asb, pollydev, llvm-commits

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

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

7 years ago[AArch64] Custom lowering of copysign f16
Sjoerd Meijer [Thu, 24 Aug 2017 09:21:10 +0000 (09:21 +0000)]
[AArch64] Custom lowering of copysign f16

This is a follow up patch of r311154 and introduces custom lowering of copysign
f16 to avoid promotions to single precision types when the subtarget supports
fullfp16.

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

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

7 years agoRe-commit: [globalisel][tablegen] Add support for ImmLeaf without SDNodeXForm
Daniel Sanders [Thu, 24 Aug 2017 09:11:20 +0000 (09:11 +0000)]
Re-commit: [globalisel][tablegen] Add support for ImmLeaf without SDNodeXForm

Summary:
This patch adds support for predicates on imm nodes but only for ImmLeaf and not
for PatLeaf or PatFrag and only where the value does not need to be transformed
before being rendered into the instruction.

The limitation on PatLeaf/PatFrag/SDNodeXForm is due to differences in the
necessary target-supplied C++ for GlobalISel.

Depends on D36085

The previous commit was reverted for breaking the build but this appears to have
been the recurring problem on the Windows bots with tablegen not being re-run
when llvm-tblgen is changed but the .td's aren't. If it re-occurs then forcing a
build with clean=True should fix it but this string should do this in advance:
    Requires a clean build.

Reviewers: ab, t.p.northover, qcolombet, rovka, aditya_nandakumar

Reviewed By: rovka

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

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

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

7 years ago[LLVM][x86][Inline Asm] support for GCC style inline asm - Y<x> constraints
Coby Tayree [Thu, 24 Aug 2017 09:08:33 +0000 (09:08 +0000)]
[LLVM][x86][Inline Asm] support for GCC style inline asm - Y<x> constraints

This patch is intended to enable the use of basic double letter constraints used in GCC extended inline asm {Yi Y2 Yz Y0 Ym Yt}.
Supersedes D35204
Clang counterpart: D36371

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

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

7 years ago[Reassociate] Do not drop debug location if replacement is missing
Mikael Holmen [Thu, 24 Aug 2017 09:05:00 +0000 (09:05 +0000)]
[Reassociate] Do not drop debug location if replacement is missing

Summary:
When reassociating an expression, do not drop the instruction's
original debug location in case the replacement location is
missing.

The debug location must at least not be dropped for inlinable
callsites of debug-info-bearing functions in debug-info-bearing
functions. Failing to do so would result in an "inlinable function "
"call in a function with debug info must have a !dbg location"
error in the verifier.

As preserving the original debug location is not expected
to result in overly jumpy debug line information, it is
preserved for all other cases too.

This fixes PR34231:
https://bugs.llvm.org/show_bug.cgi?id=34231

Original patch by David Stenberg

Reviewers: davide, craig.topper, mcrosier, dblaikie, aprantl

Reviewed By: davide, aprantl

Subscribers: aprantl

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

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

7 years ago[X86AsmParser] Refactoring, (almost) NFC.
Coby Tayree [Thu, 24 Aug 2017 08:46:25 +0000 (08:46 +0000)]
[X86AsmParser] Refactoring, (almost) NFC.

Some refactoring to X86AsmParser, mostly regarding the way rewrites are conducted.
Mainly, we try to concentrate all the rewrite effort under one hood, so it'll hopefully be less of a mess and easier to maintain and understand.
naturally, some frontend tests were affected: D36794

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

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

7 years agoIPRA: Don't assume called function is first call operand
Matt Arsenault [Thu, 24 Aug 2017 07:55:15 +0000 (07:55 +0000)]
IPRA: Don't assume called function is first call operand

Fixes not finding the called global for AMDGPU
call pseudoinstructions, which prevented IPRA
from doing much.

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

7 years agoIPRA: Exit early on functions without calls
Matt Arsenault [Thu, 24 Aug 2017 07:55:13 +0000 (07:55 +0000)]
IPRA: Exit early on functions without calls

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

7 years ago[AArch64] fix for fcos and frem f16 promotion
Sjoerd Meijer [Thu, 24 Aug 2017 07:43:52 +0000 (07:43 +0000)]
[AArch64] fix for fcos and frem f16 promotion

Fix for copy-paste mistake in r311154; setOperationAction for fcos and frem f16
operands appeared twice (and it should be set to 'promote').

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

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

7 years ago[x86] NFC: Clean up two tests and generate precise checks for them.
Chandler Carruth [Thu, 24 Aug 2017 07:38:36 +0000 (07:38 +0000)]
[x86] NFC: Clean up two tests and generate precise checks for them.

Mostly this involved giving unnamed values names and running the IR
through `opt` to re-format it but merging in any important comments in
the original. I then deleted pointless comments and inlined the function
attributes for ease of reading and editting.

All of this is to make it much easier to see the instructions being
generated here and evaluate any updates to the tests.

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

7 years ago[GlobalISel][X86] Support G_IMPLICIT_DEF.
Igor Breger [Thu, 24 Aug 2017 07:06:27 +0000 (07:06 +0000)]
[GlobalISel][X86] Support G_IMPLICIT_DEF.

Summary: Support G_IMPLICIT_DEF.

Reviewers: zvi, guyblank, t.p.northover

Reviewed By: guyblank

Subscribers: rovka, llvm-commits, kristof.beyls

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

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

7 years ago[docs] In the CMake primer, correct the description of the ARGV/ARGN variables.
Lang Hames [Thu, 24 Aug 2017 05:38:39 +0000 (05:38 +0000)]
[docs] In the CMake primer, correct the description of the ARGV/ARGN variables.

ARGN is the sublist of unnamed arguments, not the count of the arguments.

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

7 years ago[Support] Rewrite handleAllErrors in terms of cantFail.
Lang Hames [Thu, 24 Aug 2017 05:35:27 +0000 (05:35 +0000)]
[Support] Rewrite handleAllErrors in terms of cantFail.

This just switches handleAllErrors from using custom assertions that all errors
have been handled to using cantFail. This change involves moving some of the
class and function definitions around though.

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

7 years agoAdd ‘llvm.experimental.constrained.fma‘ Intrinsic.
Wei Ding [Thu, 24 Aug 2017 04:18:24 +0000 (04:18 +0000)]
Add â€˜llvm.experimental.constrained.fma‘ Intrinsic.

Differential Revision: http://reviews.llvm.org/D36335

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

7 years agoSupport all integer types in DiagnosticInfoOptimizationBase::Argument
Adam Nemet [Thu, 24 Aug 2017 04:04:49 +0000 (04:04 +0000)]
Support all integer types in  DiagnosticInfoOptimizationBase::Argument

We were missing size_t (unsigned long) on macOS.

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

7 years agoNewGVN: We weren't properly simplifying selects with equal arguments due to a thinko.
Daniel Berlin [Thu, 24 Aug 2017 02:43:17 +0000 (02:43 +0000)]
NewGVN: We weren't properly simplifying selects with equal arguments due to a thinko.

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

7 years agoFix bug 34051 by handling empty .res files gracefully.
Eric Beckmann [Thu, 24 Aug 2017 02:36:50 +0000 (02:36 +0000)]
Fix bug 34051 by handling empty .res files gracefully.

Summary:
Previously, llvm-cvtres crashes on .res files which are empty except for
the null header.  This allows the library to simply pass over them.

Subscribers: llvm-commits, hiraditya

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

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

7 years ago[DAG] Fix Node Replacement in PromoteIntBinOp
Hans Wennborg [Thu, 24 Aug 2017 01:08:27 +0000 (01:08 +0000)]
[DAG] Fix Node Replacement in PromoteIntBinOp

When one operand is a user of another in a promoted binary operation
we may replace and delete the returned value before returning
triggering an assertion. Reorder node replacements to prevent this.

Fixes PR34137.

Landing on behalf of Nirav.

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

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

7 years ago[AVR] Use the correct register classes for 16-bit atomic operations
Dylan McKay [Thu, 24 Aug 2017 00:14:38 +0000 (00:14 +0000)]
[AVR] Use the correct register classes for 16-bit atomic operations

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

7 years agoAdd test to cover accurate-sample-profile.
Dehao Chen [Wed, 23 Aug 2017 23:19:11 +0000 (23:19 +0000)]
Add test to cover accurate-sample-profile.

Summary: This patch adds test to cover the logic guarded by "accurate-sample-profile" flag.

Reviewers: davidxl

Reviewed By: davidxl

Subscribers: sanjoy, llvm-commits, eraman

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

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

7 years agoARM: use internal relocations for local symbols after all.
Tim Northover [Wed, 23 Aug 2017 22:07:10 +0000 (22:07 +0000)]
ARM: use internal relocations for local symbols after all.

Switching to external relocations for ARM-mode branches (to allow Thumb
interworking when the offset is unencodable) causes calls to temporary symbols
to be miscompiled and instead go to the parent externally visible symbol.

Calling a temporary never happens in compiled code, but can occasionally in
hand-written assembly.

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

7 years agoRetire the llvm.dbg.mir hack after r311594.
Adrian Prantl [Wed, 23 Aug 2017 22:02:36 +0000 (22:02 +0000)]
Retire the llvm.dbg.mir hack after r311594.

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

7 years agoFix Verifier test - add REQUIRES aarch64-registered-target
Aditya Nandakumar [Wed, 23 Aug 2017 21:55:36 +0000 (21:55 +0000)]
Fix Verifier test - add REQUIRES aarch64-registered-target

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

7 years agoAdd a Verifier check for DILocation's scopes.
Adrian Prantl [Wed, 23 Aug 2017 21:52:24 +0000 (21:52 +0000)]
Add a Verifier check for DILocation's scopes.

Found via https://bugs.llvm.org/show_bug.cgi?id=33997.

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

7 years ago[WebAssembly] Fix overflow for input with missing version
Jonas Devlieghere [Wed, 23 Aug 2017 21:36:04 +0000 (21:36 +0000)]
[WebAssembly] Fix overflow for input with missing version

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

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

7 years ago[PGO] Set edge weights for indirectbr instruction with profile counts
Rong Xu [Wed, 23 Aug 2017 21:36:02 +0000 (21:36 +0000)]
[PGO] Set edge weights for indirectbr instruction with profile counts

Current PGO only annotates the edge weight for branch and switch instructions
with profile counts. We should also annotate the indirectbr instruction as
all the information is there. This patch enables the annotating for indirectbr
instructions. Also uses this annotation in branch probability analysis.

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

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

7 years ago[AArch64][Falkor] Fix bug in Falkor HWPF tag collision avoidance
Geoff Berry [Wed, 23 Aug 2017 21:11:28 +0000 (21:11 +0000)]
[AArch64][Falkor] Fix bug in Falkor HWPF tag collision avoidance

LDPDi was incorrectly marked as ignoring the destination register in the
prefetcher tag.

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

7 years agoTest commit.
Pete Couperus [Wed, 23 Aug 2017 20:58:22 +0000 (20:58 +0000)]
Test commit.

Fix instrinsic -> intrinsic typo.

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

7 years ago[GISEl]: Translate phi into G_PHI
Aditya Nandakumar [Wed, 23 Aug 2017 20:45:48 +0000 (20:45 +0000)]
[GISEl]: Translate phi into G_PHI

G_PHI has the same semantics as PHI but also has types.
This lets us verify that the types in the G_PHI are consistent.
This also allows specifying legalization actions for G_PHIs.

https://reviews.llvm.org/D36990

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

7 years agoAttempt to fix the BUILD_SHARED_LIBS build after the DIExpression change
Reid Kleckner [Wed, 23 Aug 2017 20:39:35 +0000 (20:39 +0000)]
Attempt to fix the BUILD_SHARED_LIBS build after the DIExpression change

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

7 years agoParse and print DIExpressions inline to ease IR and MIR testing
Reid Kleckner [Wed, 23 Aug 2017 20:31:27 +0000 (20:31 +0000)]
Parse and print DIExpressions inline to ease IR and MIR testing

Summary:
Most DIExpressions are empty or very simple. When they are complex, they
tend to be unique, so checking them inline is reasonable.

This also avoids the need for CodeGen passes to append to the
llvm.dbg.mir named md node.

See also PR22780, for making DIExpression not be an MDNode.

Reviewers: aprantl, dexonsmith, dblaikie

Subscribers: qcolombet, javed.absar, eraman, hiraditya, llvm-commits

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

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

7 years agoUpdate branch coalescing to be a PowerPC specific pass
Lei Huang [Wed, 23 Aug 2017 19:25:04 +0000 (19:25 +0000)]
Update branch coalescing to be a PowerPC specific pass

Implementing this pass as a PowerPC specific pass.  Branch coalescing utilizes
the analyzeBranch method which currently does not include any implicit operands.
This is not an issue on PPC but must be handled on other targets.

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

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

7 years agoUpdated my email address.
Greg Clayton [Wed, 23 Aug 2017 18:00:07 +0000 (18:00 +0000)]
Updated my email address.

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

7 years ago[X86] Fix -Wenum-compare warning
Benjamin Kramer [Wed, 23 Aug 2017 17:50:46 +0000 (17:50 +0000)]
[X86] Fix -Wenum-compare warning

lib/Target/X86/X86ISelLowering.cpp:34613:25: error: enumeral mismatch in
conditional expression: 'llvm::ISD::NodeType' vs
'llvm::X86ISD::NodeType'

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

7 years ago[AVX512] Don't create SHRUNKBLEND SDNodes for 512-bit vectors
Craig Topper [Wed, 23 Aug 2017 16:41:02 +0000 (16:41 +0000)]
[AVX512] Don't create SHRUNKBLEND SDNodes for 512-bit vectors

There are no 512-bit blend instructions so we shouldn't create SHRUNKBLEND for them.

On a side note, it looks like there may be a missed opportunity for constant folding TESTM when LHS and RHS are equal.

This fixes PR34139.

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

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

7 years ago[X86] Remove X86ISD::FMADD in favor ISD::FMA
Craig Topper [Wed, 23 Aug 2017 16:28:04 +0000 (16:28 +0000)]
[X86] Remove X86ISD::FMADD in favor ISD::FMA

There's no reason to have a target specific node with the same semantics as a target independent opcode.

This should simplify D36335 so that it doesn't need to touch X86ISelDAGToDAG.cpp

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

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

7 years agobpf: close the file descriptor after probe inside getHostCPUNameForBPF
Yonghong Song [Wed, 23 Aug 2017 16:24:31 +0000 (16:24 +0000)]
bpf: close the file descriptor after probe inside getHostCPUNameForBPF

Signed-off-by: Yonghong Song <yhs@fb.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311567 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoLowerAtomic: Don't skip optnone functions; atomic still need lowering (PR34020)
Hans Wennborg [Wed, 23 Aug 2017 15:43:28 +0000 (15:43 +0000)]
LowerAtomic: Don't skip optnone functions; atomic still need lowering (PR34020)

The lowering isn't really an optimization, so optnone shouldn't make a
difference. ARM relies on the pass running when using "-mthread-model
single", because in that mode, it doesn't run AtomicExpand. See bug for
more details.

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

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

7 years agoFixed invalid variable name in Dockerfile scripts.
Ilya Biryukov [Wed, 23 Aug 2017 15:36:44 +0000 (15:36 +0000)]
Fixed invalid variable name in Dockerfile scripts.

LLVM_SVN_REVISION was used instead of LLVM_SVN_REV.
This caused a revision option to be ignored in Dockerfiles.

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

7 years agoRevert r311546 as it breaks build
Victor Leschuk [Wed, 23 Aug 2017 15:21:10 +0000 (15:21 +0000)]
Revert r311546 as it breaks build

http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/4394

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

7 years agoMake lit :: shtest-format.py supported on Windows again
Victor Leschuk [Wed, 23 Aug 2017 14:59:09 +0000 (14:59 +0000)]
Make lit :: shtest-format.py supported on Windows again

It was marked as unsupported on Windows in r311230 because on some Win10
machines it failed or caused hang. The problem was that on these machines
system bash (C:\Windows\System32\bash.exe) was used which requires paths to be
passed like '/mnt/c/path/to/my/script' instead of 'C:\path\to\my\script'.

TODO: we should make lit detect if system bash is used instead of msys and set
appropriate path format.

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

7 years agoRevert r311552: [Bash-autocompletion] Add support for static analyzer flags
Rui Ueyama [Wed, 23 Aug 2017 14:48:58 +0000 (14:48 +0000)]
Revert r311552: [Bash-autocompletion] Add support for static analyzer flags

This reverts commit r311552 because it broke ubsan and asan bots.

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

7 years ago[coroutines] CoroBegin from inner coroutines should be considered for spills
Gor Nishanov [Wed, 23 Aug 2017 14:47:52 +0000 (14:47 +0000)]
[coroutines] CoroBegin from inner coroutines should be considered for spills

Summary:
If a coroutine outer calls another coroutine inner and the inner coroutine body is inlined into the outer, coro.begin from the inner coroutine should be considered for spilling if accessed across suspends.

Prior to this change, coroutine frame building code was not considering any coro.begins for spilling.
With this change, we only ignore coro.begin for the current coroutine, but, any coro.begins that were inlined into the current coroutine are eligible for spills.

Fixes PR34267

Reviewers: GorNishanov

Subscribers: qcolombet, llvm-commits, EricWF

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

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

7 years ago[Reassociate] Don't canonicalize x + (-Constant * y) -> x - (Constant * y)..
Chad Rosier [Wed, 23 Aug 2017 14:10:06 +0000 (14:10 +0000)]
[Reassociate] Don't canonicalize x + (-Constant * y) -> x - (Constant * y)..

..if the resulting subtract will be broken up later.  This can cause us to get
into an infinite loop.

x + (-5.0 * y)      -> x - (5.0 * y)       ; Canonicalize neg const
x - (5.0 * y)       -> x + (0 - (5.0 * y)) ; Break up subtract
x + (0 - (5.0 * y)) -> x + (-5.0 * y)      ; Replace 0-X with X*-1.

PR34078

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

7 years ago[Bash-autocompletion] Add support for static analyzer flags
Yuka Takahashi [Wed, 23 Aug 2017 13:39:47 +0000 (13:39 +0000)]
[Bash-autocompletion] Add support for static analyzer flags

Summary:
This is a patch for clang autocomplete feature.

It will collect values which -analyzer-checker takes, which is defined in
clang/StaticAnalyzer/Checkers/Checkers.inc, dynamically.
First, from ValuesCode class in Options.td, TableGen will generate C++
code in Options.inc. Options.inc will be included in DriverOptions.cpp, and
calls OptTable's addValues function. addValues function will add second
argument to Option's Values class. Values contains string like "foo,bar,.."
which is handed to Values class
in OptTable.

Reviewers: v.g.vassilev, teemperor, ruiu

Subscribers: hiraditya, cfe-commits

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

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

7 years ago[globalisel][tablegen] Add support for ImmLeaf without SDNodeXForm
Daniel Sanders [Wed, 23 Aug 2017 12:14:18 +0000 (12:14 +0000)]
[globalisel][tablegen] Add support for ImmLeaf without SDNodeXForm

Summary:
This patch adds support for predicates on imm nodes but only for ImmLeaf and not for PatLeaf or PatFrag and only where the value does not need to be transformed before being rendered into the instruction.

The limitation on PatLeaf/PatFrag/SDNodeXForm is due to differences in the necessary target-supplied C++ for GlobalISel.

Depends on D36085

Reviewers: ab, t.p.northover, qcolombet, rovka, aditya_nandakumar

Reviewed By: rovka

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

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

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

7 years ago[ARM] Check for assembler instructions in test.
Florian Hahn [Wed, 23 Aug 2017 11:53:24 +0000 (11:53 +0000)]
[ARM] Check for assembler instructions in test.

Currently this test causes test failures on some machines, due to isel not being registered. Update the test to run all passes and check emitted assembly instructions for now.

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

7 years ago[ARM] Add missing patterns for insert_subvector.
Florian Hahn [Wed, 23 Aug 2017 10:20:59 +0000 (10:20 +0000)]
[ARM] Add missing patterns for insert_subvector.

Summary: In some cases, shufflevector instruction can be transformed involving insert_subvector instructions. The ARM backend was missing some insert_subvector patterns, causing a failure during instruction selection. AArch64 has similar patterns.

Reviewers: t.p.northover, olista01, javed.absar, rengolin

Reviewed By: javed.absar

Subscribers: aemerson, kristof.beyls, llvm-commits

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

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

7 years ago[globalisel][tablegen] Add tests for FeatureBitsets and ComplexPattern predicates.
Daniel Sanders [Wed, 23 Aug 2017 10:09:25 +0000 (10:09 +0000)]
[globalisel][tablegen] Add tests for FeatureBitsets and ComplexPattern predicates.

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

7 years ago[gold] Test we don't strip globals when producing relocatables.
Davide Italiano [Wed, 23 Aug 2017 09:43:41 +0000 (09:43 +0000)]
[gold] Test we don't strip globals when producing relocatables.

lld was broken in this regard (PR33097). The gold plugin gets this
right so, no changes needed, but better adding a test.

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

7 years ago[InstCombine] Fold branches with irrelevant conditions to a constant.
Davide Italiano [Wed, 23 Aug 2017 09:14:37 +0000 (09:14 +0000)]
[InstCombine] Fold branches with irrelevant conditions to a constant.

InstCombine folds instructions with irrelevant conditions to undef.
This, as Nuno confirmed is a bug.
(see https://bugs.llvm.org/show_bug.cgi?id=33409#c1 )

Given the original motivation for the change is that of removing an
USE, we now fold to false instead (which reaches the same goal
without undesired side effects).

Fixes PR33409.

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

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

7 years ago[PowerPC] better instruction selection for OR (XOR) with a 32-bit immediate
Hiroshi Inoue [Wed, 23 Aug 2017 08:55:18 +0000 (08:55 +0000)]
[PowerPC] better instruction selection for OR (XOR) with a 32-bit immediate

- recommitting after fixing a test failure on MacOS

On PPC64, OR (XOR) with a 32-bit immediate can be done with only two instructions, i.e. ori + oris.
But the current LLVM generates three or four instructions for this purpose (and also it clobbers one GPR).

This patch makes PPC backend generate ori + oris (xori + xoris) for OR (XOR) with a 32-bit immediate.

e.g. (x | 0xFFFFFFFF) should be

ori 3, 3, 65535
oris 3, 3, 65535

but LLVM generates without this patch

li 4, 0
oris 4, 4, 65535
ori 4, 4, 65535
or 3, 3, 4

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

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

7 years ago[AArch64] Silence unused variable warning in opt mode after r311533
Krasimir Georgiev [Wed, 23 Aug 2017 08:40:22 +0000 (08:40 +0000)]
[AArch64] Silence unused variable warning in opt mode after r311533

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

7 years ago[AArch64] ISel legalization debug messages. NFCI.
Sjoerd Meijer [Wed, 23 Aug 2017 08:18:37 +0000 (08:18 +0000)]
[AArch64] ISel legalization debug messages. NFCI.

Debugging AArch64 instruction legalization and custom lowering is really an
unpleasant experience because it shows nodes that appear out of thin air.
In commit r311444, some debug messages have been added to SelectionDAG, the
target independent part, and this patch adds some AArch64 specific messages.

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

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

7 years ago[Lanai] Remove dead functions from LanaiRegisterInfo
Alex Bradbury [Wed, 23 Aug 2017 07:14:48 +0000 (07:14 +0000)]
[Lanai] Remove dead functions from LanaiRegisterInfo

getEHExceptionRegister and getEHHandlerRegister are unused and were removed
from most backends in rL192099. This patch removes them from Lanai.

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

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

7 years agoRevert rL311526: [PowerPC] better instruction selection for OR (XOR) with a 32-bit...
Hiroshi Inoue [Wed, 23 Aug 2017 06:38:05 +0000 (06:38 +0000)]
Revert rL311526: [PowerPC] better instruction selection for OR (XOR) with a 32-bit immediate

This reverts commit rL311526 due to failures in some buildbot.

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

7 years ago[InstCombine] Remove unused argument. NFC
Craig Topper [Wed, 23 Aug 2017 05:46:09 +0000 (05:46 +0000)]
[InstCombine] Remove unused argument. NFC

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

7 years ago[InstCombine] Replace a simple matcher with a plain old dyn_cast. NFC
Craig Topper [Wed, 23 Aug 2017 05:46:08 +0000 (05:46 +0000)]
[InstCombine] Replace a simple matcher with a plain old dyn_cast. NFC

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

7 years ago[InstCombine] Remove an unnecessary dyn_cast to Instruction and a switch over two...
Craig Topper [Wed, 23 Aug 2017 05:46:07 +0000 (05:46 +0000)]
[InstCombine] Remove an unnecessary dyn_cast to Instruction and a switch over two opcodes. Just dyn_cast to the specific instruction classes individually. NFC

Change the helper methods to take the more specific class as well.

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

7 years ago[PowerPC] better instruction selection for OR (XOR) with a 32-bit immediate
Hiroshi Inoue [Wed, 23 Aug 2017 05:15:15 +0000 (05:15 +0000)]
[PowerPC] better instruction selection for OR (XOR) with a 32-bit immediate

On PPC64, OR (XOR) with a 32-bit immediate can be done with only two instructions, i.e. ori + oris.
But the current LLVM generates three or four instructions for this purpose (and also it clobbers one GPR).

This patch makes PPC backend generate ori + oris (xori + xoris) for OR (XOR) with a 32-bit immediate.

e.g. (x | 0xFFFFFFFF) should be

ori 3, 3, 65535
oris 3, 3, 65535

but LLVM generates without this patch

li 4, 0
oris 4, 4, 65535
ori 4, 4, 65535
or 3, 3, 4

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

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

7 years ago[XRay][CodeGen] Use PIC-friendly code in XRay sleds; remove synthetic references...
Dean Michael Berris [Wed, 23 Aug 2017 04:49:41 +0000 (04:49 +0000)]
[XRay][CodeGen] Use PIC-friendly code in XRay sleds; remove synthetic references in .text

Summary:
This change achieves two things:

  - Redefine the Custom Event handling instrumentation points emitted by
    the compiler to not require dynamic relocation of references to the
    __xray_CustomEvent trampoline.

  - Remove the synthetic reference we emit at the end of a function that
    we used to keep auxiliary sections alive in favour of SHF_LINK_ORDER
    associated with the section where the function is defined.

To achieve the custom event handling change, we've had to introduce the
concept of sled versioning -- this will need to be supported by the
runtime to allow us to understand how to turn on/off the new version of
the custom event handling sleds. That change has to land first before we
change the way we write the sleds.

To remove the synthetic reference, we rely on a relatively new linker
feature that preserves the sections that are associated with each other.
This allows us to limit the effects on the .text section of ELF
binaries.

Because we're still using absolute references that are resolved at
runtime for the instrumentation map (and function index) maps, we mark
these sections write-able. In the future we can re-define the entries in
the map to use relative relocations instead that can be statically
determined by the linker. That change will be a bit more invasive so we
defer this for later.

Depends on D36816.

Reviewers: dblaikie, echristo, pcc

Subscribers: llvm-commits

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

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

7 years agobpf: add variants of -mcpu=# and support for additional jmp insns
Yonghong Song [Wed, 23 Aug 2017 04:25:57 +0000 (04:25 +0000)]
bpf: add variants of -mcpu=# and support for additional jmp insns

-mcpu=# will support:
  . generic: the default insn set
  . v1: insn set version 1, the same as generic
  . v2: insn set version 2, version 1 + additional jmp insns
  . probe: the compiler will probe the underlying kernel to
           decide proper version of insn set.

We did not not use -mcpu=native since llc/llvm will interpret -mcpu=native
as the underlying hardware architecture regardless of -march value.

Currently, only x86_64 supports -mcpu=probe. Other architecture will
silently revert to "generic".

Also added -mcpu=help to print available cpu parameters.
llvm will print out the information only if there are at least one
cpu and at least one feature. Add an unused dummy feature to
enable the printout.

Examples for usage:
$ llc -march=bpf -mcpu=v1 -filetype=asm t.ll
$ llc -march=bpf -mcpu=v2 -filetype=asm t.ll
$ llc -march=bpf -mcpu=generic -filetype=asm t.ll
$ llc -march=bpf -mcpu=probe -filetype=asm t.ll
$ llc -march=bpf -mcpu=v3 -filetype=asm t.ll
'v3' is not a recognized processor for this target (ignoring processor)
...
$ llc -march=bpf -mcpu=help -filetype=asm t.ll
Available CPUs for this target:

  generic - Select the generic processor.
  probe   - Select the probe processor.
  v1      - Select the v1 processor.
  v2      - Select the v2 processor.

Available features for this target:

  dummy - unused feature.

Use +feature to enable a feature, or -feature to disable it.
For example, llc -mcpu=mycpu -mattr=+feature1,-feature2
...

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Yonghong Song <yhs@fb.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311522 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix tail-merge-after-mbp test
Matthias Braun [Wed, 23 Aug 2017 03:49:53 +0000 (03:49 +0000)]
Fix tail-merge-after-mbp test

The output of this test changed after the fix in r311520 to have
-run-pass=block-placement behave like it does in a normal pipeline.
Adjust the test.

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

7 years agoAdd test case for r311511
Matthias Braun [Wed, 23 Aug 2017 03:17:59 +0000 (03:17 +0000)]
Add test case for r311511

This also changes the TailDuplicator to be configured explicitely
pre/post regalloc rather than relying on the isSSA() flag. This was
necessary to have `llc -run-pass` work reliably.

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

7 years agoNFC: fix ToolDrivers syntax and typo errors
Martell Malone [Wed, 23 Aug 2017 02:10:28 +0000 (02:10 +0000)]
NFC: fix ToolDrivers syntax and typo errors

infoTable -> InfoTable camelCase
Libtool Options #define offset

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

7 years agoUpdate LLVM fuzzers to use the libFuzzer bundled with the compiler toolchain
George Karpenkov [Wed, 23 Aug 2017 00:40:58 +0000 (00:40 +0000)]
Update LLVM fuzzers to use the libFuzzer bundled with the compiler toolchain

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

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

7 years agoRemove llvm-pdbutil/fuzzer.
George Karpenkov [Wed, 23 Aug 2017 00:02:10 +0000 (00:02 +0000)]
Remove llvm-pdbutil/fuzzer.

The code does not compile, is not maintained, and does not have a buildbot.

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

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