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
63 lines
2.1 KiB
LLVM
63 lines
2.1 KiB
LLVM
; RUN: llc -verify-machineinstrs -mcpu=pwr7 -O0 -fast-isel=false -mattr=-vsx < %s | FileCheck %s
|
|
; RUN: llc -verify-machineinstrs -mcpu=pwr7 -O0 -fast-isel=false -mattr=+vsx < %s | FileCheck -check-prefix=CHECK-VSX %s
|
|
; RUN: llc -verify-machineinstrs -mcpu=pwr9 -O0 -fast-isel=false -mattr=+vsx < %s | FileCheck -check-prefix=CHECK-P9 %s
|
|
|
|
; Verify internal alignment of long double in a struct. The double
|
|
; argument comes in in GPR3; GPR4 is skipped; GPRs 5 and 6 contain
|
|
; the long double. Check that these are stored to proper locations
|
|
; in the parameter save area and loaded from there for return in FPR1/2.
|
|
|
|
target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
|
|
target triple = "powerpc64-unknown-linux-gnu"
|
|
|
|
%struct.S = type { double, ppc_fp128 }
|
|
|
|
define ppc_fp128 @test(%struct.S* byval %x) nounwind {
|
|
entry:
|
|
%b = getelementptr inbounds %struct.S, %struct.S* %x, i32 0, i32 1
|
|
%0 = load ppc_fp128, ppc_fp128* %b, align 16
|
|
ret ppc_fp128 %0
|
|
}
|
|
|
|
; The additional stores are caused because we forward the value in the
|
|
; store->load->bitcast path to make a store and bitcast of the same
|
|
; value. Since the target does bitcast through memory and we no longer
|
|
; remember the address we need to do the store in a fresh local
|
|
; address.
|
|
|
|
; CHECK-DAG: std 6, 72(1)
|
|
; CHECK-DAG: std 5, 64(1)
|
|
; CHECK-DAG: std 4, 56(1)
|
|
; CHECK-DAG: std 3, 48(1)
|
|
|
|
; CHECK-DAG: std 5, -16(1)
|
|
; CHECK-DAG: std 6, -8(1)
|
|
; CHECK-DAG: lfd 1, -16(1)
|
|
; CHECK-DAG: lfd 2, -8(1)
|
|
|
|
; FIXMECHECK: lfd 1, 64(1)
|
|
; FIXMECHECK: lfd 2, 72(1)
|
|
|
|
; CHECK-VSX-DAG: std 6, 72(1)
|
|
; CHECK-VSX-DAG: std 5, 64(1)
|
|
; CHECK-VSX-DAG: std 4, 56(1)
|
|
; CHECK-VSX-DAG: std 3, 48(1)
|
|
; CHECK-VSX-DAG: std 5, -16(1)
|
|
; CHECK-VSX-DAG: std 6, -8(1)
|
|
; CHECK-VSX: addi 3, 1, -16
|
|
; CHECK-VSX: lxsdx 1, 0, 3
|
|
; CHECK-VSX: addi 3, 1, -8
|
|
; CHECK-VSX: lxsdx 2, 0, 3
|
|
|
|
; FIXME-VSX: addi 4, 1, 48
|
|
; FIXME-VSX: lxsdx 1, 4, 3
|
|
; FIXME-VSX: li 3, 24
|
|
; FIXME-VSX: lxsdx 2, 4, 3
|
|
|
|
; CHECK-P9: std 6, 72(1)
|
|
; CHECK-P9: std 5, 64(1)
|
|
; CHECK-P9: std 4, 56(1)
|
|
; CHECK-P9: std 3, 48(1)
|
|
; CHECK-P9: mtvsrd 1, 5
|
|
; CHECK-P9: mtvsrd 2, 6
|