1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

Skip over debug info when trying to merge two return BBs.

llvm-svn: 98491
This commit is contained in:
Bill Wendling 2010-03-14 10:40:55 +00:00
parent 3320ee3d10
commit 0b0be33c46

View File

@ -26,6 +26,7 @@
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Constants.h"
#include "llvm/Instructions.h"
#include "llvm/IntrinsicInst.h"
#include "llvm/Module.h"
#include "llvm/Attributes.h"
#include "llvm/Support/CFG.h"
@ -210,12 +211,16 @@ static bool MergeEmptyReturnBlocks(Function &F) {
// Check for something else in the block.
BasicBlock::iterator I = Ret;
--I;
if (!isa<PHINode>(I) || I != BB.begin() ||
Ret->getNumOperands() == 0 ||
Ret->getOperand(0) != I)
// Skip over debug info.
while (isa<DbgInfoIntrinsic>(I) && I != BB.begin())
--I;
if (!isa<DbgInfoIntrinsic>(I) &&
(!isa<PHINode>(I) || I != BB.begin() ||
Ret->getNumOperands() == 0 ||
Ret->getOperand(0) != I))
continue;
}
// If this is the first returning block, remember it and keep going.
if (RetBlock == 0) {
RetBlock = &BB;