<div class="gmail_quote">Here is an updated patch.</div><div class="gmail_quote"><br></div><div class="gmail_quote">This fixes InstCombine to still make the transform which seems the real intent of this canonicalization -- folding the trunc to a single bit into some other mask operation and testing with zero. This is especially interesting when the pattern is something like (trunc (lshr X, 3) to i1). Here we can replace the shift with a simple mask and compare to zero.</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">It also teaches InstCombine to canonicalize various forms of the old pattern which actually generate worse code if they ever reach codegen into a trunc to i1.</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">Thoughts?</div><div class="gmail_quote"><br>I'm entirely convinced whether this is the correct approach, so I'd appreciate thoughts of others. There are 3 or 4 test failures I'm mopping up where we were expecting the and+icmp pair, but none of them seem interesting or noteworthy. Just shorter. ;]</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">-Chandler</div>