136620 Commits

Author SHA1 Message Date
Davide Italiano
87b8240c77 [SimplifyLibCalls] Emit sqrt intrinsic instead of a libcall.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277972 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-08 03:23:01 +00:00
Eli Friedman
0ba29b6226 [SROA] Fix crash with lifetime intrinsic partially covering alloca.
Summary:
PromoteMemToReg looks specifically for the pattern
bitcast+lifetime.start (or a bitcast-equivalent GEP); any offset
will lead to an assertion failure.

Fixes https://llvm.org/bugs/show_bug.cgi?id=27999 .

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277969 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-08 01:30:53 +00:00
Craig Topper
44aa10251f [AVX-512] Improve lowering of inserting a single element into lowest element of a 512-bit vector of zeroes by using vmovq/vmovd/vmovss/vmovsd.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277965 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-07 21:52:59 +00:00
Davide Italiano
c850b51cca [SLC] Emit an intrinsic instead of a libcall for pow.
Differential Revision:  https://reviews.llvm.org/D22104


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277963 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-07 20:27:03 +00:00
Nico Weber
29b5c03449 Revert r277905, it caused PR28894
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277962 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-07 20:18:04 +00:00
Craig Topper
1a28a7107c [AVX-512] Add 512-bit logical operations to load folding tables. Add avx512f stack folding test and move some tests from the avx512vl test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277961 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-07 17:14:09 +00:00
Craig Topper
778de48b67 [AVX-512] Add EVEX encoded floating point MAX/MIN instructions to the load folding tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277960 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-07 17:14:05 +00:00
Simon Pilgrim
1223b84c30 [X86] lowerVectorShuffle - ensure that undefined mask elements only use SM_SentinelUndef
Help lowering and combining (which can specify SM_SentinelZero mask elements) share more shuffle matching code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277959 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-07 15:29:12 +00:00
Elena Demikhovsky
661baf2e45 AVX-512: Changed lowering of BITCAST between i1 vectors and i8/i16/i32 integer values
Optimized lowering of BITCAST node. The BITCAST node can be replaced with COPY_TO_REG instead of KMOV.
It allows to suppress two opposite BITCAST operations and avoid redundant "movs".

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277958 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-07 13:05:58 +00:00
Simon Pilgrim
751a136b07 [X86][AVX512BW] Add sext/zext AVX512BW 512-bit vector tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277957 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-07 12:41:36 +00:00
Simon Pilgrim
edf4139052 [X86][AVX512] Add sext/zext to 512-bit vector tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277956 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-07 12:10:46 +00:00
Elena Demikhovsky
8e5323525c AVX-512: Added a test for cmp intrinsics
This is a new test that should explore a current suboptimal sequence in passing values between cmp and kor intrinsics.
The code will be optimized in an upcoming patch.

