<div dir="ltr">Hi Joerg,<div><br></div><div>Actually on further investigation the simple solution of only visiting each OR once isn't going to work.</div><div><br></div><div>There's an "OR of ORs" byte-swap idiom that relies on having the same OR in both operands of another OR, the same pattern we're trying to defend against. See <a href="http://reviews.llvm.org/rL248482">http://reviews.llvm.org/rL248482</a> .</div><div><br></div><div>So the only defence I can think of is what I've already implemented, or to memoize the tree as you suggested. </div><div><br></div><div>However, memoization seems to go against the spirit of instcombine - there are no other similar caches kept that I can see, and any member of the tree could be modified or optimized by instcombine in any iteration, so we'd have to trawl the tree on every iteration to see if it has changed.</div><div><br></div><div>James<br><br><div class="gmail_quote"><div dir="ltr">On Mon, 4 Jan 2016 at 21:36 James Molloy <<a href="mailto:james@jamesmolloy.co.uk">james@jamesmolloy.co.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Yes, you're right, sorry. <br><div class="gmail_quote"><div dir="ltr">On Mon, 4 Jan 2016 at 21:20, Joerg Sonnenberger via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">> I don't think we even need any other limit - this would limit the number of<br>
> function invocations to O(bitwidth) as after that many ORs we're guaranteed<br>
> to hit a bailout.<br>
<br>
I thought it is O(bitwidth * funsize)? Where funsize is the number of<br>
expressions in the functions? That can be pretty large, but it isn't<br>
needed, the limit would certainly be optional.<br>
<br>
Joerg<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div></blockquote></div></div></div>