[PATCH] D39421: [InstCombine] Extracting common and-mask for shift operands of Or instruction

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 28 08:24:00 PST 2017


spatel added a comment.

In https://reviews.llvm.org/D39421#935341, @opaparo wrote:

> I'm not sure I understand why the suggested canonization might simplify or obviate the need for this patch.
>  Consider my use case "multiuse3". Although InstCombine normally recognizes and canonize something of the form


I think inverting the canonicalization of shl+and would make your first test case optimize without this patch, so that's actually where I paused in reviewing the patch. Have you investigated that possibility? Currently, we end up inverting the canonicalization in the x86 backend (because a smaller constant mask can be created in less instruction bytes), so it would be better to "get it right" here in IR in the first place.

I understand the multi-use case better now with your explanation, so I agree that we want this patch to handle those cases too. But I don't think we should ignore the underlying canonicalization choices just because we know we want to catch the larger patterns.


https://reviews.llvm.org/D39421





More information about the llvm-commits mailing list