[llvm] r348149 - [CmpInstAnalysis] fix formatting; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 3 07:48:30 PST 2018
Author: spatel
Date: Mon Dec 3 07:48:30 2018
New Revision: 348149
URL: http://llvm.org/viewvc/llvm-project?rev=348149&view=rev
Log:
[CmpInstAnalysis] fix formatting; NFC
There are potential improvements to the structure of this API
raised by D54994, but remove some cosmetic blemishes before
making any functional changes.
Modified:
llvm/trunk/include/llvm/Analysis/CmpInstAnalysis.h
llvm/trunk/lib/Analysis/CmpInstAnalysis.cpp
llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
Modified: llvm/trunk/include/llvm/Analysis/CmpInstAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/CmpInstAnalysis.h?rev=348149&r1=348148&r2=348149&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/CmpInstAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/CmpInstAnalysis.h Mon Dec 3 07:48:30 2018
@@ -58,7 +58,7 @@ namespace llvm {
/// Return true if both predicates match sign or if at least one of them is an
/// equality comparison (which is signless).
- bool PredicatesFoldable(CmpInst::Predicate p1, CmpInst::Predicate p2);
+ bool predicatesFoldable(CmpInst::Predicate P1, CmpInst::Predicate P2);
/// Decompose an icmp into the form ((X & Mask) pred 0) if possible. The
/// returned predicate is either == or !=. Returns false if decomposition
Modified: llvm/trunk/lib/Analysis/CmpInstAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/CmpInstAnalysis.cpp?rev=348149&r1=348148&r2=348149&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/CmpInstAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/CmpInstAnalysis.cpp Mon Dec 3 07:48:30 2018
@@ -58,10 +58,10 @@ Value *llvm::getICmpValue(bool Sign, uns
return nullptr;
}
-bool llvm::PredicatesFoldable(ICmpInst::Predicate p1, ICmpInst::Predicate p2) {
- return (CmpInst::isSigned(p1) == CmpInst::isSigned(p2)) ||
- (CmpInst::isSigned(p1) && ICmpInst::isEquality(p2)) ||
- (CmpInst::isSigned(p2) && ICmpInst::isEquality(p1));
+bool llvm::predicatesFoldable(ICmpInst::Predicate P1, ICmpInst::Predicate P2) {
+ return (CmpInst::isSigned(P1) == CmpInst::isSigned(P2)) ||
+ (CmpInst::isSigned(P1) && ICmpInst::isEquality(P2)) ||
+ (CmpInst::isSigned(P2) && ICmpInst::isEquality(P1));
}
bool llvm::decomposeBitTestICmp(Value *LHS, Value *RHS,
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp?rev=348149&r1=348148&r2=348149&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp Mon Dec 3 07:48:30 2018
@@ -1033,7 +1033,7 @@ Value *InstCombiner::foldAndOfICmps(ICmp
ICmpInst::Predicate PredL = LHS->getPredicate(), PredR = RHS->getPredicate();
// (icmp1 A, B) & (icmp2 A, B) --> (icmp3 A, B)
- if (PredicatesFoldable(PredL, PredR)) {
+ if (predicatesFoldable(PredL, PredR)) {
if (LHS->getOperand(0) == RHS->getOperand(1) &&
LHS->getOperand(1) == RHS->getOperand(0))
LHS->swapOperands();
@@ -1131,7 +1131,7 @@ Value *InstCombiner::foldAndOfICmps(ICmp
return nullptr;
// We can't fold (ugt x, C) & (sgt x, C2).
- if (!PredicatesFoldable(PredL, PredR))
+ if (!predicatesFoldable(PredL, PredR))
return nullptr;
// Ensure that the larger constant is on the RHS.
@@ -1976,7 +1976,7 @@ Value *InstCombiner::foldOrOfICmps(ICmpI
}
// (icmp1 A, B) | (icmp2 A, B) --> (icmp3 A, B)
- if (PredicatesFoldable(PredL, PredR)) {
+ if (predicatesFoldable(PredL, PredR)) {
if (LHS->getOperand(0) == RHS->getOperand(1) &&
LHS->getOperand(1) == RHS->getOperand(0))
LHS->swapOperands();
@@ -2066,7 +2066,7 @@ Value *InstCombiner::foldOrOfICmps(ICmpI
return nullptr;
// We can't fold (ugt x, C) | (sgt x, C2).
- if (!PredicatesFoldable(PredL, PredR))
+ if (!predicatesFoldable(PredL, PredR))
return nullptr;
// Ensure that the larger constant is on the RHS.
@@ -2462,7 +2462,7 @@ static Instruction *foldXorToXor(BinaryO
}
Value *InstCombiner::foldXorOfICmps(ICmpInst *LHS, ICmpInst *RHS) {
- if (PredicatesFoldable(LHS->getPredicate(), RHS->getPredicate())) {
+ if (predicatesFoldable(LHS->getPredicate(), RHS->getPredicate())) {
if (LHS->getOperand(0) == RHS->getOperand(1) &&
LHS->getOperand(1) == RHS->getOperand(0))
LHS->swapOperands();
More information about the llvm-commits
mailing list