146623 Commits

Author SHA1 Message Date
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
Volkan Keles
72e0026e86 [GlobalISel] IRTranslator: Return the scalar for <1 x Ty> constant vectors
Summary:
<1 x Ty> is not a legal vector type in LLT, we shouldn’t build G_MERGE_VALUES
instruction for them.

Reviewers: qcolombet, aditya_nandakumar, dsanders, t.p.northover, ab, javed.absar

Reviewed By: qcolombet

Subscribers: dberris, rovka, kristof.beyls, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297792 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 23:45:06 +00:00
Fiona Glaser
54dc1ed088 MemCpyOptimizer: don't create new addrspace casts
This isn't safe on all targets, and since we don't have a way
to know it's safe, avoid doing it for now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297788 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 22:37:38 +00:00
Daniel Sanders
dfb7eaee7b [globalisel] LLVM_BUILD_GLOBAL_ISEL=OFF should prevent GlobalISel instruction selector from being declared.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297786 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 22:09:29 +00:00
Kostya Serebryany
ae8f1d8b85 [libFuzzer] remove more stale code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297785 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 21:47:52 +00:00
Kostya Serebryany
05628fa8ff [libFuzzer] don't clear Counters in TracePC::CollectFeatures since they will be cleared anyway in ResetMaps
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297783 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 21:40:53 +00:00
Daniel Sanders
9db5e41e1d [globalisel][tblgen] Add support for ComplexPatterns
Summary:
Adds a new kind of MachineOperand: MO_Placeholder.
This operand must not appear in the MIR and only exists as a way of
creating an 'uninitialized' operand until a matcher function overwrites it.

Depends on D30046, D29712

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

Reviewed By: qcolombet

Subscribers: dberris, kristof.beyls, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297782 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 21:32:08 +00:00
Kostya Serebryany
d18970b6b1 [libFuzzer] remove stale code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297781 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 21:30:14 +00:00
Simon Pilgrim
e35265b998 [SelectionDAG] Add a signed integer absolute ISD node
Reduced version of D26357 - based on the discussion on llvm-dev about canonicalization of UMIN/UMAX/SMIN/SMAX as well as ABS I've reduced that patch to just the ABS ISD node (with x86/sse support) to improve basic combines and lowering.

ARM/AArch64, Hexagon, PowerPC and NVPTX all have similar instructions allowing us to make this a generic opcode and move away from the hard coded tablegen patterns which makes it tricky to match more complex patterns.

At the moment this patch doesn't attempt legalization as we only create an ABS node if its legal/custom.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297780 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 21:26:58 +00:00
Derek Schuff
25754c1409 [WebAssembly] Use LEB encoding for value types
Previously we were using the encoded LEB hex values
for the value types.  This change uses the decoded
negative value and the LEB encoder to write them out.

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

Patch by Sam Clegg

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297777 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 20:23:22 +00:00
Rafael Espindola
22bd70fa31 Archives require a symbol table on Solaris, even if empty.
On Solaris ld (and some other tools that use the underlying utility
libraries, such as elfdump) chokes on an archive library that has no
symbol table. The Solaris tools always create one, even if it's empty.

That bug has been fixed in the latest development line, and can
probably be backported to a supported release, but it would be nice if
LLVM's archiver could emit the empty symbol table, too.

Patch by Danek Duvall!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297773 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 19:57:13 +00:00
Evgeniy Stepanov
c67a9ef0ea Fix asm printing of associated sections.
Make MCSectionELF::AssociatedSection be a link to a symbol, because
that's how it works in the assembly, and use it in the asm printer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297769 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 19:28:51 +00:00
Eli Friedman
152625875f [ARM] Replace some C++ selection code with TableGen patterns. NFC.
Differential Revision: https://reviews.llvm.org/D30794



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297768 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 18:43:37 +00:00
Juergen Ributzka
c4630f9d5b [Support] Make the SystemZ bot happy by using make_error_code.
This should fix the last issue on the SystemZ bot related to the broken symlink
test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297767 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 18:37:44 +00:00
Sanjay Patel
bea559baff [DAG] vector div/rem with any zero element in divisor is undef
This is the backend counterpart to:
https://reviews.llvm.org/rL297390
https://reviews.llvm.org/rL297409
and follow-up to:
https://reviews.llvm.org/rL297384

It surprised me that we need to duplicate the check in FoldConstantArithmetic and FoldConstantVectorArithmetic, 
but one or the other doesn't catch all of the test cases. There is an existing code comment about merging those 
someday.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297762 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 18:06:28 +00:00
Dehao Chen
cd2a5b62d1 SamplePGO ThinLTO ICP fix for local functions.
Summary:
In SamplePGO, if the profile is collected from non-LTO binary, and used to drive ThinLTO, the indirect call promotion may fail because ThinLTO adjusts local function names to avoid conflicts. There are two places of where the mismatch can happen:

