[LLVMdev] get LPPassManager to use it in llvm::CloneLoop

Eli Friedman eli.friedman at gmail.com
Wed Jun 15 13:11:56 PDT 2011


On Wed, Jun 15, 2011 at 3:20 AM, Jimborean Alexandra
<xinfinity_a at yahoo.com> wrote:
> Thanks , your suggestion was welcome and CloneLoop works without passing the
> LPPassManager.
>
>  However, I reached another problem. When the loop to be cloned has some
> subloops, the subloops are not properly cloned. Some clones of the clones
> are created and the CFG between the cloned basic blocks of the subloops is
> not correctly built. There are clones like for.body.clone,  for.body.clone1,
>  for.body.clone2, ...  for.body.clone26 without any predecessor and
>  for.body.clone27,  for.body.clone28 ..  which are included in the CFG.
>
> To be sure I did not mess up the code of CloneLoop I checked also the
> original version of the function (which requires LPPassManager as
> parameter), but the output is the same. How can I use the CloneLoop function
> to clone a loop nest?

I would like to point you to a code example, but then I realized
nothing in the LLVM codebase actually uses CloneLoop.  So I'm not
surprised it's broken... sorry about that.

For an actually working piece of code that clones a loop, try
LoopUnswitch::UnswitchNontrivialCondition in
lib/Transforms/Scalar/LoopUnswitch.cpp.

-Eli




More information about the llvm-dev mailing list