[PATCH] D123962: [InstCombine] fold freeze of partial undef/poison vector constants

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 19 07:30:25 PDT 2022


spatel added a comment.

In D123962#3458814 <https://reviews.llvm.org/D123962#3458814>, @nikic wrote:

> What about
>
>> For vector constants with some undef elements, wouldn't we be better off picking an existing (non-undef) vector element? That would be especially profitable if we can produce a splat vector constant.
>
> ?
>
> I still think that would make more sense for the vector case.

Sorry, I didn't see that comment initially. It's complicated to decide what qualifies as "best" constant for a vector. Yes, a splat is generally good, but a zero can be better if it allows a follow-on transform like narrowing. I don't have any evidence to support one way or the other yet.

The motivation for this patch is largely theoretical at this point - I was looking at making the transform from https://github.com/llvm/llvm-project/issues/47012 safe via freeze and saw that it would cause vector test regressions because there was no support for reducing vector constants at all.


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

https://reviews.llvm.org/D123962



More information about the llvm-commits mailing list