[llvm-commits] [llvm] r67194 - in /llvm/trunk/lib/Transforms: Scalar/ScalarReplAggregates.cpp Utils/Local.cpp

Zhou Sheng zhousheng00 at gmail.com
Wed Mar 18 04:31:35 PDT 2009


2009/3/18 Zhou Sheng <zhousheng00 at gmail.com>

>
>
> 2009/3/18 Zhou Sheng <zhousheng00 at gmail.com>
>
> Hi,
>>
>> 2009/3/18 Duncan Sands <baldrick at free.fr>
>>
>> Hi,
>>>
>>> >      else if (Instruction *I = dyn_cast<Instruction>(U)) {
>>> >        SmallVector<DbgInfoIntrinsic *, 2> DbgInUses;
>>> > -      if (OnlyUsedByDbgInfoIntrinsics(I, &DbgInUses)) {
>>> > +      if (!I->use_empty() && OnlyUsedByDbgInfoIntrinsics(I,
>>> &DbgInUses)) {
>>> >          // Safe to remove debug info uses.
>>> >          while (!DbgInUses.empty()) {
>>> >            DbgInfoIntrinsic *DI = DbgInUses.back();
>>> DbgInUses.pop_back();
>>>
>>> why is it safe to delete the instruction itself (done just below)?
>>> Does being used by debug intrinsics imply that the instruction cannot
>>> write memory?
>>
>> I'm not sure if an instruction only used by debug info will write memory.
>> But in this case, as the instruction "I" is just an allocaInst, so, I
>> think it is safe to delete.
>>
>
> Sorry, please forget my previous comments. I'm just got confused.
>

The safety is checked by previous code of scalarrepl (function
isSafeUseOfAllocation),  the instruction "I" can be only load, store,
bitcast or getelementptr, so, here it is save to delete if it only used by
debug info.


>
>
>>
>>
>>>
>>>
>>> Ciao,
>>>
>>> Duncan.
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090318/fc87a8bd/attachment.html>


More information about the llvm-commits mailing list