94063 Commits

Author SHA1 Message Date
Elliot Colp
4f657df0db Fix SystemZ compilation abort caused by negative AND mask
Normally, when an AND with a constant is lowered to NILL, the constant value is truncated to 16 bits. However, since r274066, ANDs whose results are used in a shift are caught by a different pattern that does not truncate. The instruction printer expects a 16-bit unsigned immediate operand for NILL, so this results in an abort.

This patch adds code to manually truncate the constant in this situation. The rest of the bits are then set, so we will detect a case for NILL "naturally" rather than using peephole optimizations.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279105 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18 18:04:26 +00:00
Duncan P. N. Exon Smith
92e6c942c5 AArch64: Don't call getIterator() on iterators
Remove an unnecessary round-trip:

    iterator => operator->() => getIterator()

In some cases, the iterator is end(), so the dereference of operator->
is invalid (UB).

The testcase only crashes with r278974 (currently reverted to
investigate this), which adds an assertion for invalid dereferences of
ilist nodes.

Fixes PR29035.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279104 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18 17:58:09 +00:00
Eugene Zelenko
8970377ddc [LLVM] Fix some Clang-tidy modernize-use-using and Include What You Use warnings
Differential revision: https://reviews.llvm.org/D23675


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279102 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18 17:56:27 +00:00
Sanjay Patel
030db6490a [InstCombine] use m_APInt to allow icmp (udiv X, Y), C folds for splat constant vectors
This is a sibling of:
https://reviews.llvm.org/rL278859
https://reviews.llvm.org/rL278935
https://reviews.llvm.org/rL278945
https://reviews.llvm.org/rL279066
https://reviews.llvm.org/rL279077


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279101 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18 17:55:59 +00:00
Dan Gohman
bb5b5bce12 [WebAssembly] Disable the store-results optimization.
The WebAssemly spec removing the return value from store instructions, so
remove the associated optimization from LLVM.

This patch leaves the store instruction operands in place for now, so stores
now always write to "$drop"; these will be removed in a seperate patch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279100 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18 17:51:27 +00:00
Chandler Carruth
7306a617c3 [Assumptions] Make collecting ephemeral values not quadratic in the
number of assume intrinsics.

The classical way to have a cache-friendly vector style container when
we need queue semantics for BFS instead of stack semantics for DFS is to
use an ever-growing vector and an index. Erasing from the front requires
O(size) work, and unless we expect the worklist to grow *very* large,
its probably cheaper to just grow and race down the list.

But that makes it more bad that we're putting the assume intrinsics in
this at all. We end up looking at the (by definition empty) use list to
see if they're ephemeral (when we've already put them in that set), etc.

Instead, directly populate the worklist with the operands when we mark
the assume intrinsics as ephemeral. Also, test the visited set *before*
putting things into the worklist so we don't accumulate the same value
in the list 100s of times.

It would be nice to use a set-vector for this but I think its useful to
test the set earlier to avoid repeatedly querying whether the same
instruction is safe to speculate.

Hopefully with these changes the number of values pushed onto the
worklist is smaller, and we avoid quadratic work by letting it grow as
necessary.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279099 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18 17:51:24 +00:00
Vedant Kumar
44465268d3 Fix -Wpessimizing-move error, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279095 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18 17:39:53 +00:00
Sanjay Patel
1197bbfe90 [InstCombine] clean up foldICmpUDivConstant; NFC
1. Better variable names
2. Remove unnecessary check of ConstantInt


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279094 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18 17:37:26 +00:00
Zachary Turner
3fe902e45f Resubmit "Write the TPI stream from a PDB to Yaml."
The original patch was breaking some buildbots due to an
incorrect ordering of function definitions which caused some
compilers to recognize a definition but others to not.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279089 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18 16:49:29 +00:00
Artur Pilipenko
2e26f159da CVP. Turn marking adds as no wrap (introduced by r278107) off by default
It causes a regression on our internal benchmark. Introduce cvp-dont-process flag and set it off by default while investigating the regression.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279082 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18 16:08:35 +00:00
Ahmed Bougacha
2afbd4c045 [AArch64][GlobalISel] Select floating-point binary ops.
There is no FREM instruction, but the others are straightforward.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279081 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18 16:05:11 +00:00
Davide Italiano
b6d362ae70 [IRCE] Switch over to LLVM_DUMP_METHOD. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279079 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18 15:55:49 +00:00
Sanjay Patel
1759316b11 [InstCombine] use m_APInt to allow icmp (mul X, Y), C folds for splat constant vectors
This is a sibling of:
https://reviews.llvm.org/rL278859
https://reviews.llvm.org/rL278935
https://reviews.llvm.org/rL278945
https://reviews.llvm.org/rL279066



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279077 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18 15:44:44 +00:00
Derek Schuff
0bc76c777e [WebAssembly] Refactor WebAssemblyLowerEmscriptenException pass for setjmp/longjmp
This patch changes the code structure of
WebAssemblyLowerEmscriptenException pass to support both exception
handling and setjmp/longjmp. It also changes the name of the pass and
the source file.

