[PATCH] D116194: [InstCombine] Factor out a common pattern match used 3 times. NFC.

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 6 10:06:31 PST 2022


rampitec added a comment.

In D116194#3225474 <https://reviews.llvm.org/D116194#3225474>, @spatel wrote:

> In D116194#3223711 <https://reviews.llvm.org/D116194#3223711>, @rampitec wrote:
>
>> In D116194#3223354 <https://reviews.llvm.org/D116194#3223354>, @spatel wrote:
>>
>>> Making the caller pass a dummy seems awkward. 
>>> I don't have any suggestions to improve it, but adding some more potential reviewers.
>>
>> I can pass a pointer with default null. Is that better?
>
> Wouldn't it be a pointer to a pointer in that case?

Yes

> Since we already have 'X' in the caller, we could just always pass 'X' instead of using 'Dummy' even if it is not used.

This will clobber X even if pattern is not matched, and then X is used later at line 1800.

> I don't have a strong opinion on it, so LGTM. 
>  Although I am still hoping we can find an alternative to complicated (yet ultimately still fragile) pattern-matching that is trying to work around limits of reassociation and multi-use.

I hope D114126 <https://reviews.llvm.org/D114126> is a right answer to multi-use problem, although somewhat complex.


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

https://reviews.llvm.org/D116194



More information about the llvm-commits mailing list