[llvm] [ADT] Add and use (for AArch64) `ValueWithSentinel<T, Sentinel>` (PR #158120)

Jakub Kuderski via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 11 10:36:40 PDT 2025


================
@@ -3524,16 +3524,15 @@ bool AArch64FrameLowering::assignCalleeSavedSpillSlots(
   }
 
   // Add hazard slot in the case where no FPR CSRs are present.
-  if (AFI->hasStackHazardSlotIndex() &&
-      HazardSlotIndex == std::numeric_limits<int>::max()) {
+  if (AFI->hasStackHazardSlotIndex() && !HazardSlotIndex.has_value()) {
     HazardSlotIndex = MFI.CreateStackObject(StackHazardSize, Align(8), true);
-    LLVM_DEBUG(dbgs() << "Created CSR Hazard at slot " << HazardSlotIndex
+    LLVM_DEBUG(dbgs() << "Created CSR Hazard at slot " << *HazardSlotIndex
                       << "\n");
-    AFI->setStackHazardCSRSlotIndex(HazardSlotIndex);
-    if ((unsigned)HazardSlotIndex < MinCSFrameIndex)
-      MinCSFrameIndex = HazardSlotIndex;
-    if ((unsigned)HazardSlotIndex > MaxCSFrameIndex)
-      MaxCSFrameIndex = HazardSlotIndex;
+    AFI->setStackHazardCSRSlotIndex(*HazardSlotIndex);
+    if ((unsigned)*HazardSlotIndex < MinCSFrameIndex)
+      MinCSFrameIndex = *HazardSlotIndex;
+    if ((unsigned)*HazardSlotIndex > MaxCSFrameIndex)
+      MaxCSFrameIndex = *HazardSlotIndex;
----------------
kuhar wrote:

Also here

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


More information about the llvm-commits mailing list