1. Change the file/pass name to WebAssemblyLowerEmscriptenExceptions ->
WebAssemblyLowerEmscriptenEHSjLj to make it clear that it supports both
EH and SjLj
2. List function / global variable names at the top so they
can be changed easily
3. Some cosmetic changes

Patch by Heejin Ahn

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279075 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18 15:27:25 +00:00
Ahmed Bougacha
c9134edd9a [AArch64][GlobalISel] Select G_SDIV/G_UDIV.
There is no REM instruction; that will require an expansion.
It's not obvious that should be done in select, rather than as a
(custom?) legalization.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279074 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18 15:17:13 +00:00
Sanjay Patel
dd00c508c0 [InstCombine] use APInt in isSignTest instead of ConstantInt; NFC
This will enable vector splat folding, but NFC until the callers
have their ConstantInt restrictions removed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279072 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18 14:59:14 +00:00
Sanjay Patel
ce587acab8 fix typo; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279068 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18 14:17:34 +00:00
Krzysztof Parzyszek
22850ef9c5 [Hexagon] Create vcombine in HexagonCopyToCombine
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279067 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18 14:12:34 +00:00
Sanjay Patel
94dd772827 [InstCombine] use m_APInt to allow icmp (xor X, Y), C folds for splat constant vectors
This is a sibling of:
https://reviews.llvm.org/rL278859
https://reviews.llvm.org/rL278935
https://reviews.llvm.org/rL278945


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279066 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18 14:10:48 +00:00
Simon Dardis
44b9d6a9c8 [mips] Correct tail call encoding for MIPSR6
r277708 enabled tails calls for MIPS but used the 'jr' instruction when the 
jump target was held in a register. For MIPSR6, 'jalr $zero, $reg' should
have been used. Additionally, add missing patterns for external and global
symbols for tail calls.

Reviewers: dsanders, vkalintiris

Differential Review: https://reviews.llvm.org/D23301



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279064 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18 13:22:43 +00:00
Alex Bradbury
4304bdae65 (Trivial) TargetPassConfig: assert when TargetMachine has no MCAsmInfo
Summary:
This is a pretty trivial, but I thought it was worth just checking that nobody feels it's completely the wrong thing to be doing.

The motivation is that when starting a new backend, you often start with a minimal stub, pretty much just FooTargetMachine and FooTargetInfo. Once that's built, you might naturally try `llc -march=foo myinput.ll` and it seems more developer-friendly if this ends up asserting due to the lack of MCAsmInfo with an informative message rather than just segfaulting.

Reviewers: MatzeB, chandlerc

