27 Commits

Author SHA1 Message Date
Nirav Dave
30d9733443 [DAGCombiner] Unify Lifetime and memory Op aliasing.
Rework BaseIndexOffset and isAlias to fully work with lifetime nodes
and fold in lifetime alias analysis.

This is mostly NFC.

Reviewers: courbet

Reviewed By: courbet

Subscribers: hiraditya, jdoerfert, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357070 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-27 14:14:46 +00:00
Nirav Dave
1f844702f1 [DAG] Fix constant store folding to handle non-byte sizes.
Avoid crashes from zero-byte values due to sub-byte store sizes.

Reviewers: uabelho, courbet, rnk

Reviewed By: courbet

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354884 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-26 15:02:32 +00:00
Nirav Dave
4eee65a5d3 [DAGCombine] Fold overlapping constant stores
Fold a smaller constant store into larger constant stores immediately
preceeding it.

Reviewers: rnk, courbet

Subscribers: javed.absar, hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354676 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-22 16:00:19 +00:00
Clement Courbet
1da2d4699d Re-land the refactoring part of r354244 "[DAGCombiner] Eliminate dead stores to stack."
This is an NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354476 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-20 15:45:58 +00:00
Clement Courbet
3cfd39d61c Revert r354244 "[DAGCombiner] Eliminate dead stores to stack."
Breaks some bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354245 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-18 08:24:29 +00:00
Clement Courbet
89d8d90473 [DAGCombiner] Eliminate dead stores to stack.
Summary:
A store to an object whose lifetime is about to end can be removed.

See PR40550 for motivation.

Reviewers: niravd

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354244 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-18 07:59:01 +00:00
Clement Courbet
c605438958 [DAG] BaseIndexOffset: FrameIndexSDNodes with the same FrameIndex compare equal.
Reviewers: niravd

Subscribers: arphaman, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353143 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-05 07:36:20 +00:00
Clement Courbet
cc98a273f0 [SelectionDAG] Add a BaseIndexOffset::print() method for debugging.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353028 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-04 09:30:43 +00:00
Chandler Carruth
6b547686c5 Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351636 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-19 08:50:56 +00:00
Craig Topper
406f960c8c [SelectionDAG] Teach BaseIndexOffset::match to unwrap the base after looking through an add/or
We might find a target specific node that needs to be unwrapped after we look through an add/or. Otherwise we get inconsistent results if one pointer is just X86WrapperRIP and the other is (add X86WrapperRIP, C)

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347591 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-26 20:16:33 +00:00
Nirav Dave
b79937c973 [DAG] Add const variants for BaseIndexOffset functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@345623 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-30 18:26:43 +00:00
Nirav Dave
3455380959 [DAG] Teach findBaseOffset to interpret indexes of indexed memory operations
Indexed outputs are addition / subtractions and can be interpreted as such.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323539 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-26 16:51:27 +00:00
Nirav Dave
80fc28f975 [DAG] Teach BaseIndexOffset to correctly handle with indexed operations
BaseIndexOffset address analysis incorrectly ignores offsets folded
into indexed memory operations causing potential errors in alias
analysis of pre-indexed operations.

Reviewers: efriedma, RKSimon, hfinkel, jyknight

Subscribers: hiraditya, javed.absar, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322003 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-08 16:21:35 +00:00
Nirav Dave
5d9f5f4088 Integrate findBaseOffset address analyses to BaseIndexOffset. NFCI.
BaseIndexOffset supercedes findBaseOffset analysis save only Constant
Pool addresses. Migrate analysis to BaseIndexOffset.

Relanding after correcting base address matching check.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321389 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-22 21:20:55 +00:00
Nirav Dave
ecdc6849ca Revert "[DAG] Integrate findBaseOffset address analyses to BaseIndexOffset. NFCI."
which was causing miscompilations in for some test-suite components.

