mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-21 00:32:23 +00:00
a6425604c2
insertions. The old behavior could cause arbitrarily bad memory usage in the DAG combiner if there was heavy traffic of adding nodes already on the worklist to it. This commit switches the DAG combine worklist to work the same way as the instcombine worklist where we null-out removed entries and only add new entries to the worklist. My measurements of codegen time shows slight improvement. The memory utilization is unsurprisingly dominated by other factors (the IR and DAG itself I suspect). This change results in subtle, frustrating churn in the particular order in which DAG combines are applied which causes a number of minor regressions where we fail to match a pattern previously matched by accident. AFAICT, all of these should be using AddToWorklist to directly or should be written in a less brittle way. None of the changes seem drastically bad, and a few of the changes seem distinctly better. A major change required to make this work is to significantly harden the way in which the DAG combiner handle nodes which become dead (zero-uses). Previously, we relied on the ability to "priority-bump" them on the combine worklist to achieve recursive deletion of these nodes and ensure that the frontier of remaining live nodes all were added to the worklist. Instead, I've introduced a routine to just implement that precise logic with no indirection. It is a significantly simpler operation than that of the combiner worklist proper. I suspect this will also fix some other problems with the combiner. I think the x86 changes are really minor and uninteresting, but the avx512 change at least is hiding a "regression" (despite the test case being just noise, not testing some performance invariant) that might be looked into. Not sure if any of the others impact specific "important" code paths, but they didn't look terribly interesting to me, or the changes were really minor. The consensus in review is to fix any regressions that show up after the fact here. Thanks to the other reviewers for checking the output on other architectures. There is a specific regression on ARM that Tim already has a fix prepped to commit. Differential Revision: http://reviews.llvm.org/D4616 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213727 91177308-0d34-0410-b5e6-96231b3b80d8
56 lines
2.2 KiB
LLVM
56 lines
2.2 KiB
LLVM
; RUN: llc -mcpu=ppc64 -O0 < %s | FileCheck %s
|
|
|
|
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"
|
|
|
|
define { ppc_fp128, ppc_fp128 } @foo() nounwind {
|
|
entry:
|
|
%retval = alloca { ppc_fp128, ppc_fp128 }, align 16
|
|
%x = alloca { ppc_fp128, ppc_fp128 }, align 16
|
|
%real = getelementptr inbounds { ppc_fp128, ppc_fp128 }* %x, i32 0, i32 0
|
|
%imag = getelementptr inbounds { ppc_fp128, ppc_fp128 }* %x, i32 0, i32 1
|
|
store ppc_fp128 0xM400C0000000000000000000000000000, ppc_fp128* %real
|
|
store ppc_fp128 0xMC00547AE147AE1483CA47AE147AE147A, ppc_fp128* %imag
|
|
%x.realp = getelementptr inbounds { ppc_fp128, ppc_fp128 }* %x, i32 0, i32 0
|
|
%x.real = load ppc_fp128* %x.realp
|
|
%x.imagp = getelementptr inbounds { ppc_fp128, ppc_fp128 }* %x, i32 0, i32 1
|
|
%x.imag = load ppc_fp128* %x.imagp
|
|
%real1 = getelementptr inbounds { ppc_fp128, ppc_fp128 }* %retval, i32 0, i32 0
|
|
%imag2 = getelementptr inbounds { ppc_fp128, ppc_fp128 }* %retval, i32 0, i32 1
|
|
store ppc_fp128 %x.real, ppc_fp128* %real1
|
|
store ppc_fp128 %x.imag, ppc_fp128* %imag2
|
|
%0 = load { ppc_fp128, ppc_fp128 }* %retval
|
|
ret { ppc_fp128, ppc_fp128 } %0
|
|
}
|
|
|
|
; CHECK-LABEL: foo:
|
|
; CHECK: lfd 1
|
|
; CHECK: lfd 2
|
|
; CHECK: lfd 3
|
|
; CHECK: lfd 4
|
|
|
|
define { float, float } @oof() nounwind {
|
|
entry:
|
|
%retval = alloca { float, float }, align 4
|
|
%x = alloca { float, float }, align 4
|
|
%real = getelementptr inbounds { float, float }* %x, i32 0, i32 0
|
|
%imag = getelementptr inbounds { float, float }* %x, i32 0, i32 1
|
|
store float 3.500000e+00, float* %real
|
|
store float 0xC00547AE20000000, float* %imag
|
|
%x.realp = getelementptr inbounds { float, float }* %x, i32 0, i32 0
|
|
%x.real = load float* %x.realp
|
|
%x.imagp = getelementptr inbounds { float, float }* %x, i32 0, i32 1
|
|
%x.imag = load float* %x.imagp
|
|
%real1 = getelementptr inbounds { float, float }* %retval, i32 0, i32 0
|
|
%imag2 = getelementptr inbounds { float, float }* %retval, i32 0, i32 1
|
|
store float %x.real, float* %real1
|
|
store float %x.imag, float* %imag2
|
|
%0 = load { float, float }* %retval
|
|
ret { float, float } %0
|
|
}
|
|
|
|
; CHECK-LABEL: oof:
|
|
; CHECK: lfs 2
|
|
; CHECK: lfs 1
|
|
|