<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=""><div><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_quote" 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=""><br class="">Mightn't hurt to think a bit about the tradeoff of using temporary storage or just cheating and returning a pointer by value from op*... I mean it'll probably work for the range-for. I'm not sure where it'd really break - if the value_type of the iterator is "const SDNode" then it might be hard-to-impossible to for any algorithm to really have a problem with this.</div><div class=""><br class=""> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div style="word-wrap: break-word;" class=""><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Pete<span class=""><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div style="word-wrap: break-word;" class=""><div class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><br class="">BTW, been trying to work out if there would ever be a good solution for an iterator combined with isa<> or dyn_cast<>.  If you look at the code this patch touches in AArch64ISelLowering, it is immediately followed by a dyn_cast.  I’d really like to find a clean way to fold that it to the foreach loop, i.e.,<br class=""><br class="">for (auto *C : dyn_cast<ConstantSDNode>(N->op_nodes()))<br class=""><br class="">just a thought, but thats unrelated to this patch for now.<br class=""></blockquote><div class=""><br class="">Yep, though probably more in the form of a filtered range, I suspect:<br class=""><br class=""> <span class="Apple-converted-space"> </span>for (auto &C : filtered_transform(N->op_nodes(), [](SDUse *U) { return U->getNode(); }))<br class=""><br class="">It'd be a bit tricky to deal with the value type of this range's iterators - chances are the predicate should return an Optional<T&> (Hmm, don't think our Optional template supports ref parameters yet anyway) or T* (not sure if we could generalize it so it could cope with Optional<T>, maybe - so we could support generators where the values are not already/permanently in-memory) and then the value_type is T.<br class=""></div></div></div></div></div></blockquote>Interesting.  I hadn’t though to use Optional.  I might try to implement something like this if i get time.</div><div class=""><br class=""></div><div class="">Cheers,</div><div class="">Pete<br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><br class="">Cheers,<br class="">Pete</blockquote></div></div></div></div></blockquote></div></div></blockquote></div></div></div></div></blockquote></span></div></div></blockquote></div></div></blockquote></div><br class=""></body></html>