<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;">Hi Andy,<div><br><div>I’ve run specs+test-suite with the same compiler (which aborts when LSR wants to discard a user), and got the following list of fails:</div><div><br></div><div><table class="sortable" style="max-width: 100%; background-color: rgb(255, 255, 255); border-collapse: collapse; border-spacing: 0px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 20px; font-size: 9pt; border: 1px solid black;"><thead><tr><th width="500" class=" sorttable_sorted" style="background-color: rgb(238, 238, 238); color: rgb(102, 102, 102); cursor: default; text-align: center; font-family: Verdana; padding: 5px 5px 5px 8px;">New Failures - Compile Time<span id="sorttable_sortfwdind"> ▾</span></th></tr></thead><tbody><tr><td style="padding: 5px 5px 5px 8px;">External/SPEC/CINT2000/254_gap/254_gap</td></tr><tr><td style="padding: 5px 5px 5px 8px;">External/SPEC/CINT2000/255_vortex/255_vortex</td></tr><tr><td style="padding: 5px 5px 5px 8px;">External/SPEC/CINT2006/400_perlbench/400_perlbench</td></tr><tr><td style="padding: 5px 5px 5px 8px;">External/SPEC/CINT95/147_vortex/147_vortex</td></tr><tr><td style="padding: 5px 5px 5px 8px;">MultiSource/Applications/ClamAV/clamscan</td></tr><tr><td style="padding: 5px 5px 5px 8px;">MultiSource/Benchmarks/7zip/7zip-benchmark</td></tr><tr><td style="padding: 5px 5px 5px 8px;">MultiSource/Benchmarks/mediabench/mpeg2/mpeg2dec/mpeg2decode</td></tr></tbody><tfoot></tfoot></table><div style="margin: 0px 0px 10px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255); position: static; z-index: auto;"><br class="webkit-block-placeholder"></div></div><div>Then I tried a possible fix, that we discussed yesterday: I added normalization of the stride before subtracting/adding it during NormalizeAutodetect/Denormalize. However, that fixed only one fail, the one from ‘make check’, described in the previous mail. The fails in specs and tests from test-suite persisted.</div><div><br></div><div>I again looked at a couple of expressions, which we are failing to denormalize to the original version, and they were like this one:</div><div><div><font face="Courier New">   ORIGINAL ISE: <span class="Apple-tab-span" style="white-space:pre">     </span>{(trunc i64 (1 + %i.0.ph) to i32),+,1}<%while.cond></font></div><div><font face="Courier New">   NORMALIZED ISE: <span class="Apple-tab-span" style="white-space:pre"> </span>{(trunc i64      %i.0.ph  to i32),+,1}<%while.cond></font></div><div><font face="Courier New">   DENORMALIZED ISE: <span class="Apple-tab-span" style="white-space:pre">   </span>{(1 + (trunc i64 %i.0.ph to i32)),+,1}<%while.cond></font></div></div><div><br></div><div>I.e. we didn’t move constants to trunc. I suppose this behavior is correct.</div><div><br></div><div>Thus, I think we could commit the original patch, and then I’ll send a patch, which adds step normalization. What do you think?</div><div><br></div><div>Thanks,</div><div>Michael</div><div><br><div><div>On Mar 10, 2014, at 5:55 PM, Andrew Trick <<a href="mailto:atrick@apple.com">atrick@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=windows-1252"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Mar 10, 2014, at 5:12 PM, Michael Zolotukhin <<a href="mailto:mzolotukhin@apple.com">mzolotukhin@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=windows-1252"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">I’ve run 'make check-all’ with llvm_unreachable in the branch where we discard a user, and actually got some interesting result. There were two failing tests, one of which is obviously the just added test.<div><br><div>The second one is CodeGen/X86/lsr-normalization.ll, and here is what I got there:</div><div><br></div><div><div>   ORIGINAL ISE: <span class="Apple-tab-span" style="white-space:pre">                          </span>{(100 /u {1,+,1}<%bb16>),+,(100 /u {1,+,1}<%bb16>)}<%bb25></div><div>   NORMALIZED ISE: <span class="Apple-tab-span" style="white-space:pre">                    </span>{((-1 * (100 /u {1,+,1}<%bb16>)) + (100 /u {0,+,1}<%bb16>)),+,(100 /u {0,+,1}<%bb16>)}<%bb25></div><div>   DENORMALIZED BACK ISE: <span class="Apple-tab-span" style="white-space:pre">    </span>{((2 * (100 /u {1,+,1}<%bb16>)) + (-1 * (100 /u {2,+,1}<%bb16>))),+,(100 /u {1,+,1}<%bb16>)}<%bb25></div></div><div><br></div><div>This could give an idea of what opportunities we could lose due to this change. Maybe we need to act so conservatively only in danger of overflow, i.e. when the original expression has sign-extensions/wrap-flags?</div></div></div></blockquote><div><br></div><div>Your current fix is conservatively correct. However, it also caught a more pervasive bug (the original bug only had to do with overflow at the induction variable’s boundary). As a follow-up, I agree with your suggestion to fix normalization so that it recursively normalizes the stride before subtracting it from the initial value. Your normalize-denormalize round trip check should also be sufficient to test that fix (you should only be eliminating cases in which the check fails, not adding any new ones).</div><div><br></div><div>-Andy</div><br><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Thanks,</div><div>Michael</div><div><br><div><div>On Mar 10, 2014, at 5:01 PM, Andrew Trick <<a href="mailto:atrick@apple.com">atrick@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Mar 10, 2014, at 5:00 PM, Eric Christopher <<a href="mailto:echristo@gmail.com">echristo@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="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;"><blockquote type="cite">As we discussed, once you have finished running the test-suite with a check<br>to find out if any important cases are no longer normalized as expected,<br>then I think you can commit. I know you've already verified performance, so<br>this is just an extra sanity check.<br><br></blockquote><br>Any interesting results?<br></div></blockquote><div><br></div>No performance changes, just fixing PR17473.</div><div><br></div><div>-Andy</div><div><br><blockquote type="cite"><div style="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;"><br>-eric<br><br><blockquote type="cite">Thanks.<br><br>-Andy<br><br><br>Thanks,<br>Michael<br><br>Thanks,<br>Arnold<br><br>On Mar 10, 2014, at 2:56 PM, Michael Zolotukhin <<a href="mailto:mzolotukhin@apple.com">mzolotukhin@apple.com</a>><br>wrote:<br><br>Hi,<br><br>This is a fix for PR17473. The issue is that LSR performs normalization of<br>detected IV users and sometimes wants to denormalize it back hoping to get<br>the original expression. But normalization isn't always invertible, and the<br>new expression might be not equivalent to the original one. In the test<br>case, we were losing sign-extension in such transformation. The patch simply<br>adds a check, if the transformation is invertible.<br><br><pr17473.patch><br><br>Ok for trunk?<br><br>Thanks,<br>Michael<br><br><br><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a></blockquote></div></blockquote></div><br></div></blockquote></div><br></div></div></blockquote></div><br></div></blockquote></div><br></div></div></body></html>