737 Commits

Author SHA1 Message Date
Stephen Canon
7e9afd4946 Skip out of SimplifyDemandedBits for BITCAST of f16 to i16
Mirrors the existing exit path for f128, avoiding a crash later on.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337506 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-19 22:46:42 +00:00
Roman Lebedev
0c94a3b511 [X86][AArch64][DAGCombine] Unfold 'check for [no] signed truncation' pattern
Summary:

[[ https://bugs.llvm.org/show_bug.cgi?id=38149 | PR38149 ]]

As discussed in https://reviews.llvm.org/D49179#1158957 and later,
the IR for 'check for [no] signed truncation' pattern can be improved:
https://rise4fun.com/Alive/gBf
^ that pattern will be produced by Implicit Integer Truncation sanitizer,
https://reviews.llvm.org/D48958 https://bugs.llvm.org/show_bug.cgi?id=21530
in signed case, therefore it is probably a good idea to improve it.

But the IR-optimal patter does not lower efficiently, so we want to undo it..

This handles the simple pattern.
There is a second pattern with predicate and constants inverted.

NOTE: we do not check uses here. we always do the transform.

Reviewers: spatel, craig.topper, RKSimon, javed.absar

Reviewed By: spatel

Subscribers: kristof.beyls, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337166 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-16 12:44:10 +00:00
Simon Pilgrim
b58cfae435 Use const APInt& to avoid extra copy. NFCI.
As discussed on D48825.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336491 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-07 17:33:48 +00:00
Simon Pilgrim
7671355ab9 [DAGCombiner] Add EXTRACT_SUBVECTOR to SimplifyDemandedVectorElts
As discussed on PR37989, this patch adds EXTRACT_SUBVECTOR handling to TargetLowering::SimplifyDemandedVectorElts and calls it from DAGCombiner::visitEXTRACT_SUBVECTOR.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336490 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-07 17:30:06 +00:00
Adrian Prantl
26b584c691 Remove \brief commands from doxygen comments.
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.

Patch produced by

  for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331272 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-01 15:54:18 +00:00
David Blaikie
fe42bd50da Move TargetLoweringObjectFile from CodeGen to Target to fix layering
It's implemented in Target & include from other Target headers, so the
header should be in Target.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328392 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-23 23:58:19 +00:00
Craig Topper
346e47066f [TargetLowering] Remove redundant term in two ifs in SimplifySetCC. NFC
If we get into the right hand side of the OR, we know that isOpaque is true since the left hand size is just a check that it's false.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327179 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-09 22:24:12 +00:00
Craig Topper
4613007581 [TargetLowering] Remove redundant if condition in SimplifySetcc. NFC
We were checking the condition code a second time when we were already in a block with this same condition code check.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327069 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-08 21:53:36 +00:00
Simon Pilgrim
cd508410db [TargetLowering] Add vector BITCAST support to SimplifyDemandedVectorElts
Notably helps cleanup after legalization of vector types

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326838 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-06 22:32:01 +00:00
Craig Topper
c5a680a5cc [SelectionDAG] Support some SimplifySetCC cases for comparing against vector splats of constants.
This supports things like

(setcc ugt X, 0) -> (setcc ne X, 0)

I've restricted to only make changes to vectors before legalize ops because I doubt all targets have accurate condition code legality information for vectors given how little we did before.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326495 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-01 22:15:39 +00:00
Simon Pilgrim
5c1e879c2e [TargetLowering] SimplifyDemandedVectorElts - pass demanded elts through ADD/SUB ops
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326044 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-24 20:59:14 +00:00
Simon Pilgrim
abdbbd5185 [TargetLowering] SimplifyDemandedVectorElts - pass demanded elts through TRUNCATE ops
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326043 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-24 19:28:34 +00:00
Craig Topper
fbabe6e9f6 [TargetLowering] Rename isCondCodeLegal to isCondCodeLegalOrCustom. Add real isCondCodeLegal. Update callers to use one or the other.
isCondCodeLegal internally checked Legal or Custom which is misleading. Though no targets set any cond code action to Custom today.

So I've renamed isCondCodeLegal to isCondCodeLegalOrCustom and added a real isCondCodeLegal that only checks Legal.

I've changed legalization code to use isCondCodeLegalOrCustom and left things reachable via DAG combine as isCondCodeLegal. I've also changed some places that called getCondCodeAction and compared to Legal to just use isCondCodeLegal.

I'm looking at trying to keep SETCC all the way to isel for the AVX512 integer comparisons and I suspect I'll need to make some condition codes Custom to stop DAG combine from changing things post LegalizeOps. Prior to this only Expand stopped DAG combine, but that causes LegalizeOps to try to swap operands or invert rather than calling our Custom handler.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325829 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-22 20:51:26 +00:00
Craig Topper
6a9e037dc7 [SelectionDAG] Support known true/false SimplifySetCC cases for comparing against vector splats of constants.
This is split off from D42948 and includes just the cases that constant fold to true or false. It also includes some refactoring to keep predicate checks together.

This supports things like

(setcc uge X, 0) -> true

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325627 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-20 21:48:14 +00:00
Craig Topper
bff6449bb8 [SelectionDAG] Add LegalTypes flag to getShiftAmountTy. Use it to unify and simplify DAGCombiner and simplifySetCC code and fix a bug.
DAGCombiner and SimplifySetCC both use getPointerTy for shift amounts pre-legalization. DAGCombiner uses a single helper function to hide this. SimplifySetCC does it in multiple places.

This patch adds a defaulted parameter to getShiftAmountTy that can make it return getPointerTy for scalar types. Use this parameter to simplify the SimplifySetCC and DAGCombiner.

Additionally, there were two places in SimplifySetCC that were creating shifts using the target's preferred shift amount pre-legalization. If the target uses a narrow type and the type is illegal, this can cause SimplfiySetCC to create a shift with an amount that can't represent all possible shift values for the type. To fix this we should use pointer type there too.

Alternatively we could make getScalarShiftAmountTy for each target return a safe value for large types as proposed in D43445. And maybe we should still do that, but fixing the SimplifySetCC code keeps other targets from tripping over this in the future.

Fixes PR36250.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325602 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-20 17:41:05 +00:00
Simon Pilgrim
8a630465fb [SelectionDAG] SimplifyDemandedVectorElts - add support for VECTOR_INSERT_ELT
Differential Revision: https://reviews.llvm.org/D43431

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325449 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-17 21:49:40 +00:00
Simon Pilgrim
d23faddc17 Fix signed/unsigned comparison warning. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325363 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-16 17:26:59 +00:00
Simon Pilgrim
ce03445935 Fix signed/unsigned comparison warning. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325359 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-16 16:52:50 +00:00
Simon Pilgrim
e0288d90cb [SelectionDAG] Enable SimplifyDemandedVectorElts support for simplifying shuffle masks
Based off the DemandedElts mask the and UNDEF elements returned from the SimplifyDemandedVectorElts calls to the shuffle operands, we can attempt to simplify the shuffle mask.

I had to be very conservative here as accepting post-legalized shuffle masks could cause problems for targets that legalize UNDEF mask elements back to inrange values (PowerPC), similarly combining to identity shuffle masks could cause too much UNDEF information to disappear for later combines.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325354 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-16 16:22:14 +00:00
Simon Pilgrim
7735c73357 [SelectionDAG] Add initial SimplifyDemandedVectorElts support for simplifying VSELECT operands
This just adds a basic pass through - we can add constant selection mask handling in a future patch to fully match InstCombine.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325338 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-16 12:21:08 +00:00
Simon Pilgrim
371e6cc130 [SelectionDAG] Add initial implementation of TargetLowering::SimplifyDemandedVectorElts
This is mainly a move of simplifyShuffleOperands from DAGCombiner::visitVECTOR_SHUFFLE to create a more general purpose TargetLowering::SimplifyDemandedVectorElts implementation.

Further features can be moved/added in future patches.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325232 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-15 12:14:15 +00:00
Craig Topper
f71997e911 [SelectionDAG] Remove duplicate code from TargetLowering::SimplifySetCC.
This exact code already exists a little further up.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325101 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-14 06:51:57 +00:00
Sanjay Patel
3f985a3da1 [TargetLowering] try to create -1 constant operand for math ops via demanded bits
This reverses instcombine's demanded bits' transform which always tries to clear bits in constants.

As noted in PR35792 and shown in the test diffs:
https://bugs.llvm.org/show_bug.cgi?id=35792
...we can do better in codegen by trying to form -1. The x86 sub test shows a missed opportunity. 

I did investigate changing instcombine's behavior, but it would be more work to change 
canonicalization in IR. Clearing bits / shrinking constants can allow killing instructions, 
so we'd have to figure out how to not regress those cases.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324839 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-11 14:38:23 +00:00
Craig Topper
a7d13fbe24 [SelectionDAG] Remove TargetLowering::getConstTrueVal. Use SelectionDAG::getBoolConstant in the one place it was used.
SelectionDAG::getBoolConstant was recently introduced. At the time I didn't know getConstTrueVal existed, but I think getBoolConstant is better as it will use the source VT to make sure it can properly detect floating point if it is configured differently.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324832 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-11 04:58:58 +00:00
Craig Topper
d3663859cf [SelectionDAG] Add a helper function for creating a boolean constant based on the target's boolean content
Many in SimplifySetCC and FoldSetCC try to create true or false constants. Some of them query getBooleanContents to figure out whether to use all ones or just 1 for true. But many places do not check and just use 1 without ensuring the VT has an i1 scalar type. Note sure if those places only trigger before type legalization so they only see an i1
type?

To cleanup the inconsistency and reduce some duplicated code, this patch adds a getBoolConstant method to SelectionDAG that takes are of querying getBooleanContents and doing the right thing.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324634 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-08 18:55:14 +00:00
Sanjay Patel
6e27fa2c73 [TargetLowering] use local variable to reduce duplication; NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324401 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-06 21:09:42 +00:00
Sanjay Patel
1f521e3799 [TargetLowering] use local variables to reduce duplication; NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324397 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-06 20:49:28 +00:00
Jonas Paulsson
87885d427a [SelectionDAG] Consider endianness in scalarizeVectorStore().
When handling vectors with non byte-sized elements, reverse the order of the
elements in the built integer if the target is Big-Endian.

SystemZ tests updated.

Review: Eli Friedman, Ulrich Weigand.
https://reviews.llvm.org/D42786

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324063 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-02 08:48:02 +00:00
Craig Topper
103218aea9 [TargetLowering] Teach TargetLowering::SimplifySetCC to simplify setcc of vXi1 vectors into logic ops.
This transform was already being done for setcc of scalar i1. This extends it to vectors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323585 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-27 09:10:58 +00:00
Jonas Paulsson
e64dbcb7af [SelectionDAG] Fix codegen of vector stores with non byte-sized elements.
This was completely broken, but hopefully fixed by this patch.

In cases where it is needed, a vector with non byte-sized elements is stored
by extracting, zero-extending, shift:ing and or:ing the elements into an
integer of the same width as the vector, which is then stored.

Review: Eli Friedman, Ulrich Weigand
https://reviews.llvm.org/D42100#inline-369520
https://bugs.llvm.org/show_bug.cgi?id=35520

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323042 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-20 16:05:10 +00:00
Sanjay Patel
b5501c956e [TargetLowering] add punctuation for readability; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322855 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-18 15:25:32 +00:00
Simon Pilgrim
dfa1e7c267 [DAG] Fix for Bug PR34620 - Allow SimplifyDemandedBits to look through bitcasts
Allow SimplifyDemandedBits to use TargetLoweringOpt::computeKnownBits to look through bitcasts. This can help simplifying in some cases where bitcasts of constants generated during or after legalization can't be folded away, and thus didn't get picked up by SimplifyDemandedBits. This fixes PR34620, where a redundant pand created during legalization from lowering and lshr <16xi8> wasn't being simplified due to the presence of a bitcasted build_vector as an operand.

Committed on the behalf of @sameconrad (Sam Conrad)

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321969 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-07 19:09:40 +00:00
Craig Topper
15c5ab82da [SelectionDAG] Reverse the order of operands in the ISD::ADD created by TargetLowering::getVectorElementPointer so that the FrameIndex is on the left.
This seems to improve X86's ability to match this into an address computation. Otherwise the other operand gets assigned to the base register and the stack pointer + frame index ends up in the index register. But index registers can't encode ESP/RSP so we end up having to move it into another register to meet the constraint.

I could try to improve the address matcher in X86, but swapping the producer seemed easier. Several other places already have the operands in this order so this is at least consistent.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321370 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-22 17:18:13 +00:00
Matthias Braun
d318139827 MachineFunction: Return reference from getFunction(); NFC
The Function can never be nullptr so we can return a reference.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320884 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 22:22:58 +00:00
Yaxun Liu
dcc00b1fac CodeGen: Fix pointer info in SplitVecOp_EXTRACT_VECTOR_ELT/SplitVecRes_INSERT_VECTOR_ELT
Two issues found when doing codegen for splitting vector with non-zero alloca addr space:

DAGTypeLegalizer::SplitVecRes_INSERT_VECTOR_ELT/SplitVecOp_EXTRACT_VECTOR_ELT uses dummy pointer info for creating
SDStore. Since one pointer operand contains multiply and add, InferPointerInfo is unable to
infer the correct pointer info, which ends up with a dummy pointer info for the target to lower
store and results in isel failure. The fix is to introduce MachinePointerInfo::getUnknownStack to
represent MachinePointerInfo which is known in alloca address space but without other information.

TargetLowering::getVectorElementPointer uses value type of pointer in addr space 0 for
multiplication of index and then add it to the pointer. However the pointer may be in an addr
space which has different size than addr space 0. The fix is to use the pointer value type for
index multiplication.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319622 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-02 22:13:22 +00:00
Matt Arsenault
ff838de892 DAG: Add nuw when splitting loads and stores
The object can't straddle the address space
wrap around, so I think it's OK to assume any
offsets added to the base object pointer can't
overflow. Similar logic already appears to be
applied in SelectionDAGBuilder when lowering
aggregate returns.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319272 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-29 01:25:12 +00:00
Jonas Paulsson
8973ec011a Use getStoreSize() in various places instead of 'BitSize >> 3'.
This is needed for cases when the memory access is not as big as the width of
the data type. For instance, storing i1 (1 bit) would be done in a byte (8
bits).

Using 'BitSize >> 3' (or '/ 8') would e.g. give the memory access of an i1 a
size of 0, which for instance makes alias analysis return NoAlias even when
it shouldn't.

There are no tests as this was done as a follow-up to the bugfix for the case
where this was discovered (r318824). This handles more similar cases.

Review: Björn Petterson
https://reviews.llvm.org/D40339

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319173 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-28 14:44:32 +00:00
David Blaikie
e3a9b4ce3a Fix a bunch more layering of CodeGen headers that are in Target
All these headers already depend on CodeGen headers so moving them into
CodeGen fixes the layering (since CodeGen depends on Target, not the
other way around).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318490 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-17 01:07:10 +00:00
Matt Arsenault
19b50e8dff DAG: Add computeKnownBitsForFrameIndex
Some of the AMDGPU stack addressing modes require knowing the sign
bit is zero. We used to accomplish this by custom lowering
frame indexes, and then putting an AssertZext around a
TargetFrameIndex. This required specifically looking for
the AssextZext + frame index pattern which was moderately
disgusting. The same could probably be accomplished
with a target specific node, but would still
require special handling of frame indexes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317671 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-08 08:52:31 +00:00
Craig Topper
cbc06db950 [SelectionDAG] Don't subject ISD:Constant to the depth limit in TargetLowering::SimplifyDemandedBits.
Summary:
We shouldn't recurse any further but it doesn't mean we shouldn't be able to give the known bits for a constant. The caller would probably like that we always return the right answer for a constant RHS. This matches what InstCombine does in this case.

I don't have a test case because this showed up while trying to revive D31724.

Reviewers: RKSimon, spatel

Reviewed By: RKSimon

Subscribers: arsenm, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316255 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-21 02:27:19 +00:00
Mark Searles
df60d8e59e Use the return value of UpdateNodeOperands(); in some cases, UpdateNodeOperands() modifies the node in-place and using the return value isn’t strictly necessary. However, it does not necessarily modify the node, but may return a resultant node if it already exists in the DAG. See comments in UpdateNodeOperands(). In that case, the return value must be used to avoid such scenarios as an infinite loop (node is assumed to have been updated, so added back to the worklist, and re-processed; however, node hasn’t changed so it is once again passed to UpdateNodeOperands(), assumed modified, added back to worklist; cycle infinitely repeats).
Differential Revision: https://reviews.llvm.org/D38466

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315957 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-16 23:38:53 +00:00
Craig Topper
1a4f916514 [SelectionDAG] Cleanup the SIGN_EXTEND_INREG handling in computeKnownBits. NFCI
Use less temporary APInts. Use bit counting more. Don't call getScalarSizeInBits so many places, just capture it once.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315671 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-13 05:35:35 +00:00
Craig Topper
8b8bd277b9 [SelectionDAG] Fix typo in comment. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315670 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-13 05:35:34 +00:00
Craig Topper
b0d6477e54 [SelectionDAG] Const-correct the DemandedMask argument to one of the overloads of SimplifyDemandedBits. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315641 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-12 23:46:05 +00:00
Craig Topper
fcc479bedc [SelectionDAG] Simplify the ISD::SIGN_EXTEND/ZERO_EXTEND handling to use less temporary APInts by counting bits instead. NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315628 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-12 21:58:25 +00:00
Yaxun Liu
a46819d67a CodeGen: Fix pointer info in expandUnalignedLoad/Store
Currently expandUnalignedLoad/Store uses place holder pointer info for temporary memory operand
in stack, which does not have correct address space. This causes unaligned private double16 load/store to be
lowered to flat_load instead of buffer_load for amdgcn target.

This fixes failures of OpenCL conformance test basic/vload_private/vstore_private on target amdgcn---amdgizcl.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314566 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-29 23:31:14 +00:00
Craig Topper
70035721e4 [SelectionDAG] Teach simplifyDemandedBits to handle shifts by constant splat vectors
This teach simplifyDemandedBits to handle constant splat vector shifts.

This required changing some uses of getZExtValue to getLimitedValue since we can't rely on legalization using getShiftAmountTy for the shift amount.

I believe there may have been a bug in the ((X << C1) >>u ShAmt) handling where we didn't check if the inner shift was too large. I've fixed that here.

I had to add new patterns to ARM because the zext/sext the patterns were trying to look for got turned into an any_extend with this patch. Happy to split that out too, but not sure how to test without this change.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314139 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-25 19:26:08 +00:00
Craig Topper
1997c335b9 [SelectionDAG] Replace a flag that can never be true with an assert.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313847 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-21 00:18:46 +00:00
Craig Topper
cecbc1792c [SelectionDAG] Use APInt::getActivebits instead of Bitwidth - leading zeros.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313839 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-20 23:48:56 +00:00
Craig Topper
5fb544c3e4 [SelectionDAG] Use APInt::isSubsetOf. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305606 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16 23:19:14 +00:00