43921 Commits

Author SHA1 Message Date
Sanjay Patel
e20330959b add/move codegen tests for and/or of setcc; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299396 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-03 22:45:46 +00:00
Zvi Rackover
07d42b869d InstSimplify: Add a hook for shufflevector
Summary:
Add a hook for simplification of shufflevector's with the following rules:
- Constant folding - NFC, as it was already being done by the default handler.
-  If only one of the operands is constant, constant fold the shuffle if the
    mask does not select elements from the variable operand -  to show the hook is firing and affecting the test-cases.

Reviewers: RKSimon, craig.topper, spatel, sanjoy, nlopes, majnemer

Reviewed By: spatel

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299393 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-03 22:05:30 +00:00
Weiming Zhao
c4d3801c20 Reland r298901 with modifications (reverted in r298932)
Dont emit Mapping symbols for sections that contain only data.

Summary:
Dont emit mapping symbols for sections that contain only data.

Reviewers: rengolin, weimingz, kparzysz, t.p.northover, peter.smith

Reviewed By: t.p.northover

Patched by Shankar Easwaran <shankare@codeaurora.org>

Subscribers: alekseyshl, t.p.northover, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299392 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-03 21:50:04 +00:00
Matt Arsenault
513e714dfd AMDGPU: Remove llvm.SI.vs.load.input
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299391 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-03 21:45:13 +00:00
Matt Arsenault
5b7b340242 DAG: Fix missing legalization for any_extend_vector_inreg operands
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299389 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-03 21:28:13 +00:00
Reid Kleckner
2c2955a045 [codeview] Add support for label type records
MASM can produce these type records.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299388 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-03 21:25:20 +00:00
Simon Pilgrim
dc4f56dd52 [X86][SSE]] Lower BUILD_VECTOR with repeated elts as BUILD_VECTOR + VECTOR_SHUFFLE
It can be costly to transfer from the gprs to the xmm registers and can prevent loads merging.

This patch splits vXi16/vXi32/vXi64 BUILD_VECTORS that use the same operand in multiple elements into a BUILD_VECTOR with only a single insertion of each of those elements and then performs an unary shuffle to duplicate the values.

There are a couple of minor regressions this patch unearths due to some missing MOVDDUP/BROADCAST folds that I will address in a future patch.

Note: Now that vector shuffle lowering and combining is pretty good we should be reusing that instead of duplicating so much in LowerBUILD_VECTOR - this is the first of several patches to address this.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299387 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-03 21:06:51 +00:00
Amjad Aboud
019f65e751 x86 interrupt calling convention: re-align stack pointer on 64-bit if an error code was pushed
The x86_64 ABI requires that the stack is 16 byte aligned on function calls. Thus, the 8-byte error code, which is pushed by the CPU for certain exceptions, leads to a misaligned stack. This results in bugs such as Bug 26413, where misaligned movaps instructions are generated.

This commit fixes the misalignment by adjusting the stack pointer in these cases. The adjustment is done at the beginning of the prologue generation by subtracting another 8 bytes from the stack pointer. These additional bytes are popped again in the function epilogue.

Fixes Bug 26413

Patch by Philipp Oppermann.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299383 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-03 20:28:45 +00:00
Jun Bum Lim
78c95b332b [CodeGenPrep] move aarch64-type-promotion to CGP
Summary:
Move the aarch64-type-promotion pass within the existing type promotion framework in CGP.
This change also support forking sexts when a new sext is required for promotion.
Note that change is based on D27853 and I am submitting this out early to provide a better idea on D27853.

Reviewers: jmolloy, mcrosier, javed.absar, qcolombet

Reviewed By: qcolombet

Subscribers: llvm-commits, aemerson, rengolin, mcrosier

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299379 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-03 19:20:07 +00:00
Matt Arsenault
cd7c9c3178 AMDGPU: Remove legacy bfe intrinsics
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299372 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-03 18:08:08 +00:00
Craig Topper
aee31d3e9a [InstCombine] Add test cases showing how we fail to fold vector constants into selects the way we do with scalars.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299369 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-03 17:49:15 +00:00
Zvi Rackover
f60f35be0a Revert "[DAGCombine] A shuffle of a splat is always the splat itself"
This reverts commit r299047 which is incorrect because the
simplification may result in incorrect propogation of undefs to users of
the folded shuffle.

Thanks to Andrea Di Biagio for pointing this out.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299368 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-03 17:41:19 +00:00
Sjoerd Meijer
d369b4141b ARMAsmParser: clean up of isImmediate functions
- we are now using immediate AsmOperands so that the range check functions are
  tablegen'ed.
- Big bonus is that error messages become much more accurate, i.e. instead of a
  useless "invalid operand" error message it will not say that the immediate
  operand must in range [x,y], which is why regression tests needed updating.

