[PATCH] D38440: [InstCombine] Use APInt for all the math in foldICmpDivConstant

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 30 23:32:38 PDT 2017


craig.topper added inline comments.


================
Comment at: lib/Transforms/InstCombine/InstCombineCompares.cpp:61-71
-  if (VectorType *VTy = dyn_cast<VectorType>(In1->getType())) {
-    for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) {
-      Constant *Idx = ConstantInt::get(Type::getInt32Ty(In1->getContext()), i);
-      if (hasAddOverflow(extractElement(Result, Idx),
-                         extractElement(In1, Idx),
-                         extractElement(In2, Idx),
-                         IsSigned))
----------------
majnemer wrote:
> This appears to handle non-splat vectors. Does the new code achieve the same result?
Yes the existing code handled splat vectors, but I don't think the capability was ever used. The caller ensure it was either a scalar or a splat vector before we ever did any math.


https://reviews.llvm.org/D38440





More information about the llvm-commits mailing list