[llvm] 4638c29 - [InstSimplify] Remove redundant pointer icmp fold (NFCI)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 26 05:30:41 PDT 2023


Author: Nikita Popov
Date: 2023-10-26T14:30:33+02:00
New Revision: 4638c29c3dd14048ca78e37f132d4c75f490d139

URL: https://github.com/llvm/llvm-project/commit/4638c29c3dd14048ca78e37f132d4c75f490d139
DIFF: https://github.com/llvm/llvm-project/commit/4638c29c3dd14048ca78e37f132d4c75f490d139.diff

LOG: [InstSimplify] Remove redundant pointer icmp fold (NFCI)

This fold is already performed as part of simplifyICmpWithZero().

Added: 
    

Modified: 
    llvm/lib/Analysis/InstructionSimplify.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index b3feb2470e58efd..3d192d0759a1e67 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -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) {


        


More information about the llvm-commits mailing list