2217 Commits

Author SHA1 Message Date
Jatin Bhateja
a1afcacc9f Extension of shuffle vector pattern detection, updating post rebase.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311242 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-19 15:58:36 +00:00
Craig Topper
bc3b8e99f1 [DAGCombiner] Fix bad comment that had immediate values swapped from the code and what they need to be to make sense. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311144 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-18 04:52:46 +00:00
Simon Pilgrim
8f5ac0464c [DAGCombiner] Add support for non-uniform constant vectors to (mul x, (1 << c)) -> x << c
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311083 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-17 13:03:34 +00:00
Amaury Sechet
05713200d0 [DAGCombine] Do not try to deduplicate commutative operations if both operand are the same.
Summary: It is creating useless work as the commuted nodes is the same as the node we are working on in that case.

Reviewers: jyknight, nemanjai, mkuper, spatel, RKSimon, zvi, bkramer

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310832 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-14 11:44:03 +00:00
Elad Cohen
65e88c9730 Revert "[DAGCombiner] Extending pattern detection for vector shuffle (REAPPLIED)"
This reverts commit r310782.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310822 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-14 09:06:00 +00:00
Craig Topper
267a504434 [X86][ARM][TargetLowering] Add SrcVT to isExtractSubvectorCheap
Summary:
Without the SrcVT its hard to know what is really being asked for. For example if your target has 128, 256, and 512 bit vectors. Maybe extracting 128 from 256 is cheap, but maybe extracting 128 from 512 is not.

For x86 we do support extracting a quarter of a 512-bit register. But for i1 vectors we don't have isel patterns for extracting arbitrary pieces. So we need this to have a correct implementation of isExtractSubvectorCheap for mask vectors.

Reviewers: RKSimon, zvi, efriedma

Reviewed By: RKSimon

Subscribers: aemerson, javed.absar, kristof.beyls, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310793 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-13 17:29:07 +00:00
Simon Pilgrim
abb4a55f13 [DAGCombiner] Extending pattern detection for vector shuffle (REAPPLIED)
If all the operands of a BUILD_VECTOR extract elements from same vector then split the vector efficiently based on the maximum vector access index.

Reapplied with fix to only work with simple value types.

Committed on behalf of @jbhateja (Jatin Bhateja)

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310782 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-12 17:43:25 +00:00
Sanjay Patel
1f9d19bad7 [x86] use more shift or LEA for select-of-constants (2nd try)
The previous rev (r310208) failed to account for overflow when subtracting the
constants to see if they're suitable for shift/lea. This version add a check
for that and more test were added in r310490.

We can convert any select-of-constants to math ops:
http://rise4fun.com/Alive/d7d

For this patch, I'm enhancing an existing x86 transform that uses fake multiplies
(they always become shl/lea) to avoid cmov or branching. The current code misses
cases where we have a negative constant and a positive constant, so this is just
trying to plug that hole.

The DAGCombiner diff prevents us from hitting a terrible inefficiency: we can start
with a select in IR, create a select DAG node, convert it into a sext, convert it
back into a select, and then lower it to sext machine code.

Some notes about the test diffs:

1. 2010-08-04-MaskedSignedCompare.ll - We were creating control flow that didn't exist in the IR.
2. memcmp.ll - Choose -1 or 1 is the case that got me looking at this again. We could avoid the 
   push/pop in some cases if we used 'movzbl %al' instead of an xor on a different reg? That's a 
   post-DAG problem though.
3. mul-constant-result.ll - The trade-off between sbb+not vs. setne+neg could be addressed if
   that's a regression, but those would always be nearly equivalent.
4. pr22338.ll and sext-i1.ll - These tests have undef operands, so we don't actually care about these diffs.
5. sbb.ll - This shows a win for what is likely a common case: choose -1 or 0.
6. select.ll - There's another borderline case here: cmp+sbb+or vs. test+set+lea? Also, sbb+not vs. setae+neg shows up again.
7. select_const.ll - These are motivating cases for the enhancement; replace cmov with cheaper ops.

Assembly differences between movzbl and xor to avoid a partial reg stall are caused later by the X86 Fixup SetCC pass.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310717 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-11 15:44:14 +00:00
Nirav Dave
dfe9b148cb Improve handling of insert_subvector of bitcast values
Fix insert_subvector / extract_subvector merges of bitcast values.

Reviewers: efriedma, craig.topper, RKSimon

Subscribers: RKSimon, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310711 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-11 13:21:41 +00:00
Simon Pilgrim
54fe64b5b4 [DAGCombiner] Remove shuffle support from simplifyShuffleMask
rL310372 enabled simplifyShuffleMask to support undef shuffle mask inputs, but its causing hangs.

