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

Chris Lattner clattner at apple.com
Sat Feb 7 10:54:13 PST 2009


On Feb 7, 2009, at 10:08 AM, Mike Stump wrote:

> Author: mrs
> Date: Sat Feb  7 12:08:12 2009
> New Revision: 64021
>
> URL: http://llvm.org/viewvc/llvm-project?rev=64021&view=rev
> Log:
> Arrange to have the correct StackDepth for while statements.

Testcase?

-Chris

>
>
> 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=64021&r1=64020&r2=64021&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGStmt.cpp Sat Feb  7 12:08:12 2009
> @@ -357,6 +357,14 @@
>   // it.
>   llvm::BasicBlock *LoopHeader = createBasicBlock("while.cond");
>   EmitBlock(LoopHeader);
> +
> +  // Create an exit block for when the condition fails, create a  
> block for the
> +  // body of the loop.
> +  llvm::BasicBlock *ExitBlock = createBasicBlock("while.end");
> +  llvm::BasicBlock *LoopBody  = createBasicBlock("while.body");
> +
> +  // Store the blocks to use for break and continue.
> +  BreakContinuePush(ExitBlock, LoopHeader);
>
>   // Evaluate the conditional in the while header.  C99 6.8.5.1: The
>   // evaluation of the controlling expression takes place before each
> @@ -370,18 +378,10 @@
>     if (C->isOne())
>       EmitBoolCondBranch = false;
>
> -  // Create an exit block for when the condition fails, create a  
> block for the
> -  // body of the loop.
> -  llvm::BasicBlock *ExitBlock = createBasicBlock("while.end");
> -  llvm::BasicBlock *LoopBody  = createBasicBlock("while.body");
> -
>   // As long as the condition is true, go to the loop body.
>   if (EmitBoolCondBranch)
>     Builder.CreateCondBr(BoolCondVal, LoopBody, ExitBlock);
>
> -  // Store the blocks to use for break and continue.
> -  BreakContinuePush(ExitBlock, LoopHeader);
> -
>   // Emit the loop body.
>   EmitBlock(LoopBody);
>   EmitStmt(S.getBody());
>
> Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=64021&r1=64020&r2=64021&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
> +++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Sat Feb  7 12:08:12 2009
> @@ -151,7 +151,10 @@
>   /// LabelMap - This keeps track of the LLVM basic block for each C  
> label.
>   llvm::DenseMap<const LabelStmt*, llvm::BasicBlock*> LabelMap;
>
> -  /// BreakContinuePush - Note a new break and continue level.
> +  /// BreakContinuePush - Note a new break and continue level.  This
> +  /// must be called at the stack depth of the continue block.  In
> +  /// particular, this must not be called after the controlling
> +  /// condition has possibly started a vla.
>   void BreakContinuePush(llvm::BasicBlock *bb, llvm::BasicBlock *cb) {
>     BreakContinueStack.push_back(BreakContinue(bb, cb, StackDepth,
>                                                ObjCEHStack.size()));
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list