[llvm] [AArch64][SVE] Tweak how SVE CFI expressions are emitted (PR #151677)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 4 03:20:41 PDT 2025


================
@@ -5958,17 +5973,25 @@ MCCFIInstruction llvm::createCFAOffset(const TargetRegisterInfo &TRI,
   llvm::raw_string_ostream Comment(CommentBuffer);
   Comment << printReg(Reg, &TRI) << "  @ cfa";
 
-  // Build up expression (NumBytes + NumVGScaledBytes * AArch64::VG)
+  // Build up expression (CFA + VG * NumVGScaledBytes + NumBytes)
+  assert(NumVGScaledBytes && "Expected scalable offset");
   SmallString<64> OffsetExpr;
-  appendVGScaledOffsetExpr(OffsetExpr, NumBytes, NumVGScaledBytes,
-                           TRI.getDwarfRegNum(AArch64::VG, true), Comment);
+  // + VG * NumVGScaledBytes
+  appendOffsetComment(NumVGScaledBytes, Comment, "VG");
----------------
sdesmalen-arm wrote:

nit: maybe pass in `"* VG"` rather than `"VG"`, to make it clear that the comment describes the scaling of NumVGScaledBytes?

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


More information about the llvm-commits mailing list