aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/CodeGenPrepare.cpp
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2009-03-27 01:13:37 +0000
committerDale Johannesen <dalej@apple.com>2009-03-27 01:13:37 +0000
commit2d69724938e67ec248e0ba42f86287923b3a5171 (patch)
tree1e6dfdf4e51b3923bcf4127af4912022d8855789 /lib/Transforms/Scalar/CodeGenPrepare.cpp
parentfafd98b23e9ae9058196f6375c2e79a5845a8cc2 (diff)
One more place to skip debug info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67811 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/CodeGenPrepare.cpp')
-rw-r--r--lib/Transforms/Scalar/CodeGenPrepare.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/Transforms/Scalar/CodeGenPrepare.cpp b/lib/Transforms/Scalar/CodeGenPrepare.cpp
index b0214e030d..4eb49e9a95 100644
--- a/lib/Transforms/Scalar/CodeGenPrepare.cpp
+++ b/lib/Transforms/Scalar/CodeGenPrepare.cpp
@@ -145,10 +145,11 @@ bool CodeGenPrepare::runOnFunction(Function &F) {
return EverMadeChange;
}
-/// EliminateMostlyEmptyBlocks - eliminate blocks that contain only PHI nodes
-/// and an unconditional branch. Passes before isel (e.g. LSR/loopsimplify)
-/// often split edges in ways that are non-optimal for isel. Start by
-/// eliminating these blocks so we can split them the way we want them.
+/// EliminateMostlyEmptyBlocks - eliminate blocks that contain only PHI nodes,
+/// debug info directives, and an unconditional branch. Passes before isel
+/// (e.g. LSR/loopsimplify) often split edges in ways that are non-optimal for
+/// isel. Start by eliminating these blocks so we can split them the way we
+/// want them.
bool CodeGenPrepare::EliminateMostlyEmptyBlocks(Function &F) {
bool MadeChange = false;
// Note that this intentionally skips the entry block.
@@ -160,12 +161,18 @@ bool CodeGenPrepare::EliminateMostlyEmptyBlocks(Function &F) {
if (!BI || !BI->isUnconditional())
continue;
- // If the instruction before the branch isn't a phi node, then other stuff
- // is happening here.
+ // If the instruction before the branch (skipping debug info) isn't a phi
+ // node, then other stuff is happening here.
BasicBlock::iterator BBI = BI;
if (BBI != BB->begin()) {
--BBI;
- if (!isa<PHINode>(BBI)) continue;
+ while (isa<DbgInfoIntrinsic>(BBI)) {
+ if (BBI == BB->begin())
+ break;
+ --BBI;
+ }
+ if (!isa<DbgInfoIntrinsic>(BBI) && !isa<PHINode>(BBI))
+ continue;
}
// Do not break infinite loops.