Removing support until I can triage the problem

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310699 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-11 08:37:00 +00:00
Nirav Dave
cacb6e2318 Revert "[DAG] Cleanup unused nodes after store merge. NFCI."
This reverts commit r310648 which causes an unexpected assertion failure

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310659 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-10 21:03:36 +00:00
Nirav Dave
86c4bd6af9 [DAG] Relax type restriction for store merge
Summary: Allow stores of bitcastable types to be merged by peeking through BITCAST nodes and recasting stored values constant and vector extract nodes as necessary.

Reviewers: jyknight, hfinkel, efriedma, RKSimon, spatel

Reviewed By: RKSimon

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310655 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-10 19:52:45 +00:00
Nirav Dave
498d807c61 [DAG] Cleanup unused nodes after store merge. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310648 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-10 18:53:14 +00:00
Nirav Dave
786c1d3f1a [DAG] Rewrite expression. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310608 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-10 15:29:33 +00:00
Nirav Dave
93120fa784 [DAG] Explicitly cleanup merged load values during store merge. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310474 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-09 13:37:07 +00:00
Nirav Dave
ca52e101f7 [DAG] Introduce peekThroughBitcast function. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310405 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-08 20:01:18 +00:00
Nirav Dave
a0c1eb4244 [DAG] Update comments. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310404 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-08 19:52:19 +00:00
Simon Pilgrim
47bcf0d5a6 [DAGCombiner] simplifyShuffleMask - handle UNDEF inputs from shuffles as well as BUILD_VECTOR
Minor extension to D36393

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310372 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-08 16:10:33 +00:00
Simon Pilgrim
c6a1f940fd [DAGCombiner] Simplify shuffle mask index if the referenced input element is UNDEF
Fixes one of the cases in PR34041.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310344 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-08 11:03:30 +00:00
Sanjay Patel
f5ceedaf33 [x86] revert r310208 to investigate test-suite failures (PR34105 / PR34097)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310264 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-07 15:47:48 +00:00
Nirav Dave
22e14e2efd [DAG] Extend visitSCALAR_TO_VECTOR optimization to truncated vector.
Relanding after case to insert explicit truncation as necessary.

Allow SCALAR_TO_VECTOR of EXTRACT_VECTOR_ELT to reduce to
EXTRACT_SUBVECTOR of vector shuffle when output is smaller. Marginally
improves vector shuffle computations.

Reviewers: efriedma, RKSimon, spatel

Subscribers: javed.absar, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310256 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-07 14:07:49 +00:00
Sanjay Patel
f49c4011ef [x86] use more shift or LEA for select-of-constants
We can convert any select-of-constants to math ops:
http://rise4fun.com/Alive/d7d

For this patch, I'm enhancing an existing x86 transform that uses fake multiplies 
(they always become shl/lea) to avoid cmov or branching. The current code misses 
cases where we have a negative constant and a positive constant, so this is just 
trying to plug that hole.

The DAGCombiner diff prevents us from hitting a terrible inefficiency: we can start 
with a select in IR, create a select DAG node, convert it into a sext, convert it 
back into a select, and then lower it to sext machine code.

Some notes about the test diffs:

1. 2010-08-04-MaskedSignedCompare.ll - We were creating control flow that didn't exist in the IR.
2. memcmp.ll - Choose -1 or 1 is the case that got me looking at this again. I 
   think we could avoid the push/pop in some cases if we used 'movzbl %al' instead of an xor on 
   a different reg? That's a post-DAG problem though.
3. mul-constant-result.ll - The trade-off between sbb+not vs. setne+neg could be addressed if 
   that's a regression, but I think those would always be nearly equivalent.
4. pr22338.ll and sext-i1.ll - These tests have undef operands, so I don't think we actually care about these diffs.
5. sbb.ll - This shows a win for what I think is a common case: choose -1 or 0.
6. select.ll - There's another borderline case here: cmp+sbb+or vs. test+set+lea? Also, sbb+not vs. setae+neg shows up again.
7. select_const.ll - These are motivating cases for the enhancement; replace cmov with cheaper ops.

Assembly differences between movzbl and xor to avoid a partial reg stall are caused later by the X86 Fixup SetCC pass.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310208 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-06 16:27:07 +00:00
Nico Weber
5b11a64fa0 Revert r310058, it caused PR34073.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310118 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-04 20:24:13 +00:00
Simon Pilgrim
c5cebfc196 [DAGCombiner] Extending pattern detection for vector shuffle.
If all the operands of a BUILD_VECTOR extract elements from same vector then split the vector efficiently based on the maximum vector access index.

Committed on behalf of @jbhateja (Jatin Bhateja)

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310058 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-04 12:46:35 +00:00
Nirav Dave
b6b032495a [DAG] Allow merging of stores of vector loads
Remove restriction disallowing merging of stores vector loads into
larger store of larger vector load.

