[llvm-commits] [llvm] r67811 - /llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp
Dale Johannesen
dalej at apple.com
Thu Mar 26 18:13:38 PDT 2009
Author: johannes
Date: Thu Mar 26 20:13:37 2009
New Revision: 67811
URL: http://llvm.org/viewvc/llvm-project?rev=67811&view=rev
Log:
One more place to skip debug info.
Modified:
llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp?rev=67811&r1=67810&r2=67811&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp Thu Mar 26 20:13:37 2009
@@ -145,10 +145,11 @@
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 @@
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.
More information about the llvm-commits
mailing list