[llvm] [RISCV] Guard CFI emission code with MF.needsFrameMoves() (PR #136060)

Sergei Barannikov via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 17 05:54:46 PDT 2025


s-barannikov wrote:

This is a good point, I didn't see it from this perspective.
I have a couple of thoughts on this, but I'm not sure if this is enough justification for the change.
* Prologue instructions have limited mobility as they usually are (or surrounded by) SP-modifying instructions, for which `TII::isSchedulingBoundary()` returns true (unless overridden). Most CFI instructions are in the prologue/epilogue section, and dropping them shouldn't result in significant increase of the scheduling region size.
* Two of the most mature targets (X86 and AArch64) almost never emit CFI unless these instructions are necessary. (I submitted #135648 to fix the remaining cases on X86, and was about to do the same for AArch64.). It seems like they don't care that much?

Let me consider it a bit more.


https://github.com/llvm/llvm-project/pull/136060


More information about the llvm-commits mailing list