Reviewers: RKSimon, efriedma, spatel

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309951 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-03 15:51:20 +00:00
Nirav Dave
29e9cdbd0d [DAG] Improve candidate pruning in store merge failure case. NFCI
During store merge we construct a sorted list of consecutive store
candidates and consider subsequences for merging into a single
store. For each subsequence we check if the stored value type is legal
the merged store would have valid and fast and if the constructed
value to be stored is valid. The only properties that affect this
check between subsequences is the size of the subsequence, the
alignment of the first store, the alignment of the stored load value
(when merging stores-of-loads), and whether the merged value is a
constant zero.

If we do not find a viable mergeable subsequence starting from the
first store of length N, we know that a subsequence starting at a
later store of length N will also fail unless the new store's
alignment, the new load's alignment (if we're merging store-of-loads),
or we've dropped stores of nonzero value and could construct a merged
stores of zero (for merging constants).

As a result if we fail to find a valid subsequence starting from the
first store we can safely skip considering subsequences that start
with subsequent stores unless one of the above properties is
true. This significantly (2x) improves compile time in some
pathological cases.

Reviewers: RKSimon, efriedma, zvi, spatel, waltl

Subscribers: grandinj, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309830 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-02 16:35:58 +00:00
Nirav Dave
f5ed40bd2c [DAG] Refactor store merge subexpressions. NFC.
Distribute various expressions across ifs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309777 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-02 01:08:38 +00:00
Matt Arsenault
6e8db40d65 DAG: Undo and->or combine with FrameIndexes
This pattern shows up when lowering byval copies on AMDGPU.

The byval object access is split into 4-byte chunks, adding a
constant offset to the FixedStack base. When some of the offsets
turn into ors, this prevents combining the constant offsets.

This makes it not apparent that the object is there when matching
addressing modes, so it ends up using a scratch wave offset
relative access and the lengthy frame index expansion for that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309775 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-02 00:43:42 +00:00
Nirav Dave
68a49615ca [DAG] Factor out common expressions. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309740 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-01 20:30:52 +00:00
Nirav Dave
b9614f5588 Pull out VectorNumElements value. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309719 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-01 18:19:56 +00:00
Nirav Dave
8790231fa6 Revert "[DAG] Extend visitSCALAR_TO_VECTOR optimization to truncated vector."
This reverts commit r309680 which appears to be raising an assertion
in the test-suite.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309717 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-01 18:09:25 +00:00
Nirav Dave
a8735a342e [DAG] Convert extload check to equivalent type check. NFC.
Replace check with check that consuming store has the same type.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309708 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-01 17:19:41 +00:00
Nirav Dave
ac7c13eebd [DAG] Move extload check in store merge. NFC.
Move candidate check from later check to initial candidate check.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309698 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-01 16:00:47 +00:00
Nirav Dave
bb2981861c [DAG] Extend visitSCALAR_TO_VECTOR optimization to truncated vector.
Summary:
Allow SCALAR_TO_VECTOR of EXTRACT_VECTOR_ELT to reduce to
EXTRACT_SUBVECTOR of vector shuffle when output is smaller. Marginally
improves vector shuffle computations.

Reviewers: efriedma, RKSimon, spatel

Subscribers: javed.absar, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309680 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-01 13:45:35 +00:00
Zvi Rackover
8ec224a8e2 DAGCombiner: Extend reduceBuildVecToTrunc to handle non-zero offset
Summary:
Adding support for combining power2-strided build_vector's where the
first build_vectori's operand is extracted from a non-zero index.

Example:

 v4i32 build_vector((extract_elt V, 1),
                    (extract_elt V, 3),
                    (extract_elt V, 5),
                    (extract_elt V, 7))
 -->
 v4i32 truncate (bitcast (shuffle<1,u,3,u,5,u,7,u> V, u) to v4i64)

Reviewers: delena, RKSimon, guyblank

Reviewed By: RKSimon

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309108 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-26 12:57:03 +00:00
Simon Pilgrim
ae9f3ffd87 [DAG] Move DAGCombiner::GetDemandedBits to SelectionDAG
This patch moves the DAGCombiner::GetDemandedBits function to SelectionDAG::GetDemandedBits as a first step towards making it easier for targets to get to the source of any demanded bits without the limitations of SimplifyDemandedBits.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308983 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-25 16:36:44 +00:00
Francois Pichet
12b7f90cfc Fix endianness bug in DAGCombiner::visitTRUNCATE and visitEXTRACT_VECTOR_ELT
Summary:
Do not assume little endian architecture in DAGCombiner::visitTRUNCATE and DAGCombiner::visitEXTRACT_VECTOR_ELT.
PR33682

Reviewers: hfinkel, sdardis, RKSimon

Reviewed By: sdardis, RKSimon

