mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
da8d6f5e6f
like .cfi_restore" Insert .cfi_offset/.cfi_register when IncomingCSRSaved of current block is larger than OutgoingCSRSaved of its previous block. Original commit message: https://reviews.llvm.org/D42848 only handled CFA related cfi directives but didn't handle CSR related cfi. The patch adds the CSR part. Basically it reuses the framework created in D42848. For each basicblock, the patch tracks which CSR set have been saved at its CFG predecessors's exits, and compare the CSR set with the set at its previous basicblock's exit (The previous block is the block laid before the current block). If the saved CSR set at its previous basicblock's exit is larger, .cfi_restore will be inserted. The patch also generates proper .cfi_restore in epilogue to make sure the saved CSR set is consistent for the incoming edges of each block. Differential Revision: https://reviews.llvm.org/D74303
29 lines
675 B
YAML
29 lines
675 B
YAML
# RUN: not --crash llc -o - %s -mtriple=x86_64-- -verify-cfiinstrs \
|
|
# RUN: -run-pass=cfi-instr-inserter 2>&1 | FileCheck %s
|
|
# Test that CFI verifier finds inconsistent csr saved set between bb.end and
|
|
# one of its precedessors.
|
|
--- |
|
|
define void @inconsistentCSR() {
|
|
entry:
|
|
br label %then
|
|
then:
|
|
br label %end
|
|
end:
|
|
ret void
|
|
}
|
|
...
|
|
---
|
|
# CHECK: *** Inconsistent CSR Saved between pred and succ in function inconsistentCSR ***
|
|
# CHECK: LLVM ERROR: Found 1 in/out CFI information errors.
|
|
name: inconsistentCSR
|
|
body: |
|
|
bb.0.entry:
|
|
JCC_1 %bb.2, 5, implicit undef $eflags
|
|
|
|
bb.1.then:
|
|
CFI_INSTRUCTION offset $rbp, -16
|
|
|
|
bb.2.end:
|
|
RET 0
|
|
...
|