[PATCH] D24279: [InstCombine] canonicalize vector select with constant vector condition to shuffle
David Majnemer via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 6 13:49:19 PDT 2016
majnemer added inline comments.
================
Comment at: lib/Transforms/InstCombine/InstCombineSelect.cpp:965
@@ +964,3 @@
+ unsigned NumElts = CondVal->getType()->getVectorNumElements();
+ SmallVector<Constant *, 16> Mask(NumElts);
+ Type *Int32Ty = Type::getInt32Ty(CondVal->getContext());
----------------
I'd just reserve `NumElts` and push_back in the loop.
================
Comment at: lib/Transforms/InstCombine/InstCombineSelect.cpp:966
@@ +965,3 @@
+ SmallVector<Constant *, 16> Mask(NumElts);
+ Type *Int32Ty = Type::getInt32Ty(CondVal->getContext());
+ for (unsigned int i = 0; i != NumElts; ++i) {
----------------
Might be shorter to use `Builder->getInt32Ty()`
================
Comment at: lib/Transforms/InstCombine/InstCombineSelect.cpp:967
@@ +966,3 @@
+ Type *Int32Ty = Type::getInt32Ty(CondVal->getContext());
+ for (unsigned int i = 0; i != NumElts; ++i) {
+ Constant *Elt = CondC->getAggregateElement(i);
----------------
I think we'd just use `unsigned`.
================
Comment at: lib/Transforms/InstCombine/InstCombineSelect.cpp:968
@@ +967,3 @@
+ for (unsigned int i = 0; i != NumElts; ++i) {
+ Constant *Elt = CondC->getAggregateElement(i);
+ if (Elt->isOneValue()) {
----------------
Can't this return null?
https://reviews.llvm.org/D24279
More information about the llvm-commits
mailing list