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

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 4 03:58:34 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");
+  appendReadVGRegExpr(OffsetExpr, TRI.getDwarfRegNum(AArch64::VG, true));
+  appendConstantExpr(OffsetExpr, NumVGScaledBytes, dwarf::DW_OP_mul);
+  OffsetExpr.push_back(dwarf::DW_OP_plus);
+  if (NumBytes) {
+    // + NumBytes
----------------
MacDue wrote:

In context, I don't think this is redundant as it's marking the two parts of the expression referenced by the `// Build up expression (CFA + VG * NumVGScaledBytes + NumBytes)` comment.  

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


More information about the llvm-commits mailing list