<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="">
I’m looking a a case very similar to the one in the bug you mentioned. The only difference is that we don’t rely on LLVM index i64 canonicalization (done by sign extension) but instead our front end does it using zero extension because it knows that in our
 case indices can’t be negative. So, the resulting IR is virtually the same except sexts are replaced by zexts.    
<div class=""><br class="">
</div>
<div class="">I haven’t yet filed any bugs for that.</div>
<div class=""><br class="">
</div>
<div class="">Artur</div>
<div class=""><br class="">
<div>
<blockquote type="cite" class="">
<div class="">On 19 Jul 2016, at 18:54, Sanjay Patel <<a href="mailto:spatel@rotateright.com" class="">spatel@rotateright.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">
<div class="">
<div class="">
<div class="">Hi Artur -<br class="">
<br class="">
</div>
I don't think there's any reason to limit the transform to sexts only; that's just the case that was apparent in
<a href="https://llvm.org/bugs/show_bug.cgi?id=20134" class="">https://llvm.org/bugs/show_bug.cgi?id=20134</a> , so I limited it to that pattern.<br class="">
<br class="">
</div>
It's probably worth noting that I'm currently fighting through casts of all kinds in IR (InstCombine) rather than the backend:<br class="">
<a href="https://reviews.llvm.org/D22421" class="">https://reviews.llvm.org/D22421</a><br class="">
<a href="https://reviews.llvm.org/D22271" class="">https://reviews.llvm.org/D22271</a><br class="">
<a href="https://reviews.llvm.org/D22477" class="">https://reviews.llvm.org/D22477</a><br class="">
<a href="https://reviews.llvm.org/D20774" class="">https://reviews.llvm.org/D20774</a><br class="">
<a href="https://llvm.org/bugs/show_bug.cgi?id=27925" class="">https://llvm.org/bugs/show_bug.cgi?id=27925</a><br class="">
<br class="">
</div>
I'm very interested to see what kinds of patterns you're seeing and want to optimize. It's possible that IR transforms could eliminate the need for the backend fixups...or it could make them harder. Are there bug reports for the cases that you are looking at?<br class="">
<div class="">
<div class=""><br class="">
</div>
</div>
</div>
<div class="gmail_extra"><br class="">
<div class="gmail_quote">On Tue, Jul 19, 2016 at 9:13 AM, Artur Pilipenko <span dir="ltr" class="">
<<a href="mailto:apilipenko@azulsystems.com" target="_blank" class="">apilipenko@azulsystems.com</a>></span> wrote:<br class="">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word" class="">
<div class="">Hi Sanjay,</div>
<div class=""><br class="">
</div>
<div class="">Some time ago you implemented a sext(add_nsw(x, C)) --> add(sext(x), C_sext) transformation in X86ISelLowering </div>
<div class=""><a href="https://reviews.llvm.org/D13757" target="_blank" class="">https://reviews.llvm.org/D13757</a></div>
<div class="">Is there any reason why this transformation is limited to sexts and doesn’t support zexts?</div>
<div class=""><br class="">
</div>
<div class="">Thanks,</div>
<div class="">Artur</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>