Page MenuHomePhabricator

[RISCV] Add CFI directives for RISCV epilog
AbandonedPublic

Authored by Miss_Grape on Feb 8 2022, 10:41 PM.

Diff Detail

Unit TestsFailed

TimeTest
50 msx64 debian > LLVM.CodeGen/RISCV::addrspacecast.ll
Script: -- : 'RUN: at line 2'; /var/lib/buildkite-agent/builds/llvm-project/build/bin/llc -mtriple=riscv32 -verify-machineinstrs < /var/lib/buildkite-agent/builds/llvm-project/llvm/test/CodeGen/RISCV/addrspacecast.ll | /var/lib/buildkite-agent/builds/llvm-project/build/bin/FileCheck /var/lib/buildkite-agent/builds/llvm-project/llvm/test/CodeGen/RISCV/addrspacecast.ll --check-prefix=RV32I
100 msx64 debian > LLVM.CodeGen/RISCV::double-round-conv.ll
Script: -- : 'RUN: at line 2'; /var/lib/buildkite-agent/builds/llvm-project/build/bin/llc -mtriple=riscv32 -mattr=+d -verify-machineinstrs < /var/lib/buildkite-agent/builds/llvm-project/llvm/test/CodeGen/RISCV/double-round-conv.ll -target-abi=ilp32d | /var/lib/buildkite-agent/builds/llvm-project/build/bin/FileCheck -check-prefix=RV32IFD /var/lib/buildkite-agent/builds/llvm-project/llvm/test/CodeGen/RISCV/double-round-conv.ll
50 msx64 debian > LLVM.CodeGen/RISCV::exception-pointer-register.ll
Script: -- : 'RUN: at line 2'; /var/lib/buildkite-agent/builds/llvm-project/build/bin/llc -mtriple=riscv32 -verify-machineinstrs < /var/lib/buildkite-agent/builds/llvm-project/llvm/test/CodeGen/RISCV/exception-pointer-register.ll | /var/lib/buildkite-agent/builds/llvm-project/build/bin/FileCheck /var/lib/buildkite-agent/builds/llvm-project/llvm/test/CodeGen/RISCV/exception-pointer-register.ll -check-prefix=RV32I
130 msx64 debian > LLVM.CodeGen/RISCV::float-round-conv.ll
Script: -- : 'RUN: at line 2'; /var/lib/buildkite-agent/builds/llvm-project/build/bin/llc -mtriple=riscv32 -mattr=+f -verify-machineinstrs < /var/lib/buildkite-agent/builds/llvm-project/llvm/test/CodeGen/RISCV/float-round-conv.ll -target-abi=ilp32f | /var/lib/buildkite-agent/builds/llvm-project/build/bin/FileCheck -check-prefix=RV32IF /var/lib/buildkite-agent/builds/llvm-project/llvm/test/CodeGen/RISCV/float-round-conv.ll
370 msx64 debian > LLVM.CodeGen/RISCV::fpclamptosat.ll
Script: -- : 'RUN: at line 2'; /var/lib/buildkite-agent/builds/llvm-project/build/bin/llc -mtriple=riscv32 -mattr=+f -verify-machineinstrs < /var/lib/buildkite-agent/builds/llvm-project/llvm/test/CodeGen/RISCV/fpclamptosat.ll | /var/lib/buildkite-agent/builds/llvm-project/build/bin/FileCheck -check-prefixes=RV32,RV32IF /var/lib/buildkite-agent/builds/llvm-project/llvm/test/CodeGen/RISCV/fpclamptosat.ll
View Full Test Results (115 Failed)

Event Timeline

Miss_Grape created this revision.Feb 8 2022, 10:41 PM
Miss_Grape requested review of this revision.Feb 8 2022, 10:41 PM

Do you mind add a test case to demonstrate that we've emit .cfi_def_cfa after this patch?

Miss_Grape added a comment.EditedFeb 9 2022, 12:59 AM

Do you mind add a test case to demonstrate that we've emit .cfi_def_cfa after this patch?

The CFI directives is emitted to ensure that it can correctly print the stack debug in the case of debugging. We need to update the CFA in the function Epilogue, otherwise we cannot find the calling relationship of the caller function
The following shows the difference between the debug_frame sections of clang and riscv-unknown-elf-gcc


jrtc27 requested changes to this revision.Feb 9 2022, 5:40 AM

This lack of CFI is deliberate. See https://reviews.llvm.org/D69723 and discussions in https://reviews.llvm.org/D111519. The underlying problem has not been fixed, so we cannot do this.

This revision now requires changes to proceed.Feb 9 2022, 5:40 AM

Perhaps something we can do to avoid this in the future is add a comment to emitEpilogue explaining why we deliberately don't emit CFI directives, pointing to these discussions and a bug number (creating one if no such bug exists)?