136620 Commits

Author SHA1 Message Date
Piotr Padlewski
e70f4f796e Changed sign of LastCallToStaticBouns
Summary:
I think it is much better this way.
When I firstly saw line:
  Cost += InlineConstants::LastCallToStaticBonus;
I though that this is a bug, because everywhere where the cost is being reduced
it is usuing -=.

Reviewers: eraman, tejohnson, mehdi_amini

Subscribers: llvm-commits, mehdi_amini

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278290 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 21:15:22 +00:00
Kyle Butt
0d1c7a1bea Codegen: Don't tail-duplicate blocks with un-analyzable fallthrough.
If AnalyzeBranch can't analyze a block and it is possible to
fallthrough, then duplicating the block doesn't make sense, as only one
block can be the layout predecessor for the un-analyzable fallthrough.

Submitted wit a test case, but NOTE: the test case doesn't currently
fail. However, the test case fails with D20505 and would have saved me
some time debugging.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278288 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 21:03:27 +00:00
Kyle Butt
3da1bfb213 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.

Fixed a regression in the original commit. Need to un-reverse branches after
reversing them, or other conversions go awry.

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@278287 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 20:45:56 +00:00
Reid Kleckner
de2cc1c7a0 Disable sancov tests failing due to apparent endianness issues
Undoes some of the effect of r278271

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278285 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 20:11:35 +00:00
Reid Kleckner
455668a91c [sancov] Port sancov -print-coverage-pcs to COFF
The export table is not considered part of the object file symbol table,
so we have to look through it separately.

Reviewers: kcc

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278284 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 20:08:19 +00:00
Jonathan Roelofs
9715a2d267 Fix UB in APInt::ashr
i64 -1, whose sign bit is the 0th one, can't be left shifted without invoking UB.

https://reviews.llvm.org/D23362


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278280 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 19:50:14 +00:00
Matt Arsenault
7616e5d399 AMDGPU: s_setpc_b64 should be an indirect branch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278278 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 19:20:02 +00:00
Matt Arsenault
a9d5cfbb5d AMDGPU: Set sizes on control flow pseudos
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278276 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 19:11:51 +00:00
Matt Arsenault
054b698c76 AMDGPU: Remove empty file comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278275 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 19:11:48 +00:00
Matt Arsenault
0576028ed1 AMDGPU: Remove unnecessary cast
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278274 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 19:11:45 +00:00
Matt Arsenault
34c6b123f7 AMDGPU: Change insertion point of si_mask_branch
Insert before the skip branch if one is created.
This is a somewhat more natural placement relative
to the skip branches, and makes it possible to implement
analyzeBranch for skip blocks.

The test changes are mostly due to a quirk where
the block label is not emitted if there is a terminator
that is not also a branch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278273 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 19:11:42 +00:00
Matt Arsenault
898f0e0994 AMDGPU: Use CreateStackObject instead of CreateSpillStackObject
I'm not sure what the difference is, but no other target
uses this for emergency spill slots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278272 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 19:11:36 +00:00
Reid Kleckner
d3396f4e90 [sancov] Run more sancov tests on non-x86-Linux machines
Add the $arch-registered-target features that clang uses to disable
tests that require a registered backend, so that we can run the sancov
tests on Windows. LLVM's lit suite did not appear to have a per-test way
to do this, and I would rather not split up the sancov tests into
architecture directories.

Split out of https://reviews.llvm.org/D23321

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278271 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 19:03:18 +00:00
Sanjay Patel
944f96975b [x86, AVX] allow FP vector select folding to bitwise logic ops (PR28895)
This handles the case in:
https://llvm.org/bugs/show_bug.cgi?id=28895

...but we are not getting all of the possibilities yet. 
Eg, we use 'X86::FANDN' for scalar FP select combines.

That enhancement is filed as:
https://llvm.org/bugs/show_bug.cgi?id=28925

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278270 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 19:00:11 +00:00
Andrew Kaylor
9c0625fb5a [IndVarSimplify] Eliminate zext of a signed IV when the IV is known to be non-negative
Patch by Li Huang

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278269 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 18:56:35 +00:00
Nicolai Haehnle
be7124c9bf LiveIntervalAnalysis: fix a crash in repairOldRegInRange
Summary:
See the new test case for one that was (non-deterministically) crashing
on trunk and deterministically hit the assertion that I added in D23302.
Basically, the machine function contains a sequence

     DS_WRITE_B32 %vreg4, %vreg14:sub0, ...
     DS_WRITE_B32 %vreg4, %vreg14:sub0, ...
     %vreg14:sub1<def> = COPY %vreg14:sub0

