[PATCH] D141660: [InstCombine] Fold pattern xor(and, or) to select

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 20 11:46:23 PST 2023


spatel added inline comments.


================
Comment at: llvm/test/Transforms/InstCombine/xor-and-or.ll:200
 
-;; TODO: do we really need to do this transform?
+;; even through we save a instruction here, select is heavier than normal 
+;; and/or/xor on most backend,  do we really need to do this transform?
----------------
bcl5980 wrote:
> spatel wrote:
> > typo: through -> though
> > 
> > If there's evidence that this is worse in codegen, then we could restrict the transform in this patch - only change when one or more of the original instructions is a select?
> https://godbolt.org/z/7hPWbK9oT
> It looks the drop comes from i1 vector. The case I worry looks at least no drop. Can I disable for the vector in this patch?
I don't think that's necessary. These kind of patterns are not likely in real vector code - we would have compares generating the condition vectors, and we would not have illegal types.

If someone finds a regression from this patch, we can fix it in the backend or limit the transform here.


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

https://reviews.llvm.org/D141660



More information about the llvm-commits mailing list