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