[cfe-commits] r59211 - /cfe/trunk/lib/CodeGen/CGStmt.cpp
Daniel Dunbar
daniel at zuster.org
Wed Nov 12 17:54:24 PST 2008
Author: ddunbar
Date: Wed Nov 12 19:54:24 2008
New Revision: 59211
URL: http://llvm.org/viewvc/llvm-project?rev=59211&view=rev
Log:
Supply finished flag to EmitBlock for common statements which use
landing pads.
- Primarily a cleanliness issue instead of a performance issue (this
eliminates all blocks w/o predecessors on 176.gcc/expr.c), but this
also allows subsequent code to recognize it is unreachable and
potentially avoid IRgen.
Modified:
cfe/trunk/lib/CodeGen/CGStmt.cpp
Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=59211&r1=59210&r2=59211&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Wed Nov 12 19:54:24 2008
@@ -276,7 +276,7 @@
}
// Emit the continuation block for code after the if.
- EmitBlock(ContBlock);
+ EmitBlock(ContBlock, true);
}
void CodeGenFunction::EmitWhileStmt(const WhileStmt &S) {
@@ -299,7 +299,7 @@
// Create an exit block for when the condition fails, create a block for the
// body of the loop.
- llvm::BasicBlock *ExitBlock = createBasicBlock("while.exit");
+ llvm::BasicBlock *ExitBlock = createBasicBlock("while.end");
llvm::BasicBlock *LoopBody = createBasicBlock("while.body");
// As long as the condition is true, go to the loop body.
@@ -319,7 +319,7 @@
EmitBranch(LoopHeader);
// Emit the exit block.
- EmitBlock(ExitBlock);
+ EmitBlock(ExitBlock, true);
// If LoopHeader is a simple forwarding block then eliminate it.
if (!EmitBoolCondBranch
@@ -369,7 +369,7 @@
Builder.CreateCondBr(BoolCondVal, LoopBody, AfterDo);
// Emit the exit block.
- EmitBlock(AfterDo);
+ EmitBlock(AfterDo, true);
// If DoCond is a simple forwarding block then eliminate it.
if (!EmitBoolCondBranch && &DoCond->front() == DoCond->getTerminator()) {
@@ -382,9 +382,6 @@
void CodeGenFunction::EmitForStmt(const ForStmt &S) {
// FIXME: What do we do if the increment (f.e.) contains a stmt expression,
// which contains a continue/break?
- // TODO: We could keep track of whether the loop body contains any
- // break/continue statements and not create unnecessary blocks (like
- // "afterfor" for a condless loop) if it doesn't.
// Evaluate the first part before the loop.
if (S.getInit())
@@ -438,7 +435,7 @@
EmitBranch(CondBlock);
// Emit the fall-through block.
- EmitBlock(AfterFor);
+ EmitBlock(AfterFor, true);
}
void CodeGenFunction::EmitReturnOfRValue(RValue RV, QualType Ty) {
@@ -652,7 +649,7 @@
}
// Emit continuation.
- EmitBlock(NextBlock);
+ EmitBlock(NextBlock, true);
SwitchInsn = SavedSwitchInsn;
CaseRangeBlock = SavedCRBlock;
More information about the cfe-commits
mailing list