Submitted bug here:
https://llvm.org/bugs/show_bug.cgi?id=28839



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277954 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-07 09:29:34 +00:00
David Majnemer
7428509ec4 [InstSimplify] Fold gep (gep V, C), (sub 0, V) to C
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277952 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-07 07:58:12 +00:00
David Majnemer
2a07d9fdb3 [InstSimplify] Try hard to simplify pointer comparisons
Simplify ptrtoint comparisons involving operands with different source
types.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277951 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-07 07:58:10 +00:00
David Majnemer
0c8a3440d6 [InstCombine] Infer inbounds on geps of allocas
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277950 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-07 07:58:00 +00:00
Craig Topper
facbf764c7 [X86] Add commutable floating point max/min instructions to the load folding tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277949 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-07 05:39:51 +00:00
Craig Topper
1048e17a4a [AVX-512] Add andnps/andnpd to the avx512vl stack folding test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277948 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-07 05:39:48 +00:00
Craig Topper
8b055891ad [X86] Simplify a shuffle mask copy. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277947 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-07 05:39:46 +00:00
Michael Zolotukhin
0f98731ce6 Revert "Revert "[LoopSimplify] Fix updating LCSSA after separating nested loops.""
This reverts commit r277901. Reaaply the commit as it looks like it has
nothing to do with the bots failures.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277946 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-07 01:56:54 +00:00
Lang Hames
5a98b5874c [ExecutionEngine][RuntimeDyld] Move JITSymbol from ExecutionEngine to RuntimeDyld.
JITSymbol really belongs in RuntimeDyld. This should fix the llvm-rtdyld link
failures caused by r277943.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277945 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-07 01:19:37 +00:00
Lang Hames
5ca8eaf661 [RuntimeDyld] Remove symbol that is unused as of r277943.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277944 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-07 01:12:44 +00:00
Lang Hames
fdf5e1ee1e [RuntimeDyld] Replace manual flag checks with JITSymbolFlags::fromObjectSymbol.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277943 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-07 00:18:14 +00:00
Lang Hames
9350f3619a [ORC] Re-apply r277896, removing bogus triples and datalayouts that broke tests
on linux last time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277942 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 22:36:26 +00:00
Kostya Serebryany
3aa06bae18 [libFuzzer] make libFuzzer work with a bit older clang versions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277941 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 21:28:56 +00:00
Kostya Serebryany
1efe1f7b69 [libFuzzer] don't print bogus error message
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277940 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 21:23:29 +00:00
Simon Pilgrim
2e5c533f85 [X86][AVX2] Improve sign/zero extension on AVX2 targets
Split extensions to large vectors into 256-bit chunks - the equivalent of what we do with pre-AVX2 into 128-bit chunks

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277939 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 21:21:12 +00:00
Gor Nishanov
303ae673f8 CoroSplit: Squash unused variable FnTrigger warning in NDEBUG
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277938 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 21:11:10 +00:00
Gor Nishanov
1a066c4582 [Coroutines] Passify the build bots. Remove restart-trigger.ll test for now
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277937 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 21:01:22 +00:00
Gor Nishanov
2007f371f4 [Coroutines] Part 5: Add CGSCC restart trigger
Summary:
CoroSplit pass processes the coroutine twice. First, it lets it go through
complete IPO optimization pipeline as a single function. It forces restart
of the pipeline by inserting an indirect call to an empty function "coro.devirt.trigger"
which is devirtualized by CoroElide pass that triggers a restart of the pipeline by CGPassManager.
(In later patches, when CoroSplit pass sees the same coroutine the second time, it splits it up,
adds coroutine subfunctions to the SCC to be processed by IPO pipeline.)

Documentation and overview is here: http://llvm.org/docs/Coroutines.html.