More tablegen operand descriptions could probably benefit from using
immediateAsmOperand, but this is a first good step to get rid of most of the
nearly identical range check functions. I will address the remaining immediate
operands in next clean ups.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299358 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-03 14:50:04 +00:00
Simon Pilgrim
07ccae240a [X86][MMX] Improve support for folding fptosi from XMM to MMX
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299338 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-02 17:45:41 +00:00
Simon Pilgrim
888b181566 [X86][MMX] Simplify tablegen patterns by always combining MOVDQ2Q from v2i64
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299336 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-02 16:20:34 +00:00
Simon Pilgrim
4475a6621a [X86][MMX] Added support for subvector extraction to MMX register
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299335 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-02 15:52:28 +00:00
Simon Pilgrim
a323ca7103 Regenerate test with codegen. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299333 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-02 14:21:14 +00:00
Simon Pilgrim
c21f4c0e26 Regenerate test with codegen. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299332 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-02 13:59:37 +00:00
Simon Pilgrim
9960918c01 Regenerate test. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299331 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-02 13:50:44 +00:00
Daniel Berlin
72710465b6 NewGVN: Handle coercion of constant stores, loads, memory insts.
Summary:
Depends on D30928.

This adds support for coercion of stores and memory instructions that do not require insertion to process.
Another few tests down.
I added the relevant tests from rle.ll

Reviewers: davide

Subscribers: llvm-commits, Prazek

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299330 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-02 13:23:44 +00:00
Nikolai Bozhenov
650bf3e599 [BypassSlowDivision] Do not bypass division of hash-like values
Disable bypassing if one of the operands looks like a hash value. Slow
division often occurs in hashtable implementations and fast division is
never taken there because a hash value is extremely unlikely to have
enough upper bits set to zero.

A value is considered to be hash-like if it is produced by

1) XOR operation
2) Multiplication by a constant wider than the shorter type
3) PHI node with all incoming values being hash-like

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299329 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-02 13:14:30 +00:00
Simon Pilgrim
bd2ffa7d85 [X86][MMX] Add generic fptosi 4f32-4i32 test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299328 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-02 13:10:20 +00:00
Zvi Rackover
a544ecba50 Add another interesting shufflevector test case for InstSimplify. NFC.
Test case shows opportunity to constant fold a shuffle with one variable
input vector operand.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299327 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-02 10:42:21 +00:00
Sanjay Patel
6d5ad7b563 [InstSimplify] add constant folding for fdiv/frem
Also, add a helper function so we don't have to repeat this code for each binop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299309 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-01 19:05:11 +00:00
Sanjay Patel
08e6f17325 [InstSimplify] add tests for missed constant folding; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299308 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-01 18:44:03 +00:00
Sanjay Patel
c2d4aab4d9 [DAGCombiner] enable vector transforms for any/all {sign} bits set/clear
The code already allowed vector types in via "isInteger" (which might want
a more specific name), so use splat-friendly constant predicates to match
those types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299304 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-01 15:05:54 +00:00
Sanjay Patel
8159cf81b9 [PowerPC, x86] add vector tests for any/all {sign} bits set/clear; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299303 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-01 14:32:18 +00:00
Craig Topper
0c554b7eb1 [DAGCombiner] Fix fold (or (shuf A, V_0, MA), (shuf B, V_0, MB)) -> (shuf A, B, Mask) to explicitly ensure that only one of the inputs of each shuffle is a zero vector.
This can only happen when we have a mix of zero and undef elements and the two vectors have a different arrangement of zeros/undefs. The shuffle should eventually be constant folded to all zeros.

Fixes PR32484.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299291 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-01 04:26:20 +00:00
Quentin Colombet
2a400a79a2 Revert "Feature generic option to setup start/stop-after/before"
This reverts commit r299282.

Didn't intend to commit this :(

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299288 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-01 01:26:24 +00:00
Quentin Colombet
b6fca8cdd3 Revert "Localizer fun"
This reverts commit r299283.

Didn't intend to commit this :(

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299287 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-01 01:26:21 +00:00
Quentin Colombet
209e8f27d2 [RegBankSelect] Support REG_SEQUENCE for generic mapping
REG_SEQUENCE falls into the same category as COPY for operands mapping:
- They don't have MCInstrDesc with register constraints
- The input variable could use whatever register classes
- It is possible to have register class already assigned to the operands

In particular, given REG_SEQUENCE are always target specific because of
the subreg indices. Those indices must apply to the register class of
the definition of the REG_SEQUENCE and therefore, the target must set a
register class to that definition. As a result, the generic code can
always use that register class to derive a valid mapping for a
REG_SEQUENCE.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299285 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-01 01:26:14 +00:00
Quentin Colombet
3bae06e77e Localizer fun
WIP

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299283 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-01 01:21:28 +00:00
Quentin Colombet
79114cd2fa Feature generic option to setup start/stop-after/before
This patch refactors the code used in llc such that all the users of the
addPassesToEmitFile API have access to a homogeneous way of handling
start/stop-after/before options right out of the box.

