Commit Graph

132541 Commits

Author SHA1 Message Date
Mehdi Amini
f31f603963 IRLinker: fix double scheduling of mapping a global value because of an alias
This test was hitting an assertion in the value mapper because
the IRLinker was trying to map two times @A while materializing
the initializer for @C.

Fix http://llvm.org/PR27850

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270757 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 21:00:44 +00:00
Simon Pilgrim
07cea65abb [X86][AVX2] Regenerate avx2 vector shift tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270756 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 21:00:40 +00:00
Mike Aizatsky
215450cd0e [libfuzzer] replacing unittest for truncate_units with functional test.
Differential Revision: http://reviews.llvm.org/D20641

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270755 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 21:00:17 +00:00
Simon Pilgrim
586141811f Simplify std::all_of/any_of predicates by using llvm::all_of/any_of. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270753 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 20:41:11 +00:00
Zachary Turner
213d3d3c81 [codeview] Move StreamInterface and StreamReader to libcodeview.
We have need to reuse this functionality, including making
additional generic stream types that are smarter about how and
when they copy memory versus referencing the original memory.
So all of these structures belong in the common library
rather than being pdb specific.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270751 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 20:37:03 +00:00
Ahmed Bougacha
c863f71a62 [TLI] Fix NumParams==0 prototype checking typo.
There was a typo in r267758. It caused invalid accesses when
given something like "void @free(...)", as NumParams == 0, and
we then try to look at the 0th parameter.

Turns out, most of these were untested; add both attribute
and missing-prototype checks for all libc libfuncs.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270750 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 20:22:45 +00:00
Simon Pilgrim
aff0925b32 Simplify std::all_of predicate (to one line) by using llvm::all_of. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270749 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 20:17:39 +00:00
Simon Pilgrim
dd13df0ea8 Simplify std::all_of predicate (to one line) by using llvm::all_of. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270747 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 20:13:39 +00:00
Rafael Espindola
6edb5180dd Fix shouldAssumeDSOLocal for private linkage.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270746 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 19:55:16 +00:00
Kostya Serebryany
7dd7cd10c8 [libFuzzer] document the proposed FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270744 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 18:41:53 +00:00
Reid Kleckner
6dc628ff61 [IR] Copy comdats in GlobalObject::copyAttributesFrom
This is probably correct for all uses except cross-module IR linking,
where we need to move the comdat from the source module to the
destination module.

Fixes PR27870.

Reviewers: majnemer

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270743 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 18:36:22 +00:00
Zachary Turner
f50e8cdfbd [llvm-pdbdump] Dump raw stream contents as binary block.
Dumping it as ASCII makes it fairly useless.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270742 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 18:32:07 +00:00
Matt Arsenault
2b7ac01da2 TableGen: Use StringRef instead of std::string
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270741 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 18:07:40 +00:00
Matt Arsenault
2997ae6e3e AMDGPU: Fix v2i64/v2f64 bitcasts
These operations tend to get promoted away to v4i32 so
this doesn't happen often.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270740 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 18:07:36 +00:00
Matt Arsenault
211d1cd5a3 AMDGPU: Fix missing br_cc i1 test coverage
Also un xfail a test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270739 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 17:58:27 +00:00
Chad Rosier
a922e4bd0a [SelectionDAG] Add smarts for BSWAP in computeKnownBits.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270738 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 17:52:38 +00:00
Matt Arsenault
53d233a178 AMDGPU: Make vectorization defeating test changes
Simplifies test updates in the future.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270736 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 17:42:39 +00:00
Davide Italiano
92cd490ebb [PM] CorrelatedValuePropagation: pass state to function. NFCI.
While here, convert the logic of the pass to use static function(s).
This is in preparation for porting this pass to the new PM.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270734 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 17:39:54 +00:00
Matt Arsenault
068cdecac2 AMDGPU: Fix inconsistent lowering of select of vectors
f32 vectors would use a sequence of BFI instructions instead
of unrolled cmp + select. This was better in the case of a VALU
select with SGPR inputs, but we don't have a way of dealing with that
in the DAG.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270731 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 17:34:58 +00:00
Sanjay Patel
cab076f44c [x86] avoid code explosion from LoopVectorizer for gather loop (PR27826)
By making pointer extraction from a vector more expensive in the cost model,
we avoid the vectorization of a loop that is very likely to be memory-bound:
https://llvm.org/bugs/show_bug.cgi?id=27826

