[PATCH] Refactor: Simplify boolean conditional return statements in lib/Transforms/Vectorize
Richard
legalize at xmission.com
Mon May 25 11:46:58 PDT 2015
Hi aschwaighofer, bkramer, chandlerc, anemet, chapuni, arsenm, eeckstein, mzolotukhin,
Use clang-tidy to simplify boolean conditional return statements
http://reviews.llvm.org/D10003
Files:
lib/Transforms/Vectorize/BBVectorize.cpp
lib/Transforms/Vectorize/LoopVectorize.cpp
lib/Transforms/Vectorize/SLPVectorizer.cpp
Index: lib/Transforms/Vectorize/BBVectorize.cpp
===================================================================
--- lib/Transforms/Vectorize/BBVectorize.cpp
+++ lib/Transforms/Vectorize/BBVectorize.cpp
@@ -934,11 +934,8 @@
T2->getScalarType()->isPointerTy()))
return false;
- if (!TTI && (T1->getPrimitiveSizeInBits() >= Config.VectorBits ||
- T2->getPrimitiveSizeInBits() >= Config.VectorBits))
- return false;
-
- return true;
+ return TTI || (T1->getPrimitiveSizeInBits() < Config.VectorBits &&
+ T2->getPrimitiveSizeInBits() < Config.VectorBits);
}
// This function returns true if the two provided instructions are compatible
Index: lib/Transforms/Vectorize/LoopVectorize.cpp
===================================================================
--- lib/Transforms/Vectorize/LoopVectorize.cpp
+++ lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -4458,9 +4458,8 @@
}
static bool isStrideMul(Instruction *I, LoopVectorizationLegality *Legal) {
- if (Legal->hasStride(I->getOperand(0)) || Legal->hasStride(I->getOperand(1)))
- return true;
- return false;
+ return Legal->hasStride(I->getOperand(0)) ||
+ Legal->hasStride(I->getOperand(1));
}
unsigned
Index: lib/Transforms/Vectorize/SLPVectorizer.cpp
===================================================================
--- lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -151,10 +151,8 @@
/// of an alternate sequence which can later be merged as
/// a ShuffleVector instruction.
static bool canCombineAsAltInst(unsigned Op) {
- if (Op == Instruction::FAdd || Op == Instruction::FSub ||
- Op == Instruction::Sub || Op == Instruction::Add)
- return true;
- return false;
+ return Op == Instruction::FAdd || Op == Instruction::FSub ||
+ Op == Instruction::Sub || Op == Instruction::Add;
}
/// \returns ShuffleVector instruction if intructions in \p VL have
@@ -1642,10 +1640,7 @@
return true;
// Gathering cost would be too much for tiny trees.
- if (VectorizableTree[0].NeedToGather || VectorizableTree[1].NeedToGather)
- return false;
-
- return true;
+ return !VectorizableTree[0].NeedToGather && !VectorizableTree[1].NeedToGather;
}
int BoUpSLP::getSpillCost() {
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10003.26468.patch
Type: text/x-patch
Size: 2335 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150525/67e0b94b/attachment.bin>
More information about the llvm-commits
mailing list