Refactor: Simplify boolean conditional return statements in lib/Transforms/Vectorize...
authorMichael Zolotukhin <mzolotukhin@apple.com>
Sat, 24 Oct 2015 20:16:42 +0000 (20:16 +0000)
committerMichael Zolotukhin <mzolotukhin@apple.com>
Sat, 24 Oct 2015 20:16:42 +0000 (20:16 +0000)
Summary: Use clang-tidy to simplify boolean conditional return statements

Differential Revision: http://reviews.llvm.org/D10003

Patch by Richard<legalize@xmission.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251206 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Vectorize/LoopVectorize.cpp
lib/Transforms/Vectorize/SLPVectorizer.cpp

index 2381b63b767eb7a516ba9d594c2fb1a23324b2fd..c61a496b74726d859a42dc57752a41c15fc3afc6 100644 (file)
@@ -5215,9 +5215,8 @@ static bool isLikelyComplexAddressComputation(Value *Ptr,
 }
 
 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 57b09caa5a4436036b260e51608080e77078d022..5cd187877dde00c287f67328ed4e8ade3a2970b3 100644 (file)
@@ -168,10 +168,8 @@ static unsigned getAltOpcode(unsigned Op) {
 /// 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 instructions in \p VL have
@@ -1990,10 +1988,7 @@ static bool shouldReorderOperands(int i, Instruction &I,
     return false;
   }
   // One opcode, put the instruction on the right.
-  if (ILeft) {
-    return true;
-  }
-  return false;
+  return ILeft != nullptr;
 }
 
 void BoUpSLP::reorderInputsAccordingToOpcode(ArrayRef<Value *> VL,