This reverts commit 3e9de9ff0f3162920a2a3cba51c7dc14b54b4d16.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321380 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-22 19:33:56 +00:00
Nirav Dave
24bf4ab201 [DAG] Integrate findBaseOffset address analyses to BaseIndexOffset. NFCI.
BaseIndexOffset supercedes findBaseOffset analysis save only Constant
Pool addresses. Migrate analysis to BaseIndexOffset.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321364 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-22 16:59:09 +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
Eugene Zelenko
16ffaf8e76 [CodeGen] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313194 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-13 21:15:20 +00:00
Nirav Dave
b872fbbb3d [X86][DAG] Switch X86 Target to post-legalized store merge
Move store merge to happen after intrinsic lowering to allow lowered
stores to be merged.

Some regressions due in MergeConsecutiveStores to missing
insert_subvector that are addressed in follow up patch.

Reviewers: craig.topper, efriedma, RKSimon

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310710 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-11 13:21:35 +00:00
Nirav Dave
3f4f926b6a Rewrite areNonVolatileConsecutiveLoads to use BaseIndexOffset
Relanding after rewriting undef.ll test to avoid host-dependant
endianness.

As discussed in D34087, rewrite areNonVolatileConsecutiveLoads using
generic checks. Also, propagate missing local handling from there to
BaseIndexOffset checks.

Tests of note:

  * test/CodeGen/X86/build-vector* - Improved.
  * test/CodeGen/BPF/undef.ll - Improved store alignment allows an
    additional store merge

  * test/CodeGen/X86/clear_upper_vector_element_bits.ll - This is a
    case we already do not handle well. Here, the DAG is improved, but
    scheduling causes a code size degradation.

Reviewers: RKSimon, craig.topper, spatel, andreadb, filcab

Subscribers: nemanjai, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307114 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-05 01:21:23 +00:00
Nirav Dave
32524dd4da [DAG] Fixed predicate for determining when two frame indices
addresses are comparable. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307055 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-04 02:20:17 +00:00
Nirav Dave
d1814a363f Revert "[DAG] Rewrite areNonVolatileConsecutiveLoads to use BaseIndexOffset"
This reverts commit r306819 which appears be exposing underlying
issues in a stage1 ppc64be build

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306820 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-30 12:56:02 +00:00
Nirav Dave
8f57a78615 [DAG] Rewrite areNonVolatileConsecutiveLoads to use BaseIndexOffset
As discussed in D34087, rewrite areNonVolatileConsecutiveLoads using
generic checks. Also, propagate missing local handling from there to
BaseIndexOffset checks.

Tests of note:

  * test/CodeGen/X86/build-vector* - Improved.
  * test/CodeGen/BPF/undef.ll - Improved store alignment allows an
    additional store merge

  * test/CodeGen/X86/clear_upper_vector_element_bits.ll - This is a
    case we already do not handle well. Here, the DAG is improved, but
    scheduling causes a code size degradation.

Reviewers: RKSimon, craig.topper, spatel, andreadb, filcab

Subscribers: nemanjai, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306819 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-30 12:23:41 +00:00
Nirav Dave
8ebfef5200 [DAG] Fold FrameIndex offset into BaseIndexOffset analysis. NFCI.
Relanding after restricting equalBaseIndex to not erroneuosly consider
a FrameIndices stemming from alloca from being comparable as its
offset is set post-selectionDAG.

Pull FrameIndex comparision reasoning from DAGCombiner::isAlias to
general BaseIndexOffset.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306688 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-29 15:48:11 +00:00
Nirav Dave
af639e8d6c Revert "[DAG] Fold FrameIndex offset into BaseIndexOffset analysis. NFCI."
This reverts commit r306498 which appears to cause a compilrt-rt test failures

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306501 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-28 03:20:04 +00:00
Nirav Dave
64a075b52c [DAG] Fold FrameIndex offset into BaseIndexOffset analysis. NFCI.
Pull FrameIndex comparision reasoning from DAGCombiner::isAlias to
general BaseIndexOffset.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306498 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-28 02:09:50 +00:00
Nirav Dave
34e56f0bf7 [DAG] Move BaseIndexOffset into separate Libarary. NFC.
Move BaseIndexOffset analysis out of DAGCombiner for use in other
files.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305921 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-21 15:40:43 +00:00