[PATCH] Remove dangling BlockAddresses in GlobalDCE

Bruno Cardoso Lopes bruno.cardoso at gmail.com
Fri Aug 22 15:11:54 PDT 2014


I get it now, I thought it would be safer to call it from elsewhere.
Thank you for the explanation.
If it's OK, I'll commit your previous version then :-)

Cheers,

On Fri, Aug 22, 2014 at 5:35 PM, Rafael EspĂ­ndola
<rafael.espindola at gmail.com> wrote:
> On 22 August 2014 16:07, Bruno Cardoso Lopes <bruno.cardoso at gmail.com> wrote:
>> Hi Rafael,
>>
>> I've tried this path before and the problem I found is exactly what you fix with:
>>
>> +  if (isa<ConstantInt>(C) || isa<ConstantFP>(C)) // why?
>> +    return false;
>> +
>>
>> I->setInitializer(nullptr) will actually destroy the constant in ConstantInt and ConstantFP and later on there's nothing there for destroyConstant to destroy.
>>
>> This is not the case for other underlying constant types - which you can safely keep track by saving the initializer and deleting it later. I prefer your approach, but I suggest we do not change isSafeToDestroyConstant, but check this condition before.
>
> So, the problem is that destroyConstant is not overridden in
> ConstantFP and ConstantInt. It is never safe to call it, which is why
> I changed isSafeToDestroyConstant.
>
> Cheers,
> Rafael



-- 
Bruno Cardoso Lopes
http://www.brunocardoso.cc




More information about the llvm-commits mailing list