146452 Commits

Author SHA1 Message Date
Zvi Rackover
184011252a [DAGCombine] Bail out if can't create a vector with at least two elements
Summary:

Fixes pr32278

Reviewers: igorb, craig.topper, RKSimon, spatel, hfinkel

Reviewed By: RKSimon

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297878 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 19:48:36 +00:00
Derek Schuff
f04cbf365e [WebAssembly] Update format of 'names' section.
This change updates to the format of the 'names' sectionin the
generated wasm binary to match the latest changesto the design
and 'wabt'.

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

Patch by Sam Clegg

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297877 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 19:36:02 +00:00
Simon Pilgrim
1a576c57ed [X86] Add missing BITREVERSE costs for SSE2 vectors and i8/i16/i32/i64 scalars
Prep work for PR31810

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297876 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 19:34:55 +00:00
Ahmed Bougacha
924375d273 [GlobalISel] Avoid translating synthetic constants to new G_CONSTANTS.
Currently, we create a G_CONSTANT for every "synthetic" integer
constant operand (for instance, for the G_GEP offset).
Instead, share the G_CONSTANTs we might have created by going through
the ValueToVReg machinery.

When we're emitting synthetic constants, we do need to get Constants from
the context.  One could argue that we shouldn't modify the context at
all (for instance, this means that we're going to use a tad more memory
if the constant wasn't used elsewhere), but constants are mostly
harmless.  We currently do this for extractvalue and all.

For constant fcmp, this does mean we'll emit an extra COPY, which is not
necessarily more optimal than an extra materialized constant.
But that preserves the current intended design of uniqued G_CONSTANTs,
and the rematerialization problem exists elsewhere and should be
resolved with a single coherent solution.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297875 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 19:21:11 +00:00
Ahmed Bougacha
bde5be06db [GlobalISel][AArch64] Select ADDXri.
We're now able to select ADDWri thanks to the new complex pattern
support.  Extend that to ADDXri.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297874 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 19:20:59 +00:00
Matt Arsenault
0c52bece01 AMDGPU: Fix unnecessary ands when packing f16 vectors
computeKnownBits didn't handle fp_to_fp16 to report
the high bits as 0. ARM maps the generic node to an instruction
that does not modify the high bits of the register, so introduce
a target node where the high bits are known 0.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297873 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 19:04:26 +00:00
Tim Northover
f4523b0efd ARM: avoid clobbering register in v6 jump-table expansion.
If we got unlucky with register allocation and actual constpool placement, we
could end up producing a tTBB_JT with an index that's already been clobbered.

Technically, we might be able to fix this situation up with a MOV, but I think
the constant islands pass is complex enough without having to deal with more
weird edge-cases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297871 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 18:38:13 +00:00
Rong Xu
1d95032b0c [PGO] Refactor the code for value profile annotation
This patch refactors the code for value profile annotation to facilitate
of adding other kind of value profiles.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297870 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 18:23:39 +00:00
Ahmed Bougacha
17931c8370 [GlobalISel] Insert translated switch icmp blocks after switch parent.
Now that we preserve the IR layout, we would end up with all the newly
synthesized switch comparison blocks at the end of the function.
Instead, use a hopefully more reasonable layout, with the comparison
blocks immediately following the switch comparison blocks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297869 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 18:22:37 +00:00
Ahmed Bougacha
c0f82e4a51 [GlobalISel] Preserve IR block layout.
It makes the output function layout more predictable;  the layout has
an effect on performance, we don't want it to be at the mercy of the
translator's visitation order and such.
The predictable output is also easier to digest.

getOrCreateBB isn't appropriately named anymore, as it never needs to
create anything.  Rename it and extract the MBB creation logic out of it.

A couple tests were sensitive to the order. Update them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297868 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 18:22:33 +00:00
Ahmed Bougacha
4d63638103 [GlobalISel] Use ASCII quote/apostrophe in comment. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297867 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 18:22:24 +00:00
Matt Arsenault
15db330072 AMDGPU: Minor SIAnnotateControlFlow cleanups
Newline fixes, early return, range loops.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297865 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 18:00:12 +00:00
Zachary Turner
ed14562046 [YAML] When outputting, provide the ability to write default values.
Previously, if you attempted to write a key/value pair and the
value was equal to the key's default value, we would not output
the value.  Sometimes it is useful to be able to see this value
in the output anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297864 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 17:47:39 +00:00
Reid Kleckner
66224eb928 Move some LAST_* enum sentinels out of their enums
These are not valid values of the enum, so this will improve clang
-Wcovered-switch-default diagnostics. It also fixes some
-Wbitfield-enum-conversion warnings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297863 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 17:43:40 +00:00
Craig Topper
01c2f41249 [CodeGen] Use APInt::setLowBits/setHighBits/setBitsFrom in more places
This patch replaces ORs with getHighBits/getLowBits etc. with setLowBits/setHighBits/setBitsFrom.

In a few of the places we weren't ORing, but the KnownZero/KnownOne vectors were already initialized to zero. We exploit this in most places already there were just some that were inconsistent.

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




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297860 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 16:53:53 +00:00
Ahmed Bougacha
8aaf47200a [GlobalISel][AArch64] Add back constant select tests. NFC.
More of r297856.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297859 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 16:51:41 +00:00
Ahmed Bougacha
6db3538eae [GlobalISel][AArch64] Use appropriate test function names. NFC.
These FP tests are on FPR, not GPR.  Don't lie in the name.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297857 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 16:29:40 +00:00
Ahmed Bougacha
be130a9ee9 [GlobalISel][AArch64] Split out select tests. NFC.
The test has grown enough to be annoying to navigate.
While there, Remove unnecessary RUNs, and cleanup a couple comments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297856 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 16:29:37 +00:00
Ahmed Bougacha
4b7d61b203 [GlobalISel] Remove dead member. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297855 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 16:29:32 +00:00
Peter Collingbourne
603d3c6be1 Re-apply r296730, "cmake: Configure the ThinLTO cache directory when using ELF lld or gold."
All known cache-related bugs observed when self hosting have been fixed (r296907
and r297853).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297854 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 16:28:43 +00:00
Peter Collingbourne
cbe96ddc5f CodeGen: Use the source filename as the argument to .file, rather than the module ID.
Using the module ID here is wrong for a couple of reasons:
1) The module ID is not persisted, so we can end up with different
   object file contents given the same input file (for example if the same
   file is accessed via different paths).
