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
27 lines
577 B
YAML
27 lines
577 B
YAML
# REQUIRES: asserts
|
|
# RUN: not --crash llc -o - %s -mtriple=x86_64-- \
|
|
# RUN: -run-pass=cfi-instr-inserter 2>&1 | FileCheck %s
|
|
# Test that CSR being saved in multiple locations can be caught by
|
|
# an assertion.
|
|
--- |
|
|
define void @inconsistentlocs() {
|
|
bb.end:
|
|
ret void
|
|
}
|
|
...
|
|
---
|
|
# CHECK: Different saved locations for the same CSR
|
|
# CHECK-NEXT: UNREACHABLE executed
|
|
name: inconsistentlocs
|
|
body: |
|
|
bb.0:
|
|
CFI_INSTRUCTION offset $r12, -8
|
|
JCC_1 %bb.2, 5, implicit undef $eflags
|
|
|
|
bb.1:
|
|
CFI_INSTRUCTION offset $r12, -16
|
|
|
|
bb.2.bb.end:
|
|
RET 0
|
|
...
|