In "empty" bb, the return instruction may not be first instruction, if dbg value intrinsics are present in this bb. Use terminator to find return instructions.
llvm-svn: 98565
This commit is contained in:
1 parent
0344874921
commit
d3f41e8939
1 file changed
+1
-1
@@ -244,7 +244,7 @@ static bool MergeEmptyReturnBlocks(Function &F) {
|
||||
// If the canonical return block has no PHI node, create one now.
|
||||
PHINode *RetBlockPHI = dyn_cast<PHINode>(RetBlock->begin());
|
||||
if (RetBlockPHI == 0) {
|
||||
Value *InVal = cast<ReturnInst>(RetBlock->begin())->getOperand(0);
|
||||
Value *InVal = cast<ReturnInst>(RetBlock->getTerminator())->getOperand(0);
|
||||
RetBlockPHI = PHINode::Create(Ret->getOperand(0)->getType(), "merge",
|
||||
&RetBlock->front());
|
||||
|
||||
|
||||
Reference in new issue
Block a user