summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2010-03-15 19:05:46 +0000
committerDevang Patel <dpatel@apple.com>2010-03-15 19:05:46 +0000
commitd3f41e8939dbca4c460de44d0ec00c10dca0fb05 (patch)
treefde841b51b553d61a04ade1585c00715392b34a6 /llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
parent0344874921e292cae4bd8b788eed1d782280f142 (diff)
downloadbcm5719-llvm-d3f41e8939dbca4c460de44d0ec00c10dca0fb05.tar.gz
bcm5719-llvm-d3f41e8939dbca4c460de44d0ec00c10dca0fb05.zip
In "empty" bb, the return instruction may not be first instruction, if dbg value intrinsics are present in this bb. Use terminator to find return instructions.
llvm-svn: 98565
Diffstat (limited to 'llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp b/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
index 952d1a8ffb8..738c5e8d13d 100644
--- a/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
+++ b/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
@@ -244,7 +244,7 @@ static bool MergeEmptyReturnBlocks(Function &F) {
// If the canonical return block has no PHI node, create one now.
PHINode *RetBlockPHI = dyn_cast<PHINode>(RetBlock->begin());
if (RetBlockPHI == 0) {
- Value *InVal = cast<ReturnInst>(RetBlock->begin())->getOperand(0);
+ Value *InVal = cast<ReturnInst>(RetBlock->getTerminator())->getOperand(0);
RetBlockPHI = PHINode::Create(Ret->getOperand(0)->getType(), "merge",
&RetBlock->front());
OpenPOWER on IntegriCloud