summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/CodeGenPrepare.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-10-24 23:11:13 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-10-24 23:11:13 +0000
commit84921b9860adbc7cd40df8beb9caf542ddaaa51b (patch)
tree5baaa37b6d913d64895cd573ea2e5e36372f5c51 /llvm/lib/CodeGen/CodeGenPrepare.cpp
parentf82ed2a28cefc1933052daa7cf81ca80bc405ed2 (diff)
downloadbcm5719-llvm-84921b9860adbc7cd40df8beb9caf542ddaaa51b.tar.gz
bcm5719-llvm-84921b9860adbc7cd40df8beb9caf542ddaaa51b.zip
Refactor: Simplify boolean conditional return statements in lib/CodeGen.
Patch by Richard. llvm-svn: 251213
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r--llvm/lib/CodeGen/CodeGenPrepare.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index 2d260f5d520..6f00c471c21 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -2361,9 +2361,7 @@ class TypePromotionHelper {
/// \brief Utility function to determine if \p OpIdx should be promoted when
/// promoting \p Inst.
static bool shouldExtOperand(const Instruction *Inst, int OpIdx) {
- if (isa<SelectInst>(Inst) && OpIdx == 0)
- return false;
- return true;
+ return !(isa<SelectInst>(Inst) && OpIdx == 0);
}
/// \brief Utility function to promote the operand of \p Ext when this
@@ -2500,10 +2498,8 @@ bool TypePromotionHelper::canGetThrough(const Instruction *Inst,
return false;
// #2 check that the truncate just drops extended bits.
- if (Inst->getType()->getIntegerBitWidth() >= OpndType->getIntegerBitWidth())
- return true;
-
- return false;
+ return Inst->getType()->getIntegerBitWidth() >=
+ OpndType->getIntegerBitWidth();
}
TypePromotionHelper::Action TypePromotionHelper::getAction(
@@ -3913,11 +3909,8 @@ static bool sinkSelectOperand(const TargetTransformInfo *TTI, Value *V) {
auto *I = dyn_cast<Instruction>(V);
// If it's safe to speculatively execute, then it should not have side
// effects; therefore, it's safe to sink and possibly *not* execute.
- if (I && I->hasOneUse() && isSafeToSpeculativelyExecute(I) &&
- TTI->getUserCost(I) >= TargetTransformInfo::TCC_Expensive)
- return true;
-
- return false;
+ return I && I->hasOneUse() && isSafeToSpeculativelyExecute(I) &&
+ TTI->getUserCost(I) >= TargetTransformInfo::TCC_Expensive;
}
/// Returns true if a SelectInst should be turned into an explicit branch.
OpenPOWER on IntegriCloud