1. thin-link prepends SourceFileName to front of FuncName to build the GUID (GlobalValue::getGlobalIdentifier). Unlike instrumentation FDO, SamplePGO does not use the PGOFuncName scheme and therefore the indirect call target profile data contains a hash of the OriginalName.
2. backend compiler promotes some local functions to global and appends .llvm.{$ModuleHash} to the end of the FuncName to derive PromotedFunctionName

This patch tries at the best effort to find the GUID from the original local function name (in profile), and use that in ICP promotion, and in SamplePGO matching that happens in the backend after importing/inlining:

1. in thin-link, it builds the map from OriginalName to GUID so that when thin-link reads in indirect call target profile (represented by OriginalName), it knows which GUID to import.
2. in backend compiler, if sample profile reader cannot find a profile match for PromotedFunctionName, it will try to find if there is a match for OriginalFunctionName.
3. in backend compiler, we build symbol table entry for OriginalFunctionName and pointer to the same symbol of PromotedFunctionName, so that ICP can find the correct target to promote.

Reviewers: mehdi_amini, tejohnson

Reviewed By: tejohnson

Subscribers: llvm-commits, Prazek

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297757 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 17:33:01 +00:00
Sanjay Patel
77960c2b12 [InstCombine] improve readability; NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297755 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 17:27:27 +00:00
Sanjay Patel
acccef0ba4 [InstCombine] consolidate rem tests and update checks; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297747 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 16:27:46 +00:00
Sanjay Patel
68e70a513f [InstCombine] regenerate checks; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297746 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 16:16:40 +00:00
Krzysztof Parzyszek
702396c9dc [Hexagon] Fix a condition in HexagonEarlyIfConv.cpp
This fixes llvm.org/PR32265.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297745 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 15:21:33 +00:00
Artyom Skrobov
c412df4601 Fix typo in comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297742 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 14:13:19 +00:00
Simon Pilgrim
ace71433ab [X86] Add extra BITREVERSE tests
Test on 32-bit and 64-bit targets.

Add bitreverse tests for i64, i32 and i16

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297741 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 14:03:16 +00:00
Gil Rapaport
a27a1f7795 [LV] Refactor cross-iteration phi's back-patching; NFC
This patch refactors the PHisToFix loop as follows:

- The loop itself now resides in its own method.
- The new method iterates on scalar-loop's header; the PHIsToFix map formerly
  propagated as an output parameter and filled during phi widening is removed.
- The code handling reductions is moved into its own method, similar to the
  existing fixFirstOrderRecurrence().

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297740 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 13:50:47 +00:00
Oliver Stannard
8f5c321021 [ARM] Diagnose ARM MOVT without :lower16: or :upper16: expression
This instruction was missing from the list of opcodes that we check, so we were
hitting an llvm_unreachable in ARMMCCodeEmitter.cpp for the ARM MOVT
instruction, rather than the diagnostic that is emitted for the other MOVW/MOVT
instructions.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297739 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 13:50:10 +00:00
Artyom Skrobov
0117588515 De-duplicate the two implementations of ARMBaseInstrInfo::isProfitableToIfCvt() [NFC]
Reviewers: congh, rengolin

Subscribers: aemerson, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297738 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 13:38:45 +00:00
Ayal Zaks
1a739b3383 [LV] Refactor Cost Model's selectVectorizationFactor(); NFC
Refactoring Cost Model's selectVectorizationFactor() so that it handles only the
selection of the best VF from a pre-computed range of candidate VF's, extracting
early-exit criteria and the computation of a MaxVF upper-bound to other methods,
all driven by a newly introduced LoopVectorizationPlanner.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297737 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 13:07:04 +00:00
Simon Pilgrim
e13633cf77 [X86][MMX] Update FIXME comment. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297736 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 12:13:41 +00:00
Daniel Berlin
c8d396a8a7 Make PredIteratorCache size() logically const. Do not require copying predecessors to get size.
Summary:
Every single benchmark i can run, on large and small cfgs, fully
connected, etc, across 3 different platforms (x86, arm., and PPC) says
that the current pred iterator cache is a losing proposition.

I can't find a case where it's faster than just walking preds, and in some cases, it's 5-10% slower.

This is due to copying the preds.
It also degrades into copying the entire cfg.

The one operation that is occasionally faster is the cached size.
This makes that operation faster by not relying on having the copies available.

I'm not even sure that is faster enough to be worth it. I, again, have
trouble finding cases where this takes long enough in a pass to be
worth caching compared to a million other things they could cache or
improve.

My suggestion:
We next remove the get() interface.
We do stronger benchmarking of size().
We probably end up killing this entire cache.
/

Reviewers: chandlerc

Subscribers: aemerson, llvm-commits, trentxintong

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297733 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 11:25:45 +00:00
James Henderson
51258d9cbd Test commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297731 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 10:51:14 +00:00
Benjamin Kramer
e463d809b5 [CodeGen] Fix -Wreorder warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297729 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 10:29:47 +00:00