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

Bill Wendling isanbard at gmail.com
Fri Aug 19 12:58:04 PDT 2011


Hi Jim,

I'm going to be looking at the SjLjEHPrepare pass today. I don't think it needs all of the logic that we have here. I.e., it doesn't need to update the analysis passes (I don't think). So I might be able to create a "SplitLandingPadCriticalEdge" function for that.

-bw

On Aug 19, 2011, at 9:29 AM, Jim Grosbach wrote:

> 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