[llvm] [InstCombine] Don't require GEP in indexed compare fold (PR #81614)

via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 13 10:05:54 PST 2024


================
@@ -619,27 +619,27 @@ static Value *rewriteGEPAsOffset(Value *Start, Value *Base,
   return NewInsts[Start];
 }
 
-/// Converts (CMP GEPLHS, RHS) if this change would make RHS a constant.
+/// Converts (CMP LHS, RHS) if this change would make RHS a constant.
 /// We can look through PHIs, GEPs and casts in order to determine a common base
-/// between GEPLHS and RHS.
-static Instruction *transformToIndexedCompare(GEPOperator *GEPLHS, Value *RHS,
+/// between LHS and RHS.
+static Instruction *transformToIndexedCompare(Value *LHS, Value *RHS,
                                               ICmpInst::Predicate Cond,
                                               const DataLayout &DL,
                                               InstCombiner &IC) {
-  // FIXME: Support vector of pointers.
-  if (GEPLHS->getType()->isVectorTy())
+  if (ICmpInst::isSigned(Cond))
----------------
goldsteinn wrote:

Whats the purpose of this check?

https://github.com/llvm/llvm-project/pull/81614


More information about the llvm-commits mailing list