[llvm-commits] [llvm] r65910 - in /llvm/trunk: include/llvm/Transforms/Utils/BasicBlockUtils.h lib/Transforms/Scalar/InstructionCombining.cpp lib/Transforms/Utils/BasicBlockUtils.cpp

Evan Cheng evan.cheng at apple.com
Mon Mar 2 22:54:08 PST 2009


On Mar 2, 2009, at 5:09 PM, Dale Johannesen wrote:

>
> +  CopyPrecedingStopPoint(I, InsertPos);

If there is a stoppoint right after 'I', wouldn't it be cheaper to  
move the preceding stoppoint rather than duplicating it? I'm a bit  
concerned about the cost of duplicating the intrinsic in general.

>   I->moveBefore(InsertPos);
>   ++NumSunkInst;
>   return true;
>
>
> +
> +/// CopyPrecedingStopPoint - If I is immediately preceded by a  
> StopPoint,
> +/// make a copy of the stoppoint before InsertPos (presumably  
> before copying
> +/// or moving I).
> +void llvm::CopyPrecedingStopPoint(Instruction *I,
> +                                  BasicBlock::iterator InsertPos) {
> +  if (I != I->getParent()->begin()) {
> +    BasicBlock::iterator BBI = I;  --BBI;

It seems to me BBI = prior(I)  can potentially be cheaper than making  
a copy of the iterator and then decrement it.

Evan

> +    if (DbgStopPointInst *DSPI = dyn_cast<DbgStopPointInst>(BBI)) {
> +      DbgStopPointInst *newDSPI =
> +        reinterpret_cast<DbgStopPointInst*>(DSPI->clone());
> +      newDSPI->insertBefore(InsertPos);
> +    }
> +  }
> +}
>
>
> _______________________________________________
> 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