and SILoadStoreOptimizer::mergeWrite2Pair merges the two DS_WRITE_B32
instructions into one before calling repairIntervalsInRange.

Now repairIntervalsInRange wants to repair %vreg14, in particular, and
ends up trying to repair %vreg14:sub1 as well, but that only becomes
active _after_ the range that is to be repaired, hence the crash due
to LR.find(...) == LR.begin() at the start of repairOldRegInRange.

I believe that just skipping those subrange is fine, but again, not too
familiar with that code.

Reviewers: MatzeB, kparzysz, tstellarAMD

Subscribers: llvm-commits, MatzeB

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278268 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 18:51:14 +00:00
Andrew Kaylor
72626e148e [ValueTracking] An improvement to IR ValueTracking on Non-negative Integers
Patch by Li Huang

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278267 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 18:47:19 +00:00
Krzysztof Parzyszek
089ce6a3f8 [Hexagon] Remove unused variants of LO/HI instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278266 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 18:40:36 +00:00
Kyle Butt
c04b985f53 Codegen: Tail Merge: Be less aggressive with special cases.
This change makes it possible for tail-duplication and tail-merging to
be disjoint. By being less aggressive when merging during layout, there are no
overlapping cases between tail-duplication and tail-merging, provided the
thresholds are disjoint.

There is a remaining TODO to benchmark the succ_size() test for non-layout tail
merging.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278265 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 18:36:18 +00:00
Simon Pilgrim
4425f12c5d [X86][SSE] Dropped blend(insertps(x,y),zero) combine - this is now handled by target shuffle chain combining
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278260 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 18:10:29 +00:00
Tim Shen
bb35e9017a [ADT] Removed synthesized constructor introduced in r278251, since MSVC doesn't support them
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278259 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 18:08:38 +00:00
Matthias Braun
5ae015ef3f TargetOpcodes: Rewrite the documentation for SUBREG_TO_REG
Differential Revision: https://reviews.llvm.org/D22708

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278258 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 18:05:50 +00:00
Krzysztof Parzyszek
30725941e1 [Hexagon] Simplify the SplitConst32/64 pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278256 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 18:05:47 +00:00
Krzysztof Parzyszek
570eecd0be [Hexagon] Add extra patterns for single-precision min/max instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278252 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 17:56:24 +00:00
Tim Shen
d8f586869a [ADT] Add make_scope_exit().
Summary: make_scope_exit() is described in C++ proposal p0052r2, which uses RAII to do cleanup works at scope exit.

Reviewers: chandlerc

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278251 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 17:52:09 +00:00
Rong Xu
9a1106c09e Fix LCSSA increased compile time
We are seeing r276077 drastically increasing compiler time for our larger
benchmarks in PGO profile generation build (both clang based and IR based
mode) -- it can be 20x slower than without the patch (like from 30 secs to
780 secs)

The increased time are all in pass LCSSA. The problematic code is about
PostProcessPHIs after use-rewrite. Note that the InsertedPhis from ssa_updater
is accumulating (never been cleared). Since the inserted PHIs are added to the
candidate for each rewrite, The earlier ones will be repeatedly added. Later
when adding the new PHIs to the work-list, we don't check the duplication
either. This can result in extremely long work-list that containing tons of
duplicated PHIs.

This patch fixes the issue by hoisting the code out of the loop.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278250 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 17:49:11 +00:00
Krzysztof Parzyszek
c047ae7294 [Hexagon] Fix table-gen decode conflict warnings for CONST32/64
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278247 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 17:22:24 +00:00
Tim Northover
d5551e6253 GlobalISel: fixup copy/paste comment error
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278246 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 16:51:18 +00:00
Tim Northover
6b89c9016c GlobalISel: avoid inserting redundant COPYs for bitcasts.
If the value produced by the bitcast hasn't been referenced yet, we can simply
reuse the input register avoiding an unnecessary COPY instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278245 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 16:51:14 +00:00
Krzysztof Parzyszek
3b54bd1701 [Hexagon] Use integer instructions for floating point immediates
Floating point instructions use general purpose registers, so the few
instructions that can put floating point immediates into registers are,
in fact, integer instruction. Use them explicitly instead of having
pseudo-instructions specifically for dealing with floating point values.