Subscribers: uabelho, RKSimon, sdardis, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308960 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-25 09:40:35 +00:00
Nirav Dave
484f483ab4 [DAG] Fix typo preventing some stores merges to truncated stores.
Check the actual memory type stored and not the extended value size
when considering if truncated store merge is worthwhile.

Reviewers: efriedma, RKSimon, spatel, jyknight

Reviewed By: efriedma

Subscribers: llvm-commits, nhaehnle

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308833 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-23 02:06:28 +00:00
Xin Tong
9a714ae0d0 [DAGCombiner] Update comment. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308772 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-21 19:10:19 +00:00
Nirav Dave
5de91efd2a [DAG] Commit missed nit cleanup from r308617. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308645 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-20 18:07:57 +00:00
Nirav Dave
7a367b65ba [DAG] Handle missing transform in fold of value extension case.
Summary:
When pushing an extension of a constant bitwise operator on a load
into the load, change other uses of the load value if they exist to
prevent the old load from persisting.

Reviewers: spatel, RKSimon, efriedma

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308618 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-20 13:57:32 +00:00
Nirav Dave
e7505b3af6 [DAG] Optimize away degenerate INSERT_VECTOR_ELT nodes.
Summary:
Add missing vector write of vector read reduction, i.e.:

(insert_vector_elt x (extract_vector_elt x idx) idx) to x

Reviewers: spatel, RKSimon, efriedma

Reviewed By: RKSimon

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308617 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-20 13:48:17 +00:00
Simon Pilgrim
0f6dee58a6 [DAGCombiner] Match ISD::SRL non-uniform constant vectors patterns using predicates.
Use predicate matchers introduced in D35492 to match more ISD::SRL constant folds

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308602 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-20 11:03:30 +00:00
Simon Pilgrim
0c953014bc Remove trailing whitespace. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308601 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-20 10:43:52 +00:00
Simon Pilgrim
272cd527cc [DAGCombiner] Match ISD::SRA non-uniform constant vectors patterns using predicates.
Use predicate matchers introduced in D35492 to match more ISD::SRA constant folds

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308600 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-20 10:43:05 +00:00
Simon Pilgrim
b16c6ff827 [DAGCombiner] Match non-uniform constant vectors using predicates.
Most combines currently recognise scalar and splat-vector constants, but not non-uniform vector constants.

This patch introduces a matching mechanism that uses predicates to check against BUILD_VECTOR of ConstantSDNode, as well as scalar ConstantSDNode cases.

I've changed a couple of predicates to demonstrate - the combine-shl changes add currently unsupported cases, while the MatchRotate replaces an existing mechanism.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308598 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-20 10:13:40 +00:00
Simon Pilgrim
dda2d9fd06 {DAGCombine] Convert (Val & Mask) == Mask to Mask.isSubsetof(Val). NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308460 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-19 13:39:58 +00:00
Nirav Dave
ca6d3f8f6a [DAG] Improve Aliasing of operations to static alloca
Re-recommiting after landing DAG extension-crash fix.

Recommiting after adding check to avoid miscomputing alias information
on addresses of the same base but different subindices.

Memory accesses offset from frame indices may alias, e.g., we
may merge write from function arguments passed on the stack when they
are contiguous. As a result, when checking aliasing, we consider the
underlying frame index's offset from the stack pointer.

Static allocs are realized as stack objects in SelectionDAG, but its
offset is not set until post-DAG causing DAGCombiner's alias check to
consider access to static allocas to frequently alias. Modify isAlias
to consider access between static allocas and access from other frame
objects to be considered aliasing.

Many test changes are included here. Most are fixes for tests which
indirectly relied on our aliasing ability and needed to be modified to
preserve their original intent.

The remaining tests have minor improvements due to relaxed
ordering. The exception is CodeGen/X86/2011-10-19-widen_vselect.ll
which has a minor degradation dispite though the pre-legalized DAG is
improved.

Reviewers: rnk, mkuper, jonpa, hfinkel, uweigand

Reviewed By: rnk

Subscribers: sdardis, nemanjai, javed.absar, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308350 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-18 20:06:24 +00:00
Nirav Dave
4b2509b885 [DAG] Reverse node replacement in extension operation. NFCI.
Reorder replacements to be user first in preparation for multi-level
folding to premptively avoid inadvertantly deleting later nodes from
sharing found from replacement.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308348 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-18 19:49:20 +00:00
Nirav Dave
e9ec240bfb [DAG] Avoid deleting nodes before combining them.
When replacing a node and it's operand, replacing the operand node may
cause the deletion of the original node leading to an assertion
failure. Case around these replacements to avoid this without relying
on inspecting the DELETED_NODE opcode in various extend
dagcombiner cases.

Fixes PR32515.

Reviewers: dbabokin, RKSimon, davide, chandlerc

Subscribers: chandlerc, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308330 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-18 17:39:15 +00:00