[PATCH] D73549: [Analysis] add optional index parameter to isSplatValue()

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 30 06:49:54 PST 2020


spatel added a comment.

In D73549#1845221 <https://reviews.llvm.org/D73549#1845221>, @nikic wrote:

> I don't fully understand how this API is going to be used. The current API makes sense to me (are all elements in the vector the same?) but the new one is unclear, especially for the case where no shufflevector is involved. If I have a splat constant, which index does the value come from?


I agree it's not clear, so I'm certainly open to recommendations for improvement. For now, the index parameter is ignored on a splat constant. The TODO comment suggests a follow-up:

  // FIXME: We can allow undefs, but if Index was specified, we may want to
  //        check that the constant is defined at that index.
   
  
   

> Do you already have a followup patch that uses this API that you could share?

Posted as D73703 <https://reviews.llvm.org/D73703> - that has a test example where we are splatting from 2 different indexes, so we can't reassociate the binops.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73549/new/

https://reviews.llvm.org/D73549





More information about the llvm-commits mailing list