Upstreaming sequence (rough plan)
1.Add documentation. (https://reviews.llvm.org/D22603)
2.Add coroutine intrinsics. (https://reviews.llvm.org/D22659)
3.Add empty coroutine passes. (https://reviews.llvm.org/D22847)
4.Add coroutine devirtualization + tests.
ab) Lower coro.resume and coro.destroy (https://reviews.llvm.org/D22998)
c) Do devirtualization (https://reviews.llvm.org/D23229)
5.Add CGSCC restart trigger + tests. <= we are here
6.Add coroutine heap elision + tests.
7.Add the rest of the logic (split into more patches)

Reviewers: mehdi_amini, majnemer

Subscribers: llvm-commits, mehdi_amini

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277936 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 20:44:39 +00:00
Craig Topper
6bb60d226f [AVX-512] Add SQRT/RCP14/RNDSCALE to hasUndefRegUpdate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277934 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 19:31:52 +00:00
Craig Topper
7c9196ad13 [AVX-512] Add AVX-512 scalar CVT instructions to hasUndefRegUpdate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277933 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 19:31:50 +00:00
Craig Topper
3fe381ac49 [AVX-512] Add AVX512 run line to a test and re-generate the checks. Future commits will refine some of the sequences.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277932 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 19:31:47 +00:00
Craig Topper
372fbdfd41 [X86] Add VRCPSSr_Int, VRSQRTSSr_Int, VSQRTSSr_Int, and VSQRTSDr_Int to hasUndefRegUpdate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277931 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 19:31:44 +00:00
Simon Pilgrim
39e5fc9030 [X86][SSE] Enable commutation between MOVHLPS and UNPCKHPD
Assuming SSE2 is available then we can safely commute between these, removing some unnecessary register moves and improving memory folding opportunities.

VEX encoded versions don't benefit so I haven't added support to them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277930 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 18:40:28 +00:00
Mike Aizatsky
7e8350b8b7 [libfuzzer] do not warn about missing pcbuffer functions: they are new.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277927 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 17:03:22 +00:00
Simon Pilgrim
5cd13243bb [X86][SSE] Regenerate SSE1 shuffle tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277925 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 13:46:09 +00:00
Benjamin Kramer
599a666215 [ARM] Don't copy MCInsts in loop. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277924 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 12:58:24 +00:00
Benjamin Kramer
a44f29cdc4 [Inliner] Use function_ref for functors which are never taken ownership of.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277922 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 12:33:46 +00:00
Benjamin Kramer
fb0b339283 [LoadCombine] Simplify code with a brace init. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277921 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 12:11:11 +00:00
Simon Pilgrim
0f888a7ccd [X86][SSE] Add 2 input shuffle support to matchBinaryVectorShuffle
Not actually used yet...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277919 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 11:22:39 +00:00
Benjamin Kramer
284030ab2c Move helpers into anonymous namespaces. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277916 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 11:13:10 +00:00
David Majnemer
bc3aa5c56b [CodeGen] Fix a -Wdocumentation warning
A parameter was documented with the wrong name.
No functionality change is intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277915 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 08:37:12 +00:00
David Majnemer
2982845bcc [ValueTracking] Teach computeKnownBits about [su]min/max
Reasoning about a select in terms of a min or max allows us to derive a
tigher bound on the result.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277914 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 08:16:00 +00:00
David Majnemer
470962f413 [CallGraphSCCPass] Use an ArrayRef instead of a pair of iterators
No functional change is intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277913 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 06:21:02 +00:00
Chandler Carruth
8682b372bb [ADT] Make the triple test 1000x faster through more focused test cases.
The current approach isn't a long-term viable pattern. Given the set of
architectures A, vendors V, operating systems O, and environments E, it
does |A| * |V| * |O| * |E| * 4! tests. As LLVM grows, this test keeps
getting slower, despite my working very hard to make it get some
"optimizations" even in -O0 builds in order to lower the constant
factors. Fundamentally, we're doing an unreasonable amount of work.i

Looking at the specific thing being tested -- the goal seems very
clearly to be testing the *permutations*, not the *combinations*. The
combinations are driving up the complexity much more than anything else.

Instead, test every possible value for a given triple entry in every
permutation of *some* triple. This really seems to cover the core goal
of the test. Every single possible triple component is tested in every
position. But because we keep the rest of the triple constant, it does
so in a dramatically more scalable amount of time. With this model we do
(|A| + |V| + |O| + |E|) * 4! tests.

For me on a debug build, this goes from running for 19 seconds to 19
milliseconds, or a 1000x improvement. This makes a world of difference
for the critical path of 'ninja check-llvm' and other extremely common
workflows.

Thanks to Renato, Dean, and David for the helpful review comments and
helping me refine the explanation of the change.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277912 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 06:00:50 +00:00
Sanjoy Das
9da24c7e7f [InstCombine] Don't coerce non-integral pointers to integers
Reviewers: majnemer

Subscribers: mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277910 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 02:58:48 +00:00
Matthias Braun
3f4f33680b Revert "(refs/bisect/bad) GVN-hoist: enable by default"
GVN-Hoist appears to miscompile llvm-testsuite
SingleSource/Benchmarks/Misc/fbench.c at the moment.

I filed http://llvm.org/PR28880

This reverts commit r277786.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277909 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 02:23:15 +00:00
Gor Nishanov
fa2883261f Part 4c: Coroutine Devirtualization: Devirtualize coro.resume and coro.destroy.
Summary:
This is the 4c patch of the coroutine series. CoroElide pass now checks if PostSplit coro.begin
is referenced by coro.subfn.addr intrinsics. If so replace coro.subfn.addrs with an appropriate coroutine
subfunction associated with that coro.begin.

Documentation and overview is here: http://llvm.org/docs/Coroutines.html.

Upstreaming sequence (rough plan)
1.Add documentation. (https://reviews.llvm.org/D22603)
2.Add coroutine intrinsics. (https://reviews.llvm.org/D22659)
3.Add empty coroutine passes. (https://reviews.llvm.org/D22847)
4.Add coroutine devirtualization + tests.
ab) Lower coro.resume and coro.destroy (https://reviews.llvm.org/D22998)
c) Do devirtualization <= we are here
5.Add CGSCC restart trigger + tests.
6.Add coroutine heap elision + tests.
7.Add the rest of the logic (split into more patches)

Reviewers: majnemer

Subscribers: mehdi_amini, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277908 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 02:16:35 +00:00
Nico Weber
84f6a48c0d Revert r277896.
It breaks ExecutionEngine/OrcLazy/weak-function.ll on most bots.

Script:
--
...
--
Exit Code: 1

Command Output (stderr):
--
Could not find main function.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277907 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 02:00:45 +00:00
Kyle Butt
d9a9f7d3ac CodeGen: If Convert blocks that would form a diamond when tail-merged.
The following function currently relies on tail-merging for if
conversion to succeed. The common tail of cond_true and cond_false is
extracted, and this then forms a diamond pattern that can be
successfully if converted.

If this block does not get extracted, either because tail-merging is
disabled or the threshold is higher, we should still recognize this
pattern and if-convert it.
define i32 @t2(i32 %a, i32 %b) nounwind {
entry:
	%tmp1434 = icmp eq i32 %a, %b		; <i1> [#uses=1]
	br i1 %tmp1434, label %bb17, label %bb.outer

bb.outer:		; preds = %cond_false, %entry
	%b_addr.021.0.ph = phi i32 [ %b, %entry ], [ %tmp10, %cond_false ]
	%a_addr.026.0.ph = phi i32 [ %a, %entry ], [ %a_addr.026.0, %cond_false ]
	br label %bb

bb:		; preds = %cond_true, %bb.outer
	%indvar = phi i32 [ 0, %bb.outer ], [ %indvar.next, %cond_true ]
	%tmp. = sub i32 0, %b_addr.021.0.ph
	%tmp.40 = mul i32 %indvar, %tmp.
	%a_addr.026.0 = add i32 %tmp.40, %a_addr.026.0.ph
	%tmp3 = icmp sgt i32 %a_addr.026.0, %b_addr.021.0.ph
	br i1 %tmp3, label %cond_true, label %cond_false

cond_true:		; preds = %bb
	%tmp7 = sub i32 %a_addr.026.0, %b_addr.021.0.ph
	%tmp1437 = icmp eq i32 %tmp7, %b_addr.021.0.ph
	%indvar.next = add i32 %indvar, 1
	br i1 %tmp1437, label %bb17, label %bb

cond_false:		; preds = %bb
	%tmp10 = sub i32 %b_addr.021.0.ph, %a_addr.026.0
	%tmp14 = icmp eq i32 %a_addr.026.0, %tmp10
	br i1 %tmp14, label %bb17, label %bb.outer

bb17:		; preds = %cond_false, %cond_true, %entry
	%a_addr.026.1 = phi i32 [ %a, %entry ], [ %tmp7, %cond_true ], [ %a_addr.026.0, %cond_false ]
	ret i32 %a_addr.026.1
}

Without tail-merging or diamond-tail if conversion:
LBB1_1:                                 @ %bb
                                        @ =>This Inner Loop Header: Depth=1
        cmp     r0, r1
        ble     LBB1_3
@ BB#2:                                 @ %cond_true
                                        @   in Loop: Header=BB1_1 Depth=1
        subs    r0, r0, r1
        cmp     r1, r0
        it      ne
        cmpne   r0, r1
        bgt     LBB1_4
LBB1_3:                                 @ %cond_false
                                        @   in Loop: Header=BB1_1 Depth=1
        subs    r1, r1, r0
        cmp     r1, r0
        bne     LBB1_1
LBB1_4:                                 @ %bb17
        bx      lr

With diamond-tail if conversion, but without tail-merging:
@ BB#0:                                 @ %entry
        cmp     r0, r1
        it      eq
        bxeq    lr
LBB1_1:                                 @ %bb
                                        @ =>This Inner Loop Header: Depth=1
        cmp     r0, r1
        ite     le
        suble   r1, r1, r0
        subgt   r0, r0, r1
        cmp     r1, r0
        bne     LBB1_1
@ BB#2:                                 @ %bb17
        bx      lr

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277905 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 01:52:37 +00:00