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

Quentin Colombet qcolombet at apple.com
Mon Apr 27 09:52:52 PDT 2015


REPOSITORY
  rL LLVM

================
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();
----------------
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.

http://reviews.llvm.org/D9210

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






More information about the llvm-commits mailing list