954 Commits

Author SHA1 Message Date
Craig Topper
a19815f1d9 [TargetLowering] Simplify one of the special cases in SimplifyDemandedBits for XOR. NFCI
We were checking for all bits being Known by checking Known.Zero|Known.One, but if all the bits are known then the value should be a Constant and we can just check for that instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339509 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-12 06:52:03 +00:00
Craig Topper
80ad764eba [TargetLowering] Use APInt::isSubsetOf to simplify some code. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339508 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-12 05:34:15 +00:00
Simon Pilgrim
c5db0e0f7c [TargetLowering] Add BuildSDIVPattern helper to BuildExactSDIV (NFCI).
As requested in D50392, pull the magic constant calculations out into a helper function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339346 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-09 13:56:04 +00:00
Simon Pilgrim
8a32574571 [TargetLowering] BuildUDIV - Add support for divide by one (PR38477)
Provide a pass-through of the numerator for divide by one cases - this is the same approach we take in DAGCombiner::visitSDIVLike.

I investigated whether we could achieve this by magic MULHU/SRL values but nothing appeared to work as we don't have a way for MULHU(x,c) -> x

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339254 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-08 14:51:19 +00:00
Simon Pilgrim
98bb3fb630 [TargetLowering] Remove APInt divisor argument from BuildExactSDIV (NFCI).
As requested in D50392, this is a minor refactor to BuildExactSDIV to stop taking the uniform constant APInt divisor and instead extract it locally.

I also cleanup the operands and valuetypes to better match BuildUDiv (and BuildSDIV in the near future).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339246 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-08 13:59:44 +00:00
Simon Pilgrim
2b9bc063ae [TargetLowering] BuildUDIV - Early out for divide by one (PR38477)
We're not handling the UDIV by one special case properly - for now just early out.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339229 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-08 10:00:54 +00:00
Simon Pilgrim
13f3fc4d27 [TargetLowering] Use pre-computed Shift value type in BuildUDIV (NFCI)
This was missed in D49248


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339146 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-07 14:40:21 +00:00
Simon Pilgrim
4fcef69e65 [TargetLowering] Add support for non-uniform vectors to BuildUDIV
This patch refactors the existing TargetLowering::BuildUDIV base implementation to support non-uniform constant vector denominators.

It also includes a fold for MULHU by pow2 constants to SRL which can now more readily occur from BuildUDIV.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339121 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-07 09:51:34 +00:00
Matt Arsenault
7166ee595d DAG: Enhance isKnownNeverNaN
Add a parameter for testing specifically for
sNaNs - at least one instruction pattern on AMDGPU
needs to check specifically for this.

Also handle more cases, and add a target hook
for custom nodes, similar to the hooks for known
bits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338910 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-03 18:27:52 +00:00
Simon Pilgrim
5bf23c0ee0 [TargetLowering] Generalise BuildSDIV function
First step towards a BuildSDIV equivalent to D49248 for non-uniform vector support - this just pushes the splat detection down into TargetLowering::BuildSDIV where its still used.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338838 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-03 10:00:54 +00:00
Hsiangkai Wang
d8319b3d66 Test commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338352 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-31 06:09:29 +00:00
Craig Topper
4a5776cc93 [DAGCombiner][TargetLowering] Pass a SmallVector instead of a std::vector to BuildSDIV/BuildUDIV/etc.
The vector contains the SDNodes that these functions create. The number of nodes is always a small number so we should use SmallVector to avoid a heap allocation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338329 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-30 23:22:00 +00:00
Craig Topper
e9f23bb5b1 [TargetLowering] In BuildSDIV, add the MULHS/SMUL_LOHI to the Created vector.
BuildUDIV was already correct.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338304 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-30 21:04:38 +00:00
Craig Topper
f264341a83 [DAGCombiner][PowerPC][AArch64] Pass Created vector by reference to BuildSDIVPow2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338303 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-30 21:04:34 +00:00
Craig Topper
acb4985d70 [SelectionDAG] Pass std::vector by reference instead of by pointer to BuildSDIV/BuildUDIV.
This removes the need for an assert to ensure the pointer isn't null.

Years ago we had ifs the checked the pointer was non-null before very access to the vector. These checks were removed and replaced with a single assert. But a reference seems more suitable here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338205 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-28 19:44:20 +00:00
Roman Lebedev
24c0aa9af6 [DAGCombine] optimizeSetCCOfSignedTruncationCheck(): handle ule,ugt CondCodes.
Summary:
A follow-up for D49266 / rL337166.

At least one of these cases is more canonical,
so we really do have to handle it.
https://godbolt.org/g/pkzP3X
https://rise4fun.com/Alive/pQyhZZ

We won't get to these cases with I1 being -1,
as that will be constant-folded to true or false.

I'm also not sure we actually hit the 'ule' case,
but i think the worst think that could happen is that being dead code.

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

Reviewed By: spatel

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338044 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-26 17:34:28 +00:00
Nirav Dave
eac6487bf2 [Legalize] Elide MERGE_VALUES created by scalarizeVectorLoad.
scalarizeVectorLoad creates MERGE_VALUES nodes which are immediately
decomposed in expandLoad. Elide the node in these cases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337708 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-23 16:43:42 +00:00
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