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

Dale Johannesen dalej at apple.com
Tue Mar 3 09:50:42 PST 2009


On Mar 2, 2009, at 10:54 PMPST, Evan Cheng wrote:
> 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?

<stoppoint> I <stoppoint>?  I guess I could check for that case.   
Probably not too common.  I don't see a slowdown in the overnight  
results.

> I'm a bit
> concerned about the cost of duplicating the intrinsic in general.

Don't worry, there's worse to come.

>>  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.

OK.

> 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
>
> _______________________________________________
> 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