Simplify the constant loading instructions (from sdata) to have only two:
one for 32-bit values and one for 64-bit values: CONST32 and CONST64.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278244 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 16:46:36 +00:00
Gor Nishanov
bd0032e1a2 [Coroutines] Part 6: Elide dynamic allocation of a coroutine frame when possible
Summary:
A particular coroutine usage pattern, where a coroutine is created, manipulated and
destroyed by the same calling function, is common for coroutines implementing
RAII idiom and is suitable for allocation elision optimization which avoid
dynamic allocation by storing the coroutine frame as a static `alloca` in its
caller.

coro.free and coro.alloc intrinsics are used to indicate which code needs to be suppressed
when dynamic allocation elision happens:
```
entry:
  %elide = call i8* @llvm.coro.alloc()
  %need.dyn.alloc = icmp ne i8* %elide, null
  br i1 %need.dyn.alloc, label %coro.begin, label %dyn.alloc
dyn.alloc:
  %alloc = call i8* @CustomAlloc(i32 4)
  br label %coro.begin
coro.begin:
  %phi = phi i8* [ %elide, %entry ], [ %alloc, %dyn.alloc ]
  %hdl = call i8* @llvm.coro.begin(i8* %phi, i32 0, i8* null,
                          i8* bitcast ([2 x void (%f.frame*)*]* @f.resumers to i8*))
```
and
```
  %mem = call i8* @llvm.coro.free(i8* %hdl)
  %need.dyn.free = icmp ne i8* %mem, null
  br i1 %need.dyn.free, label %dyn.free, label %if.end
dyn.free:
  call void @CustomFree(i8* %mem)
  br label %if.end
if.end:
  ...
```

If heap allocation elision is performed, we replace coro.alloc with a static alloca on the caller frame and coro.free with null constant.

