[llvm] Negative frame indicies as register. (PR #164459)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 21 12:46:09 PDT 2025


================
@@ -87,7 +91,7 @@ class Register {
   /// Compute the frame index from a register value representing a stack slot.
   int stackSlotIndex() const {
     assert(isStack() && "Not a stack slot");
-    return static_cast<int>(Reg - Register::FirstStackSlot);
+    return static_cast<int>(SignExtend64(Reg & Register::StackSlotMask, 30));
----------------
topperc wrote:

Use `SignExtend64<30>`

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


More information about the llvm-commits mailing list