[llvm-commits] [llvm] r138015 - /llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp

Jim Grosbach grosbach at apple.com
Fri Aug 19 09:29:37 PDT 2011


Hi Bill,

Does this logic will apply to the edge splitting in SjLjEHPrepare as well? If so, equivalent changes may need to be made there.

-Jim

On Aug 18, 2011, at 5:09 PM, Bill Wendling wrote:

> Author: void
> Date: Thu Aug 18 19:09:22 2011
> New Revision: 138015
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=138015&view=rev
> Log:
> Intelligently split the landing pad block.
> 
> We have to be careful when splitting the landing pad block, because the
> landingpad instruction is required to remain as the first non-PHI of an invoke's
> unwind edge. To retain this, we split the block into two blocks, moving the
> predecessors within the loop to one block and the remaining predecessors to the
> other. The landingpad instruction is cloned into the new blocks.
> 
> Modified:
>    llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp
> 
> Modified: llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp?rev=138015&r1=138014&r2=138015&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp (original)
> +++ llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp Thu Aug 18 19:09:22 2011
> @@ -410,13 +410,24 @@
>   }
> 
>   assert(!LoopBlocks.empty() && "No edges coming in from outside the loop?");
> -  BasicBlock *NewBB = SplitBlockPredecessors(Exit, &LoopBlocks[0],
> -                                             LoopBlocks.size(), ".loopexit",
> -                                             this);
> +  BasicBlock *NewExitBB = 0;
> +
> +  if (Exit->isLandingPad()) {
> +    SmallVector<BasicBlock*, 2> NewBBs;
> +    SplitLandingPadPredecessors(Exit, ArrayRef<BasicBlock*>(&LoopBlocks[0],
> +                                                            LoopBlocks.size()),
> +                                ".loopexit", ".nonloopexit",
> +                                this, NewBBs);
> +    NewExitBB = NewBBs[0];
> +  } else {
> +    NewExitBB = SplitBlockPredecessors(Exit, &LoopBlocks[0],
> +                                       LoopBlocks.size(), ".loopexit",
> +                                       this);
> +  }
> 
>   DEBUG(dbgs() << "LoopSimplify: Creating dedicated exit block "
> -               << NewBB->getName() << "\n");
> -  return NewBB;
> +               << NewExitBB->getName() << "\n");
> +  return NewExitBB;
> }
> 
> /// AddBlockAndPredsToSet - Add the specified block, and all of its
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list