Commit Graph

170606 Commits

Author SHA1 Message Date
Sanjay Patel 2ef4e14af3 [DAGCombiner] allow undef elts in vector fmul matching
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344534 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 16:54:07 +00:00
Sanjay Patel 9e0d834cc5 [DAGCombiner] refactor folds for fadd (fmul X, -2.0), Y; NFCI
The transform doesn't work if the vector constant has undef elements.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344532 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 16:47:01 +00:00
Sanjay Patel 772e632e25 [AArch64] add tests for fmul x, -2.0 with undef elts; NFC
Also, add tests with commuted operands. There was no coverage for that case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344531 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 16:44:00 +00:00
Sanjay Patel 907565571c [DAGCombiner] allow undef elts in vector fma matching
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344528 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 15:56:39 +00:00
Sanjay Patel 0ea7fc0dde [x86] add tests for fma with undef elts; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344527 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 15:47:37 +00:00
Sanjay Patel fb06745cac [DAGCombiner] allow undef elts in vector fma matching
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344525 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 15:38:38 +00:00
Fedor Sergeev dea3b338ac Revert "[NewPM] teach -passes= to emit meaningful error messages"
This reverts r344519 due to failures in pipeline-parsing test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344524 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 15:36:08 +00:00
Sanjay Patel 8559689cb2 [x86] add tests for fma with undef elts; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344523 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 15:28:44 +00:00
Lang Hames cb8b3a2740 [ADT] Adds equality operators for DenseMap and DenseSet, and an initializer_list
constructor for DenseMap (DenseSet already had an initializer_list constructor).

These changes make it easier to migrate existing code that uses std::map and
std::set (which support initializer_list construction and equality comparison)
to DenseMap and DenseSet.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344522 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 15:26:47 +00:00
Fedor Sergeev bce0a9abff [NewPM] teach -passes= to emit meaningful error messages
Summary:
All the PassBuilder::parse interfaces now return descriptive StringError
instead of a plain bool. It allows to make -passes/aa-pipeline parsing
errors context-specific and thus less confusing.

TODO: ideally we should also make suggestions for misspelled pass names,
but that requires some extensions to PassBuilder.

Reviewed By: philip.pfaffe, chandlerc
Differential Revision: https://reviews.llvm.org/D53246

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344519 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 15:00:18 +00:00
Aleksandar Beserminji c2c7e976de [mips][micromips] Fix overlaping FDEs error
When compiling static executable for micromips, CFI symbols
are incorrectly labeled as MICROMIPS, which cause
".eh_frame_hdr refers to overlapping FDEs." error.

This patch does not label CFI symbols as MICROMIPS, and FDEs do not
overlap anymore. This patch also exposes another bug, which is fixed
here: https://reviews.llvm.org/D52985

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344516 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 14:39:12 +00:00
Aleksandar Beserminji 1f57e3857a [mips][micromips] Revert "Fix overlaping FDEs error"
This reverts r344511.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344515 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 14:36:48 +00:00
Simon Pilgrim 7f770f7d21 [ARM][NEON] Improve vector popcnt lowering with PADDL (PR39281)
As I suggested on PR39281, this patch uses PADDL pairwise addition to widen from the vXi8 CTPOP result to the target vector type.

This is a blocker for moving more x86 code to generic vector CTPOP expansion (P32655 + D53258) - ARM's vXi64 CTPOP currently expands, which would generate a vXi64 MUL but ARM's custom lowering expands the general MUL case and vectors aren't well handled in LegalizeDAG - improving the CTPOP lowering was a lot easier than fixing the MUL lowering for this one case......

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344512 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 13:20:41 +00:00
Aleksandar Beserminji ee084ebe8c [mips][micromips] Fix overlaping FDEs error
When compiling static executable for micromips, CFI symbols
are incorrectly labeled as MICROMIPS, which cause
".eh_frame_hdr refers to overlapping FDEs." error.

This patch does not label CFI symbols as MICROMIPS, and FDEs do not
overlap anymore. This patch also exposes another bug, which is fixed
here: https://reviews.llvm.org/D52985

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344511 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 12:59:17 +00:00
Nicolai Haehnle 69b3f302bf AMDGPU: Test showing a scalar buffer load deficiency
Change-Id: I5b64a565f22a8482aa0712488d85e45163ac3d12

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344506 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 11:37:04 +00:00
Fedor Sergeev 4b284c14ec [NewPM] implement SCC printing for -print-before-all/-print-after-all
Removing deficiency of initial implementation of -print-before-all/-after-all
- it was effectively skipping IR printing for all the SCC passes.