There are still bugs related to this, so we may need a more general solution
to avoid vectorizing obviously memory-bound loops when we don't have HW gather
support.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270729 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 17:27:54 +00:00
Xinliang David Li
c863690403 Use new triple API to check if comdat is supported
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270727 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 17:17:51 +00:00
Xinliang David Li
c36e61dacd Add a new helper API in triple /NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270726 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 17:11:31 +00:00
Chris Bieneman
4877ca745f [obj2yaml] [yaml2obj] MachO support for rebase opcodes
This is the first bit of support for MachO __LINKEDIT segment data.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270724 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 17:09:07 +00:00
Chris Bieneman
fdd7755743 [CMake] LINK_LIBS need to be public for Darwin dylib targets
This should actually address PR27855. This results in adding references to the system libs inside generated dylibs so that they get correctly pulled in when linking against the dylib.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270723 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 17:08:43 +00:00
Tim Shen
06c03e5705 Move and add comments to the top for tailcall-string-rvo.ll
Differential Revision: http://reviews.llvm.org/D20311

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270722 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 17:01:09 +00:00
Hal Finkel
637f75559d [SDAG] Add a fallback multiplication expansion
LegalizeIntegerTypes does not have a way to expand multiplications for large
integer types (i.e. larger than twice the native bit width). There's no
standard runtime call to use in that case, and so we'd just assert.

Unfortunately, as it turns out, it is possible to hit this case from
standard-ish C code in rare cases. A particular case a user ran into yesterday
involved an __int128 induction variable and a loop with a quadratic (not
linear) recurrence which triggered some backend logic using SCEVExpander. In
this case, the BinomialCoefficient code in SCEV generates some i129 variables,
which get widened to i256. At a high level, this is not actually good (i.e. the
underlying optimization, PPCLoopPreIncPrep, should not be transforming the loop
in question for performance reasons), but regardless, the backend shouldn't
crash because of cost-modeling issues in the optimizer.

This is a straightforward implementation of the multiplication expansion, based
on the algorithm in Hacker's Delight. I validated it against the code for the
mul256b function from http://locklessinc.com/articles/256bit_arithmetic/ using
random inputs. There should be no functional change for previously-working code
(the new expansion code only replaces an assert).

Fixes PR19797.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270720 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 16:50:22 +00:00
Teresa Johnson
b0f9727d20 [ThinLTO] Fix test check prefix so that intended prefix tested
There aren't any checks with prefix PROMOTE, should be PROMOTE_MOD1
which wasn't being tested (but works as expected).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270719 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 16:45:08 +00:00
Sanjay Patel
efe6410a4b [x86, AVX] allow explicit calls to VZERO* to modify state in VZeroUpperInserter pass (PR27823)
As noted in the review, there are still problems, so this doesn't the bug completely.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270718 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 16:39:47 +00:00
Lang Hames
45400ad477 [RuntimeDyld] Call the SymbolResolver::findSymbolInLogicalDylib method when
searching for external symbols, and fall back to the SymbolResolver::findSymbol
method if the former returns null.

This makes RuntimeDyld behave more like a static linker: Symbol definitions
from within the current module's "logical dylib" will be preferred to
external definitions. We can build on this behavior in the future to properly
support weak symbol handling.

Custom symbol resolvers that override the findSymbolInLogicalDylib method may
notice changes due to this patch. Clients who have not overridden this method
should generally be unaffected, however users of the OrcMCJITReplacement class
may notice changes.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270716 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 16:23:59 +00:00
Chad Rosier
b744845677 Clarify that we match BSwap in InstCombine and BitReverse in CGP. NFC.
Also, rename recognizeBitReverseOrBSwapIdiom to recognizeBSwapOrBitReverseIdiom,
so the ordering of the MatchBSwaps and MatchBitReversals arguments are
consistent with the function name.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270715 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 16:22:14 +00:00
Simon Pilgrim
b05388fe7e [X86][AVX] Sync with clang/test/CodeGen/avx2-builtins.c
Only tests for the gather intrinsic are still to be added

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270710 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 15:30:08 +00:00
Teresa Johnson
32d095cbbc [ThinLTO] Refactor ODR resolution and internalization (NFC)
Move the now index-based ODR resolution and internalization routines out
of ThinLTOCodeGenerator.cpp and into either LTO.cpp (index-based
analysis) or FunctionImport.cpp (index-driven optimizations).
This is to enable usage by other linkers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270698 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 14:03:11 +00:00
Oleg Ranevskyy
d380dee4ce [SCEV] No-wrap flags are not propagated when folding "{S,+,X}+T ==> {S+T,+,X}"
Summary:
**Description**

This makes `WidenIV::widenIVUse` (IndVarSimplify.cpp) fail to widen narrow IV uses in some cases. The latter affects IndVarSimplify which may not eliminate narrow IV's when there actually exists such a possibility, thereby producing ineffective code.

When `WidenIV::widenIVUse` gets a NarrowUse such as `{(-2 + %inc.lcssa),+,1}<nsw><%for.body3>`, it first tries to get a wide recurrence for it via the `getWideRecurrence` call.
`getWideRecurrence` returns recurrence like this: `{(sext i32 (-2 + %inc.lcssa) to i64),+,1}<nsw><%for.body3>`.