Previously each user would have needed to duplicate this logic and set
up its own options.

NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299282 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-01 01:21:24 +00:00
Peter Collingbourne
61a230e3a0 Fix a test to check assembly output instead of bitcode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299279 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-31 23:22:19 +00:00
Konstantin Zhuravlyov
5f15d53c5c [AMDGPU] Fix typo in test filename. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299271 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-31 22:14:54 +00:00
Reid Kleckner
bf7a949a31 Fix binary static archive that got mangled by patch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299265 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-31 21:16:22 +00:00
Reid Kleckner
761a817d06 [llvm-ar] Extract objects to their basename in the CWD
This is helpful when extracting objects from archives produced by MSVC's
lib.exe, which users absolute paths to describe the archive members.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299264 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-31 21:10:53 +00:00
Craig Topper
cba91e6d22 [InstCombine] Add test case demonstrating missed opportunities for removing add/sub when the LSBs of one input are known to be 0 and MSBs of the output aren't consumed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299263 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-31 21:08:37 +00:00
Krzysztof Parzyszek
8b1380a009 [Hexagon] Fix typo in HexagonEarlyIfCConv.cpp
Found by PVS-Studio. Fixes llvm.org/PR32480.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299258 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-31 20:36:00 +00:00
Sanjay Patel
0f0cd01471 [DAGCombiner] add fold for 'All sign bits set?'
(and (setlt X,  0), (setlt Y,  0)) --> (setlt (and X, Y),  0)

We have 7 similar folds, but this one got away. The fact that the
x86 test with a branch didn't change is probably a separate bug. We
may also be missing this and the related folds in instcombine.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299252 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-31 20:28:06 +00:00
Joerg Sonnenberger
3e86a05613 Do not translate rint into nearbyint, but truncate it like nearbyint.
A common way to implement nearbyint is by fiddling with the floating
point environment and calling rint. This is used at least by the BSD
libm and musl. As such, canonicalizing the latter to the former will
create infinite loops for libm and generally pessimize performance, at
least when the generic C versions are used.

This change preserves the rint in the libcall translation and also
handles the domain truncation logic, so that rint with float argument
will be reduced to rintf etc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299247 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-31 19:58:07 +00:00
Matt Arsenault
c4de629ce2 AMDGPU: Remove unnecessary ands when f16 is legal
Add a new node to act as a fancy bitcast from f16 operations to
i32 that implicitly zero the high 16-bits of the result.

Alternatively could try making v2f16 legal and canonicalizing
on build_vectors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299246 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-31 19:53:03 +00:00
Jan Vesely
1abd9ecbfc AMDGPU/R600: Fix amdgpu alias analysis pass.
R600 uses higher AS number to access kernel parameters

Fixes: r298846
Differential Revision: https://reviews.llvm.org/D31520

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299245 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-31 19:26:23 +00:00
Sanjay Patel
a694469515 [PowerPC] add tests for setcc+setcc+logic; NFC
These are the same tests added for x86 with r299238,
but PPC doesn't specify all branches as cheap, so we 
see different patterns in tests with branches.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299244 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-31 18:51:03 +00:00
Balaram Makam
126805f01e [AArch64] Add new subtarget feature to fold LSL into address mode.
Summary:
This feature enables folding of logical shift operations of up to 3 places into addressing mode on Kryo and Falkor that have a fastpath LSL.

Reviewers: mcrosier, rengolin, t.p.northover

Subscribers: junbuml, gberry, llvm-commits, aemerson

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299240 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-31 18:16:53 +00:00
Sanjay Patel
bced0c80a5 [x86] add/consolidate tests for setcc+setcc+and/or; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299238 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-31 17:55:07 +00:00
Adam Nemet
e37d964eac Improve DebugInfo/strip-loop-metadata.ll test
This wasn't covering for the case where you have multiple latches and hence
the use of the same loop-id which needs to be mapped to the same loop-id.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299237 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-31 17:51:12 +00:00
Piotr Padlewski
f580f444f6 [MSSA] Small test fix
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299235 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-31 17:39:07 +00:00
Craig Topper
af26b71085 [AVX-512] Update lowering for gather/scatter prefetch intrinsics to match the immediate encodings the frontend uses based on the _MM_HINT_T0/T1 constant values in clang's headers.
Our _MM_HINT_T0/T1 constant values are 3/2 which matches gcc, but not icc or Intel documentation. Interestingly gcc had this same bug on their implementation of the gather/scatter builtins at one point too.

Fixes PR32411.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299234 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-31 17:24:29 +00:00
Dehao Chen
22478be44e Fix the InstCombine to reserve the VP metadata and sets correct call count.
Summary: Currently the VP metadata was dropped when InstCombine converts a call to direct call. This patch converts the VP metadata to branch_weights so that its hotness is recorded.

Reviewers: eraman, davidxl

Reviewed By: davidxl

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299228 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-31 15:59:52 +00:00