[PATCH] D37237: [InstCombine] Teach foldSelectICmpAndOr to handle vector splats

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 28 17:05:06 PDT 2017


spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.

I didn't test it, but I don't see a hasOneUse() check on the cmp, so this might be creating more instructions than we expect. That would be a follow-up change though, so LGTM. See inline for a small potential improvement.



================
Comment at: lib/Transforms/InstCombine/InstCombineSelect.cpp:322
+  // If this is a vector select, we need a vector compare.
+  if (TrueVal->getType()->isVectorTy() != CmpLHS->getType()->isVectorTy())
+    return nullptr;
----------------
Could use IC->getType() and make this a compound predicate in the first line?


https://reviews.llvm.org/D37237





More information about the llvm-commits mailing list