[llvm-dev] RFC: faster simplifyInstructionsInBlock/SimplifyInstructions pass
escha via llvm-dev
llvm-dev at lists.llvm.org
Sun Sep 13 11:38:24 PDT 2015
> On Sep 13, 2015, at 11:32 AM, Marcello Maggioni <mmaggioni at apple.com> wrote:
>
>>
>> On 13 Sep 2015, at 11:11, escha <escha at apple.com <mailto: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
On this note, I have a feeling that both IR and the DAG could use a hasOneUser() function…
—escha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150913/2b2ac455/attachment.html>
More information about the llvm-dev
mailing list