[llvm-commits] [llvm] r50770 - /llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp

Evan Cheng evan.cheng at apple.com
Tue May 6 15:34:25 PDT 2008


Thanks. Can you check if this fix Povray?

Evan

On May 6, 2008, at 1:55 PM, Owen Anderson <resistor at mac.com> wrote:

> Author: resistor
> Date: Tue May  6 15:55:16 2008
> New Revision: 50770
>
> URL: http://llvm.org/viewvc/llvm-project?rev=50770&view=rev
> Log:
> We need to update PHIs containing the exiting block, not the exit  
> block.  We really should come up with better names for these.
>
> Modified:
>    llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp
>
> Modified: llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp?rev=50770&r1=50769&r2=50770&view=diff
>
> === 
> === 
> === 
> =====================================================================
> --- llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp Tue May  6  
> 15:55:16 2008
> @@ -192,8 +192,9 @@
>     return false;
>
>   // Now that we know the removal is safe, remove the loop by  
> changing the
> -  // branch from the preheader to go to the single exiting block.
> +  // branch from the preheader to go to the single exit block.
>   BasicBlock* exitBlock = exitBlocks[0];
> +  BasicBlock* exitingBlock = exitingBlocks[0];
>
>   // Because we're deleting a large chunk of code at once, the  
> sequence in which
>   // we remove things is very important to avoid invalidation  
> issues.  Don't
> @@ -218,7 +219,7 @@
>   // the preheader instead of the exiting block.
>   BasicBlock::iterator BI = exitBlock->begin();
>   while (PHINode* P = dyn_cast<PHINode>(BI)) {
> -    P->replaceUsesOfWith(exitBlock, preheader);
> +    P->replaceUsesOfWith(exitingBlock, preheader);
>     BI++;
>   }
>
> @@ -253,8 +254,12 @@
>   // NOTE: This iteration is safe because erasing the block does not  
> remove its
>   // entry from the loop's block list.  We do that in the next  
> section.
>   for (Loop::block_iterator LI = L->block_begin(), LE = L->block_end 
> ();
> -       LI != LE; ++LI)
> +       LI != LE; ++LI) {
> +    for (Value::use_iterator UI = (*LI)->use_begin(), UE = (*LI)- 
> >use_end();
> +         UI != UE; ++UI)
> +      (*UI)->dump();
>     (*LI)->eraseFromParent();
> +  }
>
>   // Finally, the blocks from loopinfo.  This has to happen late  
> because
>   // otherwise our loop iterators won't work.
>
>
> _______________________________________________
> 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