<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 13 Sep 2015, at 11:11, escha <<a href="mailto:escha@apple.com" class="">escha@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><blockquote type="cite" class=""><div class=""><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class=""><div class=""><div class=""><br class=""></div><div class="">Instead of adding the operands to a list, erase the instruction and add them to the worklist wouldn’t be probably faster something like:</div><div class=""><br class=""></div><div class="">if (Instruction *Used = dyn_cast<Instruction>(*OI))</div><div class="">  if (Used->hasOneUse())</div><div class="">    WorkList.insert(Used);</div><div class=""><br class=""></div><div class="">If it has one use is going to be the instruction we are going to remove anyway, right?</div></div></div></div></div></blockquote><br class=""></div><div class="">I don’t think this is strictly true, but someone correct me if I’m wrong: if you have</div><div class=""><br class=""></div><div class="">%y = add i32 %x, %x</div><div class=""><br class=""></div><div class="">%x will have two uses, but it will have zero if %y is deleted. This was the corner case I was worried about.</div></div></div></blockquote><div><br class=""></div><div>Yeah, I think you are right , I didn’t think about this case!</div><div><br class=""></div><div>Marcello</div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class="">—escha</div></div></div></blockquote></div><br class=""></body></html>