[llvm] r304822 - [DAG] remove duplicated code for isOnlyUsedInZeroEqualityComparison(); NFCI
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 6 12:40:09 PDT 2017
Author: spatel
Date: Tue Jun 6 14:40:09 2017
New Revision: 304822
URL: http://llvm.org/viewvc/llvm-project?rev=304822&view=rev
Log:
[DAG] remove duplicated code for isOnlyUsedInZeroEqualityComparison(); NFCI
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=304822&r1=304821&r2=304822&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Tue Jun 6 14:40:09 2017
@@ -5998,20 +5998,6 @@ void SelectionDAGBuilder::LowerCallTo(Im
}
}
-/// Return true if it only matters that the value is equal or not-equal to zero.
-static bool IsOnlyUsedInZeroEqualityComparison(const Value *V) {
- for (const User *U : V->users()) {
- if (const ICmpInst *IC = dyn_cast<ICmpInst>(U))
- if (IC->isEquality())
- if (const Constant *C = dyn_cast<Constant>(IC->getOperand(1)))
- if (C->isNullValue())
- continue;
- // Unknown instruction.
- return false;
- }
- return true;
-}
-
static SDValue getMemCmpLoad(const Value *PtrVal, MVT LoadVT,
SelectionDAGBuilder &Builder) {
@@ -6098,7 +6084,7 @@ bool SelectionDAGBuilder::visitMemCmpCal
// memcmp(S1,S2,2) != 0 -> (*(short*)LHS != *(short*)RHS) != 0
// memcmp(S1,S2,4) != 0 -> (*(int*)LHS != *(int*)RHS) != 0
- if (!CSize || !IsOnlyUsedInZeroEqualityComparison(&I))
+ if (!CSize || !isOnlyUsedInZeroEqualityComparison(&I))
return false;
// If the target has a fast compare for the given size, it will return a
More information about the llvm-commits
mailing list