Issue #58168 describes the difficulty diagnosing stack size issues identified by -Wframe-larger-than. For simple code, its easy to understand the stack layout and where space is being allocated, but in more complex programs, where code may be heavily inlined, unrolled, and have duplicated code paths, it is no longer easy to manually inspect the source program and understand where stack space can be attributed. This patch implements a machine function pass that emits remarks with a textual representation of stack slots, and also outputs any available debug information to map source variables to those slots. The new behavior can be used by adding `-Rpass-analysis=stack-frame-layout` to the compiler invocation. Like other remarks the diagnostic information can be saved to a file in a machine readable format by adding -fsave-optimzation-record. Fixes: #58168 Reviewed By: nickdesaulniers, thegameg Differential Revision: https://reviews.llvm.org/D135488
45 lines
2.6 KiB
LLVM
45 lines
2.6 KiB
LLVM
; NVPTX customizes the list of passes so the test cannot find what it expects
|
|
; XFAIL: target=nvptx{{.*}}
|
|
|
|
; Note: -verify-machineinstrs is used in order to make this test compatible with EXPENSIVE_CHECKS.
|
|
; RUN: llc < %s -debug-pass=Structure -stop-after=loop-reduce -verify-machineinstrs -o /dev/null 2>&1 \
|
|
; RUN: | FileCheck %s -check-prefix=STOP-AFTER
|
|
; STOP-AFTER: -loop-reduce
|
|
; STOP-AFTER: Dominator Tree Construction
|
|
; STOP-AFTER: Loop Strength Reduction
|
|
; STOP-AFTER-NEXT: Verify generated machine code
|
|
; STOP-AFTER-NEXT: Lazy Machine Block Frequency Analysis
|
|
; STOP-AFTER-NEXT: Machine Optimization Remark Emitter
|
|
; STOP-AFTER-NEXT: Stack Frame Layout Analysis
|
|
; STOP-AFTER-NEXT: MIR Printing Pass
|
|
|
|
; RUN: llc < %s -debug-pass=Structure -stop-before=loop-reduce -o /dev/null 2>&1 | FileCheck %s -check-prefix=STOP-BEFORE
|
|
; STOP-BEFORE-NOT: -loop-reduce
|
|
; STOP-BEFORE: Dominator Tree Construction
|
|
; STOP-BEFORE-NOT: Loop Strength Reduction
|
|
|
|
; RUN: llc < %s -debug-pass=Structure -start-after=loop-reduce -o /dev/null 2>&1 | FileCheck %s -check-prefix=START-AFTER
|
|
; START-AFTER: -aa -mergeicmps
|
|
; START-AFTER: FunctionPass Manager
|
|
; START-AFTER-NEXT: Dominator Tree Construction
|
|
|
|
; RUN: llc < %s -debug-pass=Structure -start-before=loop-reduce -o /dev/null 2>&1 | FileCheck %s -check-prefix=START-BEFORE
|
|
; START-BEFORE: -machine-branch-prob -regalloc-evict -regalloc-priority -domtree
|
|
; START-BEFORE: FunctionPass Manager
|
|
; START-BEFORE: Loop Strength Reduction
|
|
; START-BEFORE-NEXT: Basic Alias Analysis (stateless AA impl)
|
|
|
|
; RUN: not --crash llc < %s -start-before=nonexistent -o /dev/null 2>&1 | FileCheck %s -check-prefix=NONEXISTENT-START-BEFORE
|
|
; RUN: not --crash llc < %s -stop-before=nonexistent -o /dev/null 2>&1 | FileCheck %s -check-prefix=NONEXISTENT-STOP-BEFORE
|
|
; RUN: not --crash llc < %s -start-after=nonexistent -o /dev/null 2>&1 | FileCheck %s -check-prefix=NONEXISTENT-START-AFTER
|
|
; RUN: not --crash llc < %s -stop-after=nonexistent -o /dev/null 2>&1 | FileCheck %s -check-prefix=NONEXISTENT-STOP-AFTER
|
|
; NONEXISTENT-START-BEFORE: "nonexistent" pass is not registered.
|
|
; NONEXISTENT-STOP-BEFORE: "nonexistent" pass is not registered.
|
|
; NONEXISTENT-START-AFTER: "nonexistent" pass is not registered.
|
|
; NONEXISTENT-STOP-AFTER: "nonexistent" pass is not registered.
|
|
|
|
; RUN: not --crash llc < %s -start-before=loop-reduce -start-after=loop-reduce -o /dev/null 2>&1 | FileCheck %s -check-prefix=DOUBLE-START
|
|
; RUN: not --crash llc < %s -stop-before=loop-reduce -stop-after=loop-reduce -o /dev/null 2>&1 | FileCheck %s -check-prefix=DOUBLE-STOP
|
|
; DOUBLE-START: start-before and start-after specified!
|
|
; DOUBLE-STOP: stop-before and stop-after specified!
|