Now LazyCallGraph:SCC gets its IR printed.

Reviewed By: skatkov
Differential Revision: https://reviews.llvm.org/D53270

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344505 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 10:46:35 +00:00
Chandler Carruth d8d8371469 [TI removal] Make getTerminator() return a generic Instruction.
This removes the primary remaining API producing `TerminatorInst` which
will reduce the rate at which code is introduced trying to use it and
generally make it much easier to remove the remaining APIs across the
codebase.

Also clean up some of the stragglers that the previous mechanical update
of variables missed.

Users of LLVM and out-of-tree code generally will need to update any
explicit variable types to handle this. Replacing `TerminatorInst` with
`Instruction` (or `auto`) almost always works. Most of these edits were
made in prior commits using the perl one-liner:
```
perl -i -ple 's/TerminatorInst(\b.* = .*getTerminator\(\))/Instruction\1/g'
```

This also my break some rare use cases where people overload for both
`Instruction` and `TerminatorInst`, but these should be easily fixed by
removing the `TerminatorInst` overload.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344504 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 10:42:50 +00:00
Chandler Carruth 2b7e80d846 [TI removal] Rework InstVisitor to support visiting instructions that
are terminators without relying on the specific `TerminatorInst` type.

This required cleaning up two users of `InstVisitor`s usage of
`TerminatorInst` as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344503 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 10:10:54 +00:00
Chandler Carruth 2aaf7228e0 [TI removal] Make variables declared as TerminatorInst and initialized
by `getTerminator()` calls instead be declared as `Instruction`.

This is the biggest remaining chunk of the usage of `getTerminator()`
that insists on the narrow type and so is an easy batch of updates.
Several files saw more extensive updates where this would cascade to
requiring API updates within the file to use `Instruction` instead of
`TerminatorInst`. All of these were trivial in nature (pervasively using
`Instruction` instead just worked).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344502 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 10:04:59 +00:00
Chandler Carruth aa517f562f [TI removal] Remove TerminatorInst from GVN.h and GVN.cpp.
This is the last interesting usage in all of LLVM's headers. The
remaining usages in headers are the core typesystem bits (Core.h,
instruction types, and InstVisitor) and as the return of
`BasicBlock::getTerminator`. The latter is the big remaining API point
that I'll remove after mass updates to user code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344501 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 10:00:15 +00:00
Chandler Carruth fc6649b88c [TI removal] Remove TerminatorInst from SparsePropagation.h and
related code.

This is simple as we just need to replace the type and move to the
concept of visiting a "terminator" rather than a specific instruction
subclass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344500 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 09:47:26 +00:00
Chandler Carruth ac346921b5 [TI removal] Remove a dead forward declaration of TerminatorInst. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344499 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 09:34:31 +00:00
Chandler Carruth ce1e09bcf5 [TI removal] Remove TerminatorInst from BasicBlockUtils.h
This requires updating a number of .cpp files to adapt to the new API.
I've just systematically updated all uses of `TerminatorInst` within
these files te `Instruction` so thta I won't have to touch them again in
the future.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344498 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 09:34:05 +00:00
Chandler Carruth f2c212eed3 [TI removal] Just use Instruction in the CFG printer code. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344497 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 09:33:40 +00:00
Guillaume Chatelet 9d078e5696 [llvm-exegesis] Fix missing std::move.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344496 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 09:21:21 +00:00
Chandler Carruth 7c0f083bcb [TI removal] Remove a unnecessary use of TerminatorInst from an IR
header. NFC.

Part of the removal of `TerminatorInst` from the type hierarchy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344495 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 09:17:38 +00:00
Chandler Carruth dc5c9c2809 [TI removal] Remove TerminatorInst as an input parameter from all public
LLVM APIs. There weren't very many.

We still have the instruction visitor, and APIs with TerminatorInst as
a return type or an output parameter.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344494 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 09:17:09 +00:00
Guillaume Chatelet 919972ec1f [llvm-exegesis][NFC] Return many CodeTemplates instead of one.
Summary: This is part one of the change where I simply changed the signature of the functions. More work need to be done to actually produce more than one CodeTemplate per instruction.

