llvm / llvm/llvm-project

[RISCV] Missing cfi_def_cfa_offset?

Open
#167,391 8 comments 0 reactions 0 assignees View on GitHub
backend:RISC-V
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

For some stack adjustmnets, the RISC-V backend may emit a 2 adjustments of the stack pointer without a cfi_def_cfa_offset between them. This occurs when the stack adjust is roughly between +/-2048 and +/-4096. In that case we use 2 ADDIs instead of LUI+ADDI+ADD. gcc does something similar, but issues a cfi_def_cfa_offset between them. Should LLVM be emitting a cfi_def_cfa_offset

Example comparing llvm and gcc https://godbolt.org/z/eh63zn7b1

CC: @lenary @ilovepi @MaskRay @preames

Contributor guide

Open the contributing guide

Research direction

Start with the RISC-V backend's stack-adjustment and CFI emission paths; the issue names no source file or test. Reproduce the Godbolt comparison, trace the two-ADDI case, and identify the relevant regression-test location. Done means the intended CFI behavior is established and covered for this adjustment range.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.