[PATCH] D52494: [InstCombine] Handle vector compares in foldGEPIcmp(), take 2

Jesper Antonsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 1 07:59:56 PDT 2018


JesperAntonsson added a comment.

Thanks.



================
Comment at: lib/Transforms/InstCombine/InstCombineCompares.cpp:912
       // If all indices are the same, just compare the base pointers.
-      if (IndicesTheSame)
+      Type *BaseType = GEPLHS->getOperand(0)->getType();
+      if (IndicesTheSame && CmpInst::makeCmpResultType(BaseType) == I.getType())
----------------
lebedev.ri wrote:
> I'm not sure this helper variable is/isn't any better than without it?
I tried without and really felt the expression became too complex and unwieldy.


https://reviews.llvm.org/D52494





More information about the llvm-commits mailing list