In visitSTORE, always use FindBetterChain, rather than only when UseAA is enabled.
Recommiting with compiler time improvements
Recommitting after fixup of 32-bit aliasing sign offset bug in DAGCombiner.
* Simplify Consecutive Merge Store Candidate Search
Now that address aliasing is much less conservative, push through
simplified store merging search and chain alias analysis which only
checks for parallel stores through the chain subgraph. This is cleaner
as the separation of non-interfering loads/stores from the
store-merging logic.
When merging stores search up the chain through a single load, and
finds all possible stores by looking down from through a load and a
TokenFactor to all stores visited.
This improves the quality of the output SelectionDAG and the output
Codegen (save perhaps for some ARM cases where we correctly constructs
wider loads, but then promotes them to float operations which appear
but requires more expensive constant generation).
Some minor peephole optimizations to deal with improved SubDAG shapes (listed below)
Additional Minor Changes:
1. Finishes removing unused AliasLoad code
2. Unifies the chain aggregation in the merged stores across code
paths
3. Re-add the Store node to the worklist after calling
SimplifyDemandedBits.
4. Increase GatherAllAliasesMaxDepth from 6 to 18. That number is
arbitrary, but seems sufficient to not cause regressions in
tests.
5. Remove Chain dependencies of Memory operations on CopyfromReg
nodes as these are captured by data dependence
6. Forward loads-store values through tokenfactors containing
{CopyToReg,CopyFromReg} Values.
7. Peephole to convert buildvector of extract_vector_elt to
extract_subvector if possible (see
CodeGen/AArch64/store-merge.ll)
8. Store merging for the ARM target is restricted to 32-bit as
some in some contexts invalid 64-bit operations are being
generated. This can be removed once appropriate checks are
added.
This finishes the change Matt Arsenault started in r246307 and
jyknight's original patch.
Many tests required some changes as memory operations are now
reorderable, improving load-store forwarding. One test in
particular is worth noting:
CodeGen/PowerPC/ppc64-align-long-double.ll - Improved load-store
forwarding converts a load-store pair into a parallel store and
a memory-realized bitcast of the same value. However, because we
lose the sharing of the explicit and implicit store values we
must create another local store. A similar transformation
happens before SelectionDAG as well.
Reviewers: arsenm, hfinkel, tstellarAMD, jyknight, nhaehnle
llvm-svn: 297695
2017-03-14 08:34:14 +08:00
|
|
|
; RUN: llc -march=msp430 < %s | FileCheck %s
|
2009-10-12 07:03:28 +08:00
|
|
|
target datalayout = "e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8"
|
|
|
|
target triple = "msp430-generic-generic"
|
|
|
|
@foo = common global i16 0, align 2
|
|
|
|
@bar = common global i16 0, align 2
|
|
|
|
|
2009-10-12 07:03:53 +08:00
|
|
|
define void @mov() nounwind {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: mov:
|
2009-10-12 07:03:53 +08:00
|
|
|
; CHECK: mov.w &bar, &foo
|
2015-02-28 05:17:42 +08:00
|
|
|
%1 = load i16, i16* @bar
|
2009-10-12 07:03:53 +08:00
|
|
|
store i16 %1, i16* @foo
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2009-10-12 07:03:28 +08:00
|
|
|
define void @add() nounwind {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: add:
|
2009-10-12 07:03:28 +08:00
|
|
|
; CHECK: add.w &bar, &foo
|
2015-02-28 05:17:42 +08:00
|
|
|
%1 = load i16, i16* @bar
|
|
|
|
%2 = load i16, i16* @foo
|
2009-10-12 07:03:28 +08:00
|
|
|
%3 = add i16 %2, %1
|
|
|
|
store i16 %3, i16* @foo
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @and() nounwind {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: and:
|
2009-10-12 07:03:28 +08:00
|
|
|
; CHECK: and.w &bar, &foo
|
2015-02-28 05:17:42 +08:00
|
|
|
%1 = load i16, i16* @bar
|
|
|
|
%2 = load i16, i16* @foo
|
2009-10-12 07:03:28 +08:00
|
|
|
%3 = and i16 %2, %1
|
|
|
|
store i16 %3, i16* @foo
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @bis() nounwind {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: bis:
|
2009-10-12 07:03:28 +08:00
|
|
|
; CHECK: bis.w &bar, &foo
|
2015-02-28 05:17:42 +08:00
|
|
|
%1 = load i16, i16* @bar
|
|
|
|
%2 = load i16, i16* @foo
|
2009-10-12 07:03:28 +08:00
|
|
|
%3 = or i16 %2, %1
|
|
|
|
store i16 %3, i16* @foo
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @xor() nounwind {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: xor:
|
2009-10-12 07:03:28 +08:00
|
|
|
; CHECK: xor.w &bar, &foo
|
2015-02-28 05:17:42 +08:00
|
|
|
%1 = load i16, i16* @bar
|
|
|
|
%2 = load i16, i16* @foo
|
2009-10-12 07:03:28 +08:00
|
|
|
%3 = xor i16 %2, %1
|
|
|
|
store i16 %3, i16* @foo
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2010-03-03 06:20:06 +08:00
|
|
|
define i16 @mov2() nounwind {
|
|
|
|
entry:
|
|
|
|
%retval = alloca i16 ; <i16*> [#uses=3]
|
|
|
|
%x = alloca i32, align 2 ; <i32*> [#uses=1]
|
|
|
|
%y = alloca i32, align 2 ; <i32*> [#uses=1]
|
|
|
|
store i16 0, i16* %retval
|
2015-02-28 05:17:42 +08:00
|
|
|
%tmp = load i32, i32* %y ; <i32> [#uses=1]
|
2010-03-03 06:20:06 +08:00
|
|
|
store i32 %tmp, i32* %x
|
|
|
|
store i16 0, i16* %retval
|
2015-02-28 05:17:42 +08:00
|
|
|
%0 = load i16, i16* %retval ; <i16> [#uses=1]
|
2010-03-03 06:20:06 +08:00
|
|
|
ret i16 %0
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: mov2:
|
2017-07-05 09:21:23 +08:00
|
|
|
; CHECK-DAG: mov.w 2(r1), 6(r1)
|
|
|
|
; CHECK-DAG: mov.w 0(r1), 4(r1)
|
2010-03-03 06:20:06 +08:00
|
|
|
}
|