Then a wide use operation is generated by `cloneIVUser`. The generated wide use is evaluated to `{(-2 + (sext i32 %inc.lcssa to i64))<nsw>,+,1}<nsw><%for.body3>`, which is different from the `getWideRecurrence` result. `cloneIVUser` sees the difference and returns nullptr.

This patch also fixes the broken LLVM tests by adding missing <nsw> entries introduced by the correction.

**Minimal reproducer:**
```
int foo(int a, int b, int c);
int baz();

void bar()
{
   int arr[20];
   int i = 0;

   for (i = 0; i < 4; ++i)
     arr[i] = baz();

   for (; i < 20; ++i)
     arr[i] = foo(arr[i - 4], arr[i - 3], arr[i - 2]);
}
```

**Clang command line:**
```
clang++ -mllvm -debug -S -emit-llvm -O3 --target=aarch64-linux-elf test.cpp -o test.ir
```

**Expected result:**
The ` -mllvm -debug` log shows that all the IV's for the second `for` loop have been eliminated.

Reviewers: sanjoy

Subscribers: atrick, asl, aemerson, mzolotukhin, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270695 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 13:01:33 +00:00
Renato Golin
0e4502240a [AArch64] Adding a TargetParser for AArch64
There's already a ARMTargetParser,now adding a similar one for aarch64.
so we can use it to do ARCH/CPU/FPU parsing in clang and llvm, instead of
string comparison.

Patch by Jojo Ma.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270687 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 12:02:33 +00:00
Simon Pilgrim
2475758d0c [X86][AVX2] Added more fast-isel tests to match clang/test/CodeGen/avx2-builtins.c
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270685 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 10:56:23 +00:00
Simon Pilgrim
df706b0baf [X86][AVX2] Begun adding fast-isel tests to match clang/test/CodeGen/avx2-builtins.c
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270683 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 10:15:06 +00:00
Simon Pilgrim
5c780f78b4 [X86][SSE2] Use storeu intrinsics for _mm_storeu_pd/_mm_storeu_pd tests
Also fixed name of _mm_store1_pd test

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270681 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 09:42:29 +00:00
Simon Pilgrim
88c2d3172d [X86][SSE] Use storeu intrinsics for _mm_storeu_ps test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270680 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 09:28:06 +00:00
Simon Pilgrim
e3a40ed873 [X86][SSE] Replace (V)CVTDQ2PD(Y) and (V)CVTPS2PD(Y) lossless conversion intrinsics with generic IR
Followup to D20528 clang patch, this removes the (V)CVTDQ2PD(Y) and (V)CVTPS2PD(Y) llvm intrinsics and auto-upgrades to sitofp/fpext instead.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270678 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 08:59:18 +00:00
Craig Topper
c333e16d8d [X86] Remove the llvm.x86.sse2.storel.dq intrinsic. It hasn't been used in a long time.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270677 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 06:56:32 +00:00
Gerolf Hoflehner
c0849111ec [Support] Reapply cleanup r270643
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270674 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 06:23:45 +00:00
David Majnemer
1f13752cbe [FunctionAttrs] Volatile loads should disable readonly
A volatile load has side effects beyond what callers expect readonly to
signify.  For example, it is not safe to reorder two function calls
which each perform a volatile load to the same memory location.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270671 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 05:53:04 +00:00
Gerolf Hoflehner
9f618c8791 [Support] revert previous commit r270643
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270670 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 05:51:05 +00:00
Zachary Turner
4f4018ce2c [llvm-pdbdump] Decipher the remaining PDB streams.
We know at least know the meaning of every stream of the
PDB file.  Yay!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270669 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 05:49:48 +00:00
Saleem Abdulrasool
9c894139a0 Revert "llvm-objdump: support dumping AUX records for weak externals"
Revert it until we can figure out the endianness issue.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270667 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 05:45:02 +00:00
Saleem Abdulrasool
9ccf7c7a19 Object: ensure that structures are fully defined
Ensure that the unused fields are explicitly stated when defining the types.
Add some compile time assertions about the size requirements for the structure
types.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270663 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 05:23:02 +00:00
Zachary Turner
fbbe74464a [llvm-pdbdump] Dump the IPI stream and all records.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270661 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 04:35:22 +00:00
Rui Ueyama
ad878ffd0d pdbdump: fix bug in name hash table.
name_ids() did not return all IDs but only the first NameCount items.
The number of non-zero entries in IDs vector is NameCount, but it
does not mean that all non-zero entries are at the beginning of IDs
vector.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270656 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 04:07:17 +00:00
Zachary Turner
3b27e60206 [llvm-pdbdump] Stream 0 isn't actually the MSF superblock.
Oddly enough, I realized we don't actually know what stream
0 is (if anything).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270655 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 03:53:16 +00:00
Saleem Abdulrasool
6e695e846d test: use a binary file instead
Generate the obj rather than use yaml2obj.  Hopefully, this fixes the PPC64 test
failures.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270654 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 03:48:07 +00:00