2) With ThinLTO the module ID field may contain the path to a bitcode file,
   which is incorrect, as the .file argument is supposed to contain the path to
   a source file.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297853 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 16:24:52 +00:00
Simon Pilgrim
a1d8ce502d [SelectionDAG] Support BUILD_VECTOR implicit truncation in SelectionDAG::ComputeNumSignBits (PR32273)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297852 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 16:22:24 +00:00
Nemanja Ivanovic
245bc886ae [PowerPC][Altivec] Add mfvrd and mffprd extended mnemonic
mfvrd and mffprd are both alias to mfvrsd.
This patch enables correct parsing of the aliases, but we still emit a mfvrsd.

Committing on behalf of brunoalr (Bruno Rosa).

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297849 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 16:04:53 +00:00
Simon Pilgrim
4160d49ee2 [SelectionDAG][AArch64] Add test case showing incorrect SelectionDAG::ComputeNumSignBits BUILD_VECTOR handling
Reduced from a mixture of PR32273 and David Green's test cases showing SelectionDAG::ComputeNumSignBits not correctly handling BUILD_VECTOR implicit truncation of inputs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297847 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 15:40:34 +00:00
Sanjay Patel
27c606791d Cyle -> Cycle; NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297846 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 15:37:42 +00:00
Eric Liu
8675210827 Revert "Refactor SimplifyCFG:canSinkInstructions [NFC]"
This reverts commit r297839, which breaks Transforms/SimplifyCFG/sink-common-code.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297845 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 15:29:42 +00:00
Artyom Skrobov
70b9c4a80e Revert "[Thumb1] Fix the bug when adding/subtracting -2147483648"
This reverts r297820 which apparently fails on A15 hosts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297842 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 14:50:43 +00:00
Simon Pilgrim
c12050bd3a Reverted unintended commit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297841 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 14:47:30 +00:00
Simon Pilgrim
a6a5484b63 Fix Wint-in-bool-context warning (PR32248)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297840 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 14:38:19 +00:00
Aditya Kumar
945e057a95 Refactor SimplifyCFG:canSinkInstructions [NFC]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297839 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 14:26:45 +00:00
Sam Parker
8888b5e1c6 Reverting r297821 due to breaking lld test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297838 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 14:06:42 +00:00
Sanjay Patel
302f165b35 [Target] fix typo; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297836 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 14:01:28 +00:00
Eric Liu
788c998a8b Add 'REQUIRES: asserts' to pr32278.ll introduced in r297822
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297835 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 13:37:20 +00:00
Simon Pilgrim
5241875f53 [X86][SSE] Fixed shuffle MOVSS/MOVSD combining of all zeroable inputs
Turns out it can happen, so the assertion was too harsh

Found during fuzz testing

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297833 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 13:16:46 +00:00
Petar Jovanovic
71148e9b8f [Mips] Add support to match more patterns for DEXT and CINS
This patch adds support for recognizing more patterns to match to DEXT and
CINS instructions.
It finds cases where multiple instructions could be replaced with a single
DEXT or CINS instruction.

For example, for the following:

define i64 @dext_and32(i64 zeroext %a) {
entry:

 %and = and i64 %a, 4294967295
 ret i64 %and
}

