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

Kristof Beyls kristof.beyls at arm.com
Mon Apr 27 05:18:18 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();
----------------
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?

http://reviews.llvm.org/D9210

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






More information about the llvm-commits mailing list