[llvm] [InstCombine] Don't require GEP in indexed compare fold (PR #81614)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 13 12:09:00 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))
----------------
nikic wrote:
The transform is not valid for signed predicates. Previously this was checked by the caller.
https://github.com/llvm/llvm-project/pull/81614
More information about the llvm-commits
mailing list