instead of generating:

 0000000000000088 <dext_and32>:

 88:   64010001        daddiu  at,zero,1
 8c:   0001083c        dsll32  at,at,0x0
 90:   6421ffff        daddiu  at,at,-1
 94:   03e00008        jr      ra
 98:   00811024        and     v0,a0,at
 9c:   00000000        nop

the following gets generated:

 0000000000000068 <dext_and32>:

 68:   03e00008        jr      ra
 6c:   7c82f803        dext    v0,a0,0x0,0x20

Cases that are covered:

DEXT:

 1. and $src, mask where mask > 0xffff
 2. zext $src zero extend from i32 to i64

CINS:

 1. and (shl $src, pos), mask
 2. shl (and $src, mask), pos
 3. zext (shl $src, pos) zero extend from i32 to i64

Patch by Violeta Vukobrat.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297832 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 13:10:08 +00:00
Simon Pilgrim
39fad26ce4 Align cost model columns. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297824 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 11:57:42 +00:00
Zvi Rackover
37ce2d4c60 Fix malformed XFAIL in previous commit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297823 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 11:44:14 +00:00
Zvi Rackover
a8cf2f91bc [DAGCombine] Add reproducer for pr32278
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297822 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 11:34:51 +00:00
Sam Parker
eb3e69e9ee [ARM] Fix for branch label disassembly for Thumb
Different MCInstrAnalysis classes for arm and thumb mode, each with
their own evaluateBranch implementation. I added a test case and
fixed the coff-relocations test to use '<label>:' rather than
'<label>' in the CHECK-LABEL entries, since the ones without the
colon would match branch targets. Might be worth noticing that
llvm-objdump does not lookup the relocation and thus assigns it a
target depending on the encoded immediate which #0, so it thinks it
branches to the next instruction.

Committed on behalf of Andre Vieira (avieira).

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297821 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 10:21:23 +00:00
Artyom Skrobov
f803e21e4f [Thumb1] Fix the bug when adding/subtracting -2147483648
Differential Revision: https://reviews.llvm.org/D30829

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297820 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 10:19:16 +00:00
Nuno Lopes
13c7e8f75d fix gcc -Wmisleading-indentation [NFC]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297816 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 09:33:33 +00:00
Eric Liu
c19a1fb7d0 [Support][CommandLine] Make it possible to get error messages from ParseCommandLineOptions when ignoring errors.
Summary:
Previously, ParseCommandLineOptions returns false and ignores error messages
when IgnoreErrors. It would be useful to also return error messages if users
decide to check parsing result instead of having the program exit on error.

Reviewers: chandlerc, mehdi_amini, rnk

Reviewed By: rnk

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297810 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 08:41:00 +00:00
Sam Parker
75f7c44e38 [ARM] Enable SMLAL[B|T] isel
Enable the selection of the 64-bit signed multiply accumulate
instructions which operate on 16-bit operands. These are enabled for
ARMv5TE onwards for ARM and for V6T2 and other DSP enabled Thumb
architectures.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297809 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 08:27:11 +00:00
Taewook Oh
39985529f8 NFC: Reformats comments according to the coding guildelines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297808 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 06:29:23 +00:00
Michal Gorny
fc904cc544 [llvm-config] Add minimal sanity tests for path options
Add minimal tests that check whether path options do not fail and output
directories looking like expected. Requested in
https://reviews.llvm.org/rL291218.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297807 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 05:57:29 +00:00
Taewook Oh
5c088820ba [BranchFolding] Merge debug locations from common tail instead of removing
Summary: D25742 improved the precision of debug locations for PGO by removing debug locations from common tail when tail-merging. However, if identical insturctions that are merged into a common tail have the same debug locations, there's no need to remove them. This patch creates a merged debug location of identical instructions across SameTails and assign it to the instruction in the common tail, so that the debug locations are maintained if they are same across identical instructions.

Reviewers: aprantl, probinson, MatzeB, rob.lougher

Reviewed By: aprantl

Subscribers: andreadb, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297805 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 05:44:59 +00:00
Peter Collingbourne
c7a57cdda6 Ensure that prefix data is preserved with subsections-via-symbols
On MachO platforms that use subsections-via-symbols dead code stripping will
drop prefix data. Unfortunately there is no great way to convey the relationship
between a function and its prefix data to the linker. We are forced to use a bit
of a hack: we give the prefix data it’s own symbol, and mark the actual function
entry an .alt_entry.

Patch by Moritz Angermann!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297804 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 04:18:16 +00:00
Kostya Serebryany
3785710791 [libFuzzer] remove even more stale code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297797 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 00:39:06 +00:00
Kostya Serebryany
59249af18d [libFuzzer] simplify code a bit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297796 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 00:34:25 +00:00
Francis Visoiu Mistrih
97979ac38c [MachineFunction] Fix documentation. NFC
MachineFunction::getBlockNumber -> MachineFunction::getNumber.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297795 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 23:58:57 +00:00