Subscribers: bogner, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279061 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18 13:08:58 +00:00
Simon Pilgrim
bc13f5f3a6 Remove trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279054 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18 11:22:22 +00:00
Lang Hames
b60f9a25c0 Revert r279016 -- it breaks win32-elf JIT tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279029 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18 01:33:28 +00:00
Kostya Serebryany
aa4e23e1bb [sanitizer-coverage/libFuzzer] instrument comparisons with __sanitizer_cov_trace_cmp[1248] instead of __sanitizer_cov_trace_cmp, don't pass the comparison type to save a bit performance. Use these new callbacks in libFuzzer
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279027 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18 01:25:28 +00:00
Matthias Braun
b1cfb8c59e TailDuplicator: Fix crash after r278974
Some inputs would after r278974 without this fix (see
http://lab.llvm.org:8080/green/job/clang-stage2-cmake-RgSan_build/2733/console
for an example)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279022 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18 00:59:32 +00:00
Mehdi Amini
dcd27e4c3c [LTO] Promote before performing weak resolution
Summary:
This was reversed compared to ThinLTOCodeGenerator for some reason,
and lead to an increased code-size on my tests. I figured that the
weak resolution may internalize a linkonce function, which will be
promoted immediately (and renamed), before being internalized again.

Reviewers: tejohnson

Subscribers: pcc, llvm-commits, mehdi_amini

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279021 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18 00:59:24 +00:00
Vitaly Buka
76e81b28c6 [asan] Add support of lifetime poisoning into ComputeASanStackFrameLayout
Summary:
We are going to combine poisoning of red zones and scope poisoning.

PR27453

Reviewers: kcc, eugenis

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279020 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18 00:56:58 +00:00
Lang Hames
5bc5c47fda [RuntimeDyld] Strip leading '_' from symbols on 32-bit windows in
RTDyldMemoryManager::getSymbolAddressInProcess()

This should allow JIT'd code for win32 to find in-process symbols. See
http://llvm.org/PR28699 .

Patch by James Holderness. Thanks James!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279016 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18 00:22:34 +00:00
Mehdi Amini
a53e50c418 [LTO] Change addSaveTemps API: do not add dot to the supplied prefix path
Summary:
It does not play well with directories (end up with a bunch of hidden
files).
Also, do not strip the 0 suffix for the first task, especially since
0 can be used by ThinLTO as well now.

Reviewers: tejohnson

Subscribers: mehdi_amini, pcc, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279014 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18 00:12:33 +00:00
Dominic Chen
3f5fad8882 [WebAssembly] Handle debug information and virtual registers without crashing (reland r278967)
Summary: Currently, enabling debug information when compiling for WebAssembly crashes the backend. This commit fixes these by skipping debug values in backend passes.

Reviewers: jfb, aprantl, dschuff, echristo

Subscribers: llvm-commits, dschuff, jfb, MatzeB, dexonsmith, yurydelendik, mehdi_amini

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279011 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-17 23:42:27 +00:00
Kostya Serebryany
ac9c0f4d45 [libFuzzer] force proper popcnt instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279002 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-17 23:09:57 +00:00
Hans Wennborg
3a15af3d32 SCEV: Don't assert about non-SCEV-able value in isSCEVExprNeverPoison() (PR28932)
Differential Revision: https://reviews.llvm.org/D23594

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278999 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-17 22:50:18 +00:00
Haicheng Wu
50d8d1ea85 [LoopUnroll] Move a simple check earlier. NFC.
Move the check of CallInst earlier to skip expensive recursive operations.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278998 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-17 22:42:58 +00:00
Tim Shen
87032a5e0c [LV] Move LoopBodyTraits to a better place, and add comment for simplifying LoopBlocksTraversal. NFC.
Summary: I later (after r278573) found that LoopIterator.h has some overlapping with LoopBodyTraits. It's good to use LoopBodyTraits because a *Traits struct is algorithm independent.

Reviewers: anemet, nadav, mkuper

Subscribers: mzolotukhin, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278996 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-17 22:20:07 +00:00
Kostya Serebryany
e65e275cf2 [libFuzzer] given 0 and 255 more preference when inserting repeated bytes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278986 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-17 21:50:54 +00:00
Chris Bieneman
506857f427 [macho2yaml] Don't write empty linkedit data
Since I stopped writing empty export tries it causes LinkEdit to potentially be completely empty which results in invalid yaml being generated.

