[PATCH] D74495: [VectorCombine] try to form vector binop to eliminate an extract element

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 13 12:52:29 PST 2020


lebedev.ri added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/VectorCombine.cpp:132
+      // unoptimized form with identical values.
+      bool HasUseTax = Ext0 == Ext1 ? Ext0->hasNUsesOrMore(3)
+                                    : !Ext0->hasOneUse() || !Ext1->hasOneUse();
----------------
spatel wrote:
> lebedev.ri wrote:
> > I'd think it would be more obvious to do `!Ext0->hasNUses(2)` instead.
> > It can't have less than two uses - there are two uses in our entry binop.
> > And if there are more than two uses then those are The extra uses.
> > 
> > Otherwise, why do we check `hasOneUse()` instead of `hasNUsesOrMore(2)`?
> I agree that your suggestion is better for readability. Will change. Thanks for the detailed review!
> Otherwise, why do we check hasOneUse() instead of hasNUsesOrMore(2)?

Err, that of course should have read

"Otherwise, why do we check hasOneUse() instead of hasNUsesOrMore(1)"


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

https://reviews.llvm.org/D74495





More information about the llvm-commits mailing list