[llvm] r321205 - [PowerPC] Added an assert to make sure that the MBBI iterator is valid.
Stefan Pintilie via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 20 11:07:44 PST 2017
Author: stefanp
Date: Wed Dec 20 11:07:44 2017
New Revision: 321205
URL: http://llvm.org/viewvc/llvm-project?rev=321205&view=rev
Log:
[PowerPC] Added an assert to make sure that the MBBI iterator is valid.
The function createTailCallBranchInstr assumes that the iterator MBBI is valid.
However, only one use of MBBI is guarded in the function.
Fix this by adding an assert.
Differential Revision: https://reviews.llvm.org/D41358
Modified:
llvm/trunk/lib/Target/PowerPC/PPCFrameLowering.cpp
Modified: llvm/trunk/lib/Target/PowerPC/PPCFrameLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCFrameLowering.cpp?rev=321205&r1=321204&r2=321205&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCFrameLowering.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCFrameLowering.cpp Wed Dec 20 11:07:44 2017
@@ -1531,11 +1531,11 @@ void PPCFrameLowering::emitEpilogue(Mach
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
More information about the llvm-commits
mailing list