[PATCH] D69519: [InstCombine] make icmp vector canonicalization safe for constant with undef elements

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 28 10:44:28 PDT 2019


spatel marked an inline comment as done.
spatel added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:5197-5208
+  // It may not be safe to change a compare predicate in the presence of
+  // undefined elements, so replace those elements with the first valid constant
+  // that we found.
+  if (Type->isVectorTy() && C->containsUndefElement()) {
+    unsigned NumElts = Type->getVectorNumElements();
+    SmallVector<Constant *, 16> Out(NumElts);
+    for (unsigned i = 0; i != NumElts; ++i) {
----------------
lebedev.ri wrote:
> Time to hoist `replaceUndefsWith()` from `llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp` ?
Yes - I forgot where that was hiding. :)


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

https://reviews.llvm.org/D69519





More information about the llvm-commits mailing list