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

escha via llvm-dev llvm-dev at lists.llvm.org
Sun Sep 13 11:11:08 PDT 2015


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

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


More information about the llvm-dev mailing list