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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98491 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling 2010-03-14 10:40:55 +00:00
parent c69b4a5b8b
commit ead138bc62

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,9 +211,13 @@ static bool MergeEmptyReturnBlocks(Function &F) {
// Check for something else in the block.
BasicBlock::iterator I = Ret;
--I;
if (!isa<PHINode>(I) || I != BB.begin() ||
// 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)
Ret->getOperand(0) != I))
continue;
}