aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2010-03-14 10:40:55 +0000
committerBill Wendling <isanbard@gmail.com>2010-03-14 10:40:55 +0000
commit4ce7b0f5fb43e4879d66d4b384d7b2b93ada2671 (patch)
tree71c870b3f949ca2c9181af4c7a4dee00c1843c91 /lib/Transforms
parent4c7004c3aa9650dd2114499ecac3a8f310594b4d (diff)
downloadexternal_llvm-4ce7b0f5fb43e4879d66d4b384d7b2b93ada2671.zip
external_llvm-4ce7b0f5fb43e4879d66d4b384d7b2b93ada2671.tar.gz
external_llvm-4ce7b0f5fb43e4879d66d4b384d7b2b93ada2671.tar.bz2
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
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/SimplifyCFGPass.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/SimplifyCFGPass.cpp b/lib/Transforms/Scalar/SimplifyCFGPass.cpp
index 62f34a2..952d1a8 100644
--- a/lib/Transforms/Scalar/SimplifyCFGPass.cpp
+++ b/lib/Transforms/Scalar/SimplifyCFGPass.cpp
@@ -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;