To prevent this we skip linkedit data if it is empty.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278985 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-17 21:46:04 +00:00
Kostya Serebryany
9744bb48e4 [libFuzzer] one more mutation: ChangeBinaryInteger; also fix the breakage from r278970
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278982 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-17 21:30:30 +00:00
Kyle Butt
0a6e4fd5d3 Tail Duplication: Accept explicit threshold for duplicating.
This will allow tail duplication and tail merging during layout to have a
shared threshold to make sure that they don't overlap. No observable change
intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278981 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-17 21:07:35 +00:00
Kyle Butt
af9bccaaa4 TailDuplicator: Use optForSize instead of hasFnAttribute.
This will cause minsize functions to have the same threshold as optsize
functions, but otherwise should have no effects.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278980 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-17 21:07:33 +00:00
Kostya Serebryany
7526feb22f [libFuzzer] when printing the reproducer input, also print the base input and the mutation sequence
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278975 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-17 20:45:23 +00:00
Duncan P. N. Exon Smith
21e2c0016c Revert "[WebAssembly] Handle debug information and virtual registers without crashing"
This reverts commit r278967, since the new test is failing when you
don't build the WebAssembly target (most people, since it's
off-by-default).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278973 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-17 20:41:50 +00:00
Justin Bogner
7d7a23e700 Replace a few more "fall through" comments with LLVM_FALLTHROUGH
Follow up to r278902. I had missed "fall through", with a space.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278970 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-17 20:30:52 +00:00
Tim Northover
3ed44cd787 GlobalISel: support irtranslation of icmp instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278969 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-17 20:25:25 +00:00
Dominic Chen
1d359ed1ff [WebAssembly] Handle debug information and virtual registers without crashing
Summary: Currently, enabling debug information when compiling for WebAssembly crashes the backend. This commit fixes these by skipping debug values in backend passes.

Reviewers: jfb, aprantl, dschuff, echristo

Subscribers: mehdi_amini, yurydelendik, dexonsmith, MatzeB, jfb, dschuff, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278967 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-17 20:11:03 +00:00
Tim Shen
172174fbd3 [GraphWriter] Change GraphWriter to use NodeRef in GraphTraits
Summary:
This is part of the "NodeType* -> NodeRef" migration. Notice that since
GraphWriter prints object address as identity, I added a static_assert on
NodeRef to be a pointer type.

Reviewers: dblaikie

Subscribers: llvm-commits, MatzeB

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278966 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-17 20:07:29 +00:00
Matt Arsenault
4da2d32371 AMDGPU: Remove dead option
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278965 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-17 20:07:16 +00:00
Tim Shen
1dca602a37 [GenericDomTree] Change GenericDomTree to use NodeRef in GraphTraits. NFC.
Summary:
Looking at the implementation, GenericDomTree has more specific
requirements on NodeRef, e.g. NodeRefObject->getParent() should compile,
and NodeRef should be a pointer. We can remove the pointer requirement,
but it seems to have little gain, given the limited use cases.

Also changed GraphTraits<Inverse<Inverse<T>> to be more accurate.

Reviewers: dblaikie, chandlerc

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278961 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-17 20:01:58 +00:00
Sanjay Patel
4633e7e9b7 [InstCombine] more clean up of foldICmpXorConstant(); NFCI
Use m_APInt for the xor constant, but this is all still guarded by the initial
ConstantInt check, so no vector types should make it in here.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278957 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-17 19:45:18 +00:00
Sanjay Patel
422136324a [InstCombine] clean up foldICmpXorConstant(); NFCI
1. Change variable names
2. Use local variables to reduce code
3. Early exit to reduce indent



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278955 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-17 19:23:42 +00:00
Marina Yatsina
83260f2394 Fix for PR29010
This is a fix for https://llvm.org/bugs/show_bug.cgi?id=29010
Root cause of the bug is that the register class of the machine instruction operand does not fully reflect if this registers that can be allocated.
Both for i386 and x86_64 the operand's register class is VR128RegClass and thus contains xmm0-xmm15, though in i386 we can only use xmm0-xmm8.
In order to get the actual allocable registers of the class we need to use RegisterClassInfo.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278954 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-17 19:07:40 +00:00