[llvm-dev] RFC: faster simplifyInstructionsInBlock/SimplifyInstructions pass

Marcello Maggioni via llvm-dev llvm-dev at lists.llvm.org
Sun Sep 13 11:32:40 PDT 2015


> On 13 Sep 2015, at 11:11, escha <escha at apple.com> wrote:
> 
>> 
>> Instead of adding the operands to a list, erase the instruction and add them to the worklist wouldn’t be probably faster something like:
>> 
>> if (Instruction *Used = dyn_cast<Instruction>(*OI))
>>   if (Used->hasOneUse())
>>     WorkList.insert(Used);
>> 
>> If it has one use is going to be the instruction we are going to remove anyway, right?
> 
> I don’t think this is strictly true, but someone correct me if I’m wrong: if you have
> 
> %y = add i32 %x, %x
> 
> %x will have two uses, but it will have zero if %y is deleted. This was the corner case I was worried about.

Yeah, I think you are right , I didn’t think about this case!

Marcello

> 
> —escha

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150913/fc6c3907/attachment.html>


More information about the llvm-dev mailing list