Skip to content

Commit

Permalink
[InstSimplify] Remove redundant pointer icmp fold (NFCI)
Browse files Browse the repository at this point in the history
This fold is already performed as part of simplifyICmpWithZero().
  • Loading branch information
nikic committed Oct 26, 2023
1 parent ce6b9b3 commit 4638c29
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions llvm/lib/Analysis/InstructionSimplify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2736,13 +2736,6 @@ static Constant *computePointerICmp(CmpInst::Predicate Pred, Value *LHS,
const TargetLibraryInfo *TLI = Q.TLI;
const DominatorTree *DT = Q.DT;
const Instruction *CxtI = Q.CxtI;
const InstrInfoQuery &IIQ = Q.IIQ;

// A non-null pointer is not equal to a null pointer.
if (isa<ConstantPointerNull>(RHS) && ICmpInst::isEquality(Pred) &&
llvm::isKnownNonZero(LHS, DL, 0, nullptr, nullptr, nullptr,
IIQ.UseInstrInfo))
return ConstantInt::get(getCompareTy(LHS), !CmpInst::isTrueWhenEqual(Pred));

// We can only fold certain predicates on pointer comparisons.
switch (Pred) {
Expand Down

0 comments on commit 4638c29

Please sign in to comment.