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

Frits van Bommel fvbommel at gmail.com
Tue Jun 21 04:41:35 PDT 2011


On 21 June 2011 12:02, Jay Foad <jay.foad at gmail.com> wrote:
> Log:
> Don't use PN->replaceUsesOfWith() to change a PHINode's incoming blocks,
> because it won't work after my phi operand changes, because the incoming
> blocks will no longer be Uses.

>   while (PHINode* P = dyn_cast<PHINode>(BI)) {
> -    P->replaceUsesOfWith(exitingBlock, preheader);
> +    int j = P->getBasicBlockIndex(exitingBlock);
> +    assert(j >= 0 && "Can't find exiting block in exit block's phi node!");
> +    P->setIncomingBlock(j, preheader);

replaceUsesOfWith() can handle multiple uses of the same value, but
this version only handles a single use. Are you sure there can only be
a single incoming edge from each basic block here?




More information about the llvm-commits mailing list