[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 09:09:00 PST 2017
stefanp updated this revision to Diff 127744.
stefanp added a comment.
@hfinkel
Hi Hal,
Thank you for the approval. After doing a bit more investigation I realized that the condition should always be true. Before calling this function we always check that this is a return block. Therefore, I've change it slightly so that the guard is now an assert.
https://reviews.llvm.org/D41358
Files:
lib/Target/PowerPC/PPCFrameLowering.cpp
Index: lib/Target/PowerPC/PPCFrameLowering.cpp
===================================================================
--- lib/Target/PowerPC/PPCFrameLowering.cpp
+++ 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.127744.patch
Type: text/x-patch
Size: 750 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171220/c419ca5d/attachment.bin>
More information about the llvm-commits
mailing list