[PATCH] PR17473: Disallow LSR to perform non-invertible normalization

Michael Zolotukhin mzolotukhin at apple.com
Mon Mar 10 17:12:36 PDT 2014


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.

The second one is CodeGen/X86/lsr-normalization.ll, and here is what I got there:

   ORIGINAL ISE: 				{(100 /u {1,+,1}<%bb16>),+,(100 /u {1,+,1}<%bb16>)}<%bb25>
   NORMALIZED ISE: 			{((-1 * (100 /u {1,+,1}<%bb16>)) + (100 /u {0,+,1}<%bb16>)),+,(100 /u {0,+,1}<%bb16>)}<%bb25>
   DENORMALIZED BACK ISE: 	{((2 * (100 /u {1,+,1}<%bb16>)) + (-1 * (100 /u {2,+,1}<%bb16>))),+,(100 /u {1,+,1}<%bb16>)}<%bb25>

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?

Thanks,
Michael

On Mar 10, 2014, at 5:01 PM, Andrew Trick <atrick at apple.com> wrote:

> 
> On Mar 10, 2014, at 5:00 PM, Eric Christopher <echristo at gmail.com> wrote:
> 
>>> As we discussed, once you have finished running the test-suite with a check
>>> to find out if any important cases are no longer normalized as expected,
>>> then I think you can commit. I know you've already verified performance, so
>>> this is just an extra sanity check.
>>> 
>> 
>> Any interesting results?
> 
> No performance changes, just fixing PR17473.
> 
> -Andy
> 
>> 
>> -eric
>> 
>>> Thanks.
>>> 
>>> -Andy
>>> 
>>> 
>>> Thanks,
>>> Michael
>>> 
>>> Thanks,
>>> Arnold
>>> 
>>> On Mar 10, 2014, at 2:56 PM, Michael Zolotukhin <mzolotukhin at apple.com>
>>> wrote:
>>> 
>>> Hi,
>>> 
>>> This is a fix for PR17473. The issue is that LSR performs normalization of
>>> detected IV users and sometimes wants to denormalize it back hoping to get
>>> the original expression. But normalization isn't always invertible, and the
>>> new expression might be not equivalent to the original one. In the test
>>> case, we were losing sign-extension in such transformation. The patch simply
>>> adds a check, if the transformation is invertible.
>>> 
>>> <pr17473.patch>
>>> 
>>> Ok for trunk?
>>> 
>>> Thanks,
>>> Michael
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140310/a0665353/attachment.html>


More information about the llvm-commits mailing list