[PATCH] Add a shrink-wrapping pass to improve the placement of prologue and epilogue.

Quentin Colombet qcolombet at apple.com
Tue Apr 28 09:58:50 PDT 2015


================
Comment at: lib/Target/AArch64/AArch64FrameLowering.cpp:538-543
@@ -538,5 +537,8 @@
       MF.getSubtarget().getRegisterInfo());
-  DebugLoc DL = MBBI->getDebugLoc();
-  unsigned RetOpcode = MBBI->getOpcode();
-
+  DebugLoc DL;
+  unsigned RetOpcode = 0;
+  if (MBB.end() != MBBI) {
+    DL = MBBI->getDebugLoc();
+    RetOpcode = MBBI->getOpcode();
+  }
   int NumBytes = MFI->getStackSize();
----------------
qcolombet wrote:
> kristof.beyls wrote:
> > I guess this code sequence will lead to DL sometimes being uninitialized.
> > I'm not sure when "MBB.end() != MBBI", but in that situation, can't you get a reasonable debug location from somewhere else?
> > 
> > If the RetOpcode variable is only used to detect tail call returns, maybe it's better to replace it with a bool variable called "isTailCallReturn" or something similar,
> > and use that later on, instead of explicitly checking what the value is?
> > 
> I guess I can use MBB.findDebugLoc() with some sensible iterator.
> I will check.
> 
> Same for RetOpcode, thanks for the feedback.
I haven’t changed the handling of the debug information. It is indeed consistent with what is done  AArch64FrameLowering::spillCalleeSavedRegisters and AArch64FrameLowering::restoreCalleeSavedRegisters.
Therefore, I think that if we want to fix that, we should do it consistently at these three places.

What do you think?

http://reviews.llvm.org/D9210

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list