summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar
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
commit55e69d179b53adaab6366f4938bcf3da7cd6402f (patch)
tree3f47db881975f8a2a9e9d1834eacea7f1a571187 /llvm/lib/Transforms/Scalar
parentee84f275367c12acf394032736226aba13001ca2 (diff)
downloadbcm5719-llvm-55e69d179b53adaab6366f4938bcf3da7cd6402f.tar.gz
bcm5719-llvm-55e69d179b53adaab6366f4938bcf3da7cd6402f.zip
Skip over debug info when trying to merge two return BBs.
llvm-svn: 98491
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
-rw-r--r--llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp b/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
index 62f34a2ee06..952d1a8ffb8 100644
--- a/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
+++ b/llvm/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;
OpenPOWER on IntegriCloud