Also, we need to make sure that if there are any tail calls referencing the coroutine frame, we need to remote tail call attribute, since now coroutine frame lives on the stack.

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. (https://reviews.llvm.org/D23234)
6.Add coroutine heap elision + tests.  <= we are here
7.Add the rest of the logic (split into more patches)

Reviewers: mehdi_amini, majnemer

Subscribers: mehdi_amini, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278242 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 16:40:39 +00:00
Roger Ferrer Ibanez
9cba8e90cb Fix build break of VS 2013 debug builds
In debug mode extra macros are enabled for several C++ algorithms. Some of them
may cause unfortunate build failures.

This commit adds a redundant operator() to work around one of those troublesome
macros which was hit accidentally by change r278012.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278241 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 16:39:58 +00:00
Krzysztof Parzyszek
94826b887e [Hexagon] Delete HexagonSelectCCInfo.td
This file is not used. The location assignment of call arguments and
return values is implemented directly in HexagonISelLowering.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278237 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 16:23:53 +00:00
Krzysztof Parzyszek
e9a09933ef [Hexagon] Remove unneeded/unused ISD opcodes ARGEXTEND and FCONST32
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278236 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 16:20:33 +00:00
Simon Pilgrim
c038ba915e [X86][XOP] Tweak vpermil2pd test to stop it being combined away
The target shuffle combined to a BLENDPD pattern which we will shortly add support for.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278233 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 15:15:56 +00:00
Simon Pilgrim
de70ff26c5 [X86][SSE] Regenerate vector shift lowering tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278232 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 15:13:49 +00:00
Artur Pilipenko
72349b2cb4 [LVI] Handle conditions in the form of (cond1 && cond2)
Teach LVI how to gather information from conditions in the form of (cond1 && cond2). Our out-of-tree front-end emits range checks in this form.

Reviewed By: sanjoy

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278231 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 15:13:15 +00:00
Sanjay Patel
680006e111 use different comparison predicates for better test coverage
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278229 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 15:06:11 +00:00
Simon Pilgrim
6e8b851f49 [X86][SSE] Add support for combining target shuffles to MOVSS/MOVSD
Only do this on pre-SSE41 targets where we should be lowering to BLENDPS/BLENDPD instead

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278228 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 14:15:41 +00:00
Artur Pilipenko
ce8c9131e7 Add a test case for r278217 "[LVI] Relax the assertion about LVILatticeVal type in getConstantRange"
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278226 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 13:51:01 +00:00
Artur Pilipenko
5e9462a7b6 [LVI] NFC. Make getValueFromCondition return LVILatticeValue instead of changing reference argument
Instead of returning bool and setting LVILatticeValue reference argument return LVILattice value. Use overdefined value to denote the case when we didn't gather any information from the condition.

This change was separated from the review "[LVI] Handle conditions in the form of (cond1 && cond2)" (https://reviews.llvm.org/D23200#inline-199531). Once getValueFromCondition returns LVILatticeValue we can cache the result in Visited map.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278224 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 13:38:07 +00:00
Artur Pilipenko
f7b62433e7 Teach CorrelatedValuePropagation to mark adds as no wrap
This is a resubmission of previously reverted r277592. It was hitting overly strong assertion in getConstantRange which was relaxed in r278217.

Use LVI to prove that adds do not wrap. The change is motivated by https://llvm.org/bugs/show_bug.cgi?id=28620 bug and it's the first step to fix that problem.

Reviewed By: sanjoy

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278220 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 13:08:34 +00:00
Simon Pilgrim
607fac7557 [X86][SSE] Only treat SM_SentinelUndef as UNDEF in shuffle mask predicates
isUndefOrEqual and isUndefOrInRange treated all -ve shuffle mask values as UNDEF, now it has to be SM_SentinelUndef (-1)

We already have asserts to check that lowered SHUFFLE_VECTOR indices are in the range -1 <= index < 2*masksize (or masksize for unary shuffles)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278218 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 12:55:25 +00:00
Artur Pilipenko
06ab33e54f [LVI] Relax the assertion about LVILatticeVal type in getConstantRange
The problem was triggered by my recent change in CVP (D23059). Current code expected that integer constants are represented by constantrange LVILatticeVal and never represented as LVILatticeVal with constant tag. That is true for ConstantInt constants, although ConstantExpr integer type constants are legally represented as constant LVILatticeVal.

This code fails with CVP change in:

@b = global i32 0, align 4
define void @test6(i32 %a) {
bb:
  %add = add i32 %a, ptrtoint (i32* @b to i32)
  ret void
}
Currently getConstantRange code is not executed by any of the upstream passes. I'm going to add a test case to test/Transforms/CorrelatedValuePropagation/add.ll once I resubmit the CVP change.

Reviewed By: sanjoy

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278217 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 12:54:54 +00:00
Simon Pilgrim
a223dd9a87 [X86][SSE] Reorder shuffle mask undef helper predicates. NFCI
To make it easier for a more complex helper to use a simpler one

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278216 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 12:34:23 +00:00
Simon Pilgrim
3206f9ec24 [X86][SSE] Regenerate SSE1 tests
Properly demonstrate the nasty codegen we get for vselect without integer vectors

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278215 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 12:26:40 +00:00
Simon Pilgrim
2fe15082de Regenerate test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278214 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 12:24:19 +00:00
Simon Pilgrim
d8d5e79555 [DAGCombine] Avoid INSERT_SUBVECTOR reinsertions (PR28678)
If the input vector to INSERT_SUBVECTOR is another INSERT_SUBVECTOR, and this inserted subvector replaces the last insertion, then insert into the common source vector.

i.e. 
INSERT_SUBVECTOR( INSERT_SUBVECTOR( Vec, SubOld, Idx ), SubNew, Idx ) --> INSERT_SUBVECTOR( Vec, SubNew, Idx )

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278211 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 10:50:53 +00:00
Sam Parker
822ef54156 [ARM] Improve sxta{b|h} and uxta{b|h} tests
Created a Thumb2 predicated pattern matcher that uses Thumb2 and
HasT2ExtractPack and used it to redefine the patterns for sxta{b|h}
and uxta{b|h}. Also used the similar patterns to fill in isel pattern
gaps for the corresponding instructions in the ARM backend.
The patch is mainly changes to tests since most of this functionality
appears not to have been tested.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278207 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 09:34:34 +00:00
Chandler Carruth
430591fd27 [x86] Fix a bug in the auto-upgrade from r276416 where we failed to give
a sufficiently low alignment for the IR load created.

There is no test case because we don't have any test cases for the *IR*
produced by the autoupgrade, only the x86 assembly, and it happens that
the x86 assembly for this intrinsic as it is tested in the autoupgrade
path just happens to not produce a separate load instruction where we
might have observed the alignment.

I'm going to follow up on the original commit to suggest getting
IR-level testing in addition to the asm level testing here so that we
can see and test these kinds of issues. We might never get an x86
instruction out with an alignment constraint, but we could stil
miscompile code by folding against the alignment marked on (or inferred
for in this case) the load.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278203 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 07:41:26 +00:00