[llvm] [llvm] Support multiple save/restore points in mir (PR #119357)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 7 13:20:03 PDT 2025


================
@@ -92,11 +92,23 @@ static void cloneFrameInfo(
   DstMFI.setCVBytesOfCalleeSavedRegisters(
       SrcMFI.getCVBytesOfCalleeSavedRegisters());
 
-  if (MachineBasicBlock *SavePt = SrcMFI.getSavePoint())
-    DstMFI.setSavePoint(Src2DstMBB.find(SavePt)->second);
-  if (MachineBasicBlock *RestorePt = SrcMFI.getRestorePoint())
-    DstMFI.setRestorePoint(Src2DstMBB.find(RestorePt)->second);
+  assert(SrcMFI.getSavePoints().size() < 2 &&
+         "MFI can't contain multiple save points!");
+  if (!SrcMFI.getSavePoints().empty()) {
----------------
preames wrote:

This code isn't correct or stylistically a good idea.  Handle the general case of an array of save/restore points, and the incorrect bit (incorrect handling of empty source) falls out for free.

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


More information about the llvm-commits mailing list