Reviewers: courbet

Subscribers: tschuett, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344493 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 09:09:19 +00:00
Bjorn Pettersson ffc5ec8c81 [TwoAddressInstructionPass] Replace subregister uses when processing tied operands
Summary:
TwoAddressInstruction pass typically rewrites
  %1:short = foo %0.sub_lo:long
as
  %1:short = COPY %0.sub_lo:long
  %1:short = foo %1:short
when having tied operands.

If there are extra un-tied operands that uses the same reg and
subreg, such as the second and third inputs to fie here:
  %1:short = fie %0.sub_lo:long, %0.sub_hi:long, %0.sub_lo:long
then there was a bug which replaced the register %0 also for
the un-tied operand, but without changing the subregister indices.
So we used to get:
  %1:short = COPY %0.sub_lo:long
  %1:short = fie %1, %1.sub_hi:short, %1.sub_lo:short
With this fix we instead get:
  %1:short = COPY %0.sub_lo:long
  %1:short = fie %1, %0.sub_hi:long, %1

Reviewers: arsenm, JesperAntonsson, kparzysz, MatzeB

Reviewed By: MatzeB

Subscribers: bjope, kparzysz, wdng, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344492 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 08:36:03 +00:00
Craig Topper 15ca92098a [X86] Autogenerate checks. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344490 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 05:31:24 +00:00
Lang Hames aa8c49dafa [ORC] Simplify naming for JITDylib definition generators.
Renames:
  JITDylib's setFallbackDefinitionGenerator method to setGenerator.
  DynamicLibraryFallbackGenerator class to DynamicLibrarySearchGenerator.
  ReexportsFallbackDefinitionGenerator to ReexportsGenerator.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344489 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 05:07:54 +00:00
Craig Topper a0b9470673 [X86] Move promotion of vector and/or/xor from legalization to DAG combine
Summary:
I've noticed that the bitcasts we introduce for these make computeKnownBits and computeNumSignBits not work well in LegalizeVectorOps. LegalizeVectorOps legalizes bottom up while LegalizeDAG legalizes top down. The bottom up strategy for LegalizeVectorOps means operands are legalized before their uses. So we promote and/or/xor before we legalize the operands that use them making computeKnownBits/computeNumSignBits in places like LowerTruncate suboptimal. I looked at changing LegalizeVectorOps to be top down as well, but that was more disruptive and caused some regressions. I also looked at just moving promotion of binops to LegalizeDAG, but that had a few issues one around matching AND,ANDN,OR into VSELECT because I had to create ANDN as vXi64, but the other nodes hadn't legalized yet, I didn't look too hard at fixing that.

This patch seems to produce better results overall than my other attempts. We now form broadcasts of constants better in some cases. For at least some of them the AND was being introduced in LegalizeDAG, promoted to vXi64, and the BUILD_VECTOR was also legalized there. I think we got bad ordering of that. Now the promotion is out of the legalizer so we handle this better.

In the longer term I think we really should evaluate whether we should be doing this promotion at all. It's really there to reduce isel pattern count, but I'm wondering if we'd be better served just eating the pattern cost or doing C++ based isel for vector and/or/xor in X86ISelDAGToDAG. The masked and/or/xor will definitely be difficult in patterns if a bitcast gets between the vselect and the and/or/xor node. That becomes a lot of permutations to cover.

Reviewers: RKSimon, spatel

Reviewed By: RKSimon

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344487 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 01:51:58 +00:00
Craig Topper 5854a1f283 [X86] Add 128 MOVDDUP to the constant pool printing in X86AsmPrinter::EmitInstruction.
We use this instruction to broadcast a single 64-bit value to a v2i64/v2f64 vector.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344486 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 01:51:53 +00:00
Craig Topper be51e5f963 [X86] Autogenerate complete checks. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344485 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-15 01:51:50 +00:00
Simon Pilgrim c76c02e1ed [InstCombine] Add PR27343 test cases
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344484 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-14 20:14:33 +00:00
Ayal Zaks 631cfd79b3 [LV] Fix comments reported when not vectorizing single iteration loops; NFC
Landing this as a separate part of https://reviews.llvm.org/D50480, being a
seemingly unrelated change ([LV] Vectorizing loops of arbitrary trip count
without remainder under opt for size).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344483 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-14 17:53:02 +00:00
Simon Pilgrim d92ffe6698 [X86][AVX] Enable lowerVectorShuffleAsLanePermuteAndPermute v16i16/v32i8 shuffle lowering
Extends D53148 from v4f64 now that we have test coverage for v16i16/v32i8 shuffles.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344481 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-14 17:34:20 +00:00
Simon Pilgrim 7e9c8da5fd [ARM] Regenerate cttz tests
Improve codegen view as part of PR32655

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344479 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-14 16:49:04 +00:00
Lang Hames c8309b5ac3 [ORC] Remove XXLayer::add methods that default to using the main JITDylib.
They're not currently used and may complicate upcoming changes to add's
signature and behavior.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344478 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-14 16:09:59 +00:00
Simon Pilgrim ffc6fe6727 [LegalizeDAG] Don't bother with final MUL+SRL stage for byte CTPOP.
The final stage of CTPOP expansion (v = (v * 0x01010101...) >> (Len - 8)) is completely pointless for the byte (Len = 8) case as it reduces to (v = (v * 0x01...) >> 0), but annoyingly this doesn't always get optimized away. 

Found while investigating generic vector CTPOP expansion (PR32655).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344477 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-14 15:56:28 +00:00
Sanjay Patel 3394148166 [InstCombine] combine a shuffle and an extract subvector shuffle
This is part of the missing IR-level folding noted in D52912.
This should be ok as a canonicalization because the new shuffle mask can't
be any more complicated than the existing shuffle mask. If there's some 
target where the shorter vector shuffle is not legal, it should just end up 
expanding to something like the pair of shuffles that we're starting with here.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344476 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-14 15:25:06 +00:00
Dorit Nuzman 7d7250490b recommit 344472 after fixing build failure on ARM and PPC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344475 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-14 08:50:06 +00:00
Dorit Nuzman 473da03560 revert 344472 due to failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344473 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-14 07:21:20 +00:00
Dorit Nuzman a3ff03e8e2 [IAI,LV] Add support for vectorizing predicated strided accesses using masked
interleave-group

The vectorizer currently does not attempt to create interleave-groups that
contain predicated loads/stores; predicated strided accesses can currently be
vectorized only using masked gather/scatter or scalarization. This patch makes
predicated loads/stores candidates for forming interleave-groups during the
Loop-Vectorizer's analysis, and adds the proper support for masked-interleave-
groups to the Loop-Vectorizer's planning and transformation stages. The patch
also extends the TTI API to allow querying the cost of masked interleave groups
(which each target can control); Targets that support masked vector loads/
stores may choose to enable this feature and allow vectorizing predicated
strided loads/stores using masked wide loads/stores and shuffles.

Reviewers: Ayal, hsaito, dcaballe, fhahn, javed.absar

Reviewed By: Ayal

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344472 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-14 07:06:16 +00:00
Craig Topper 6c09fbd91a [X86] Fix bad indentation. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344471 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-14 04:01:40 +00:00
Craig Topper 1ccfde68b8 [X86] Type legalize v2f32 stores by widening to v4f32, casting to v2f64, extracting f64 and storing.
Summary: This is similar to what D52528 did for loads. It should match what generic type legalization does in 64-bit mode where it uses a v2i64 cast and an i64 store.

Reviewers: RKSimon, spatel

Reviewed By: RKSimon

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344470 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-14 03:36:27 +00:00
Benjamin Kramer 3898e47d1e Move some helpers from the global namespace into anonymous ones.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344468 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-13 22:18:22 +00:00
Lang Hames 54d4881c35 [ORC] During lookup, do not match against hidden symbols in other JITDylibs.
This adds two arguments to the main ExecutionSession::lookup method:
MatchNonExportedInJD, and MatchNonExported. These control whether and where
hidden symbols should be matched when searching a list of JITDylibs.

A similar effect could have been achieved by filtering search results, but
this would have involved materializing symbol definitions (since materialization
is triggered on lookup) only to throw the results away, among other issues.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344467 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-13 21:53:40 +00:00
Simon Pilgrim cc018b73f8 [AARCH64] Regenerate popcnt tests
Improve codegen view as part of PR32655

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344466 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-13 21:50:15 +00:00
Simon Pilgrim 1289860732 [ARM] Regenerate popcnt tests
Improve codegen view as part of PR32655

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344465 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-13 21:32:49 +00:00