[PATCH] D41358: [PowerPC] Fix minor bug to avoid a failure in createTailCallBranchInstr

Stefan Pintilie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 20 11:08:39 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL321205: [PowerPC] Added an assert to make sure that the MBBI iterator is valid. (authored by stefanp, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D41358?vs=127744&id=127763#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D41358

Files:
  llvm/trunk/lib/Target/PowerPC/PPCFrameLowering.cpp


Index: llvm/trunk/lib/Target/PowerPC/PPCFrameLowering.cpp
===================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCFrameLowering.cpp
+++ llvm/trunk/lib/Target/PowerPC/PPCFrameLowering.cpp
@@ -1531,11 +1531,11 @@
 
 void PPCFrameLowering::createTailCallBranchInstr(MachineBasicBlock &MBB) const {
   MachineBasicBlock::iterator MBBI = MBB.getFirstTerminator();
-  DebugLoc dl;
 
-  if (MBBI != MBB.end())
-    dl = MBBI->getDebugLoc();
+  // If we got this far a first terminator should exist.
+  assert(MBBI != MBB.end() && "Failed to find the first terminator.");
 
+  DebugLoc dl = MBBI->getDebugLoc();
   const PPCInstrInfo &TII = *Subtarget.getInstrInfo();
 
   // Create branch instruction for pseudo tail call return instruction


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41358.127763.patch
Type: text/x-patch
Size: 783 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171220/6e6a7ec5/attachment-0001.bin>


More information about the llvm-commits mailing list