[cfe-commits] r59085 - in /cfe/trunk/lib/CodeGen: CGStmt.cpp CodeGenFunction.h

Daniel Dunbar daniel at zuster.org
Tue Nov 11 14:07:00 PST 2008


Author: ddunbar
Date: Tue Nov 11 16:06:59 2008
New Revision: 59085

URL: http://llvm.org/viewvc/llvm-project?rev=59085&view=rev
Log:
Change EmitBranch to always clear the insert point to clarify irgen
invariants.

Modified:
    cfe/trunk/lib/CodeGen/CGStmt.cpp
    cfe/trunk/lib/CodeGen/CodeGenFunction.h

Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=59085&r1=59084&r2=59085&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Tue Nov 11 16:06:59 2008
@@ -168,11 +168,12 @@
     // If the last block was an empty placeholder, remove it now.
     // TODO: cache and reuse these.
     CurBB->eraseFromParent();
-    Builder.ClearInsertionPoint();
   } else {
     // Otherwise, create a fall-through branch.
     Builder.CreateBr(Target);
   }
+
+  Builder.ClearInsertionPoint();
 }
 
 void CodeGenFunction::EmitDummyBlock() {

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=59085&r1=59084&r2=59085&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Tue Nov 11 16:06:59 2008
@@ -229,6 +229,10 @@
   /// EmitBranch - Emit a branch to the specified basic block from the
   /// current insert block, taking care to avoid creation of branches
   /// from dummy blocks.
+  ///
+  /// This function clears the current insertion point. The caller
+  /// should follow calls to this function with calls to Emit*Block
+  /// prior to generation new code.
   void EmitBranch(llvm::BasicBlock *Block);
 
   /// EmitDummyBlock - Emit a new block which will never be branched





More information about the cfe-commits mailing list