<div dir="ltr">Hi, Sanjay/all,<div><br></div><div>  I noticed in rL331486 that some compare-select optimizations are disabled in favor of providing canonicalized cmp+select to the backend.</div><div><br></div><div>  <span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">I am currently working on a private backend target, a<span>nd the target has a small code size limit.  With this change, some of the apps went over the codesize limit.  As an example,</span></span></div><div><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span><br></span></span></div><div><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span>C code:</span></span></div><div><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span>  b = (a > -1) ? 4 : 5;<br></span></span></div><div><br></div><div>ll code:</div><div>Before rL331486:</div><div><div>  %0 = lshr i16 %a.0.a.0., 15</div><div>  %1 = or i16 %0, 4</div></div><div><br></div><div>After rL331486:</div><div><div>  %cmp = icmp sgt i16 %a.0.a.0., -1</div><div>  %cond = select i1 %cmp, i16 4, i16 5</div></div><div><br></div><div>  With the various encoding restrictions of my particular target, the cmp/select generated slightly larger code size.  However, because the apps were very close to the code size limit, this slight change pushed them over the limit.</div><div><br></div><div>  If I still prefer to have this optimization performed, then is my best strategy moving forward to implement this optimization as a peephole opt in my backend?</div><div><br></div><div>Thanks,</div><div>--Yuan</div></div>