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

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 28 10:32:57 PDT 2019


lebedev.ri 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) {
----------------
Time to hoist `replaceUndefsWith()` from `llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp` ?


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

https://reviews.llvm.org/D69519





More information about the llvm-commits mailing list