summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Instructions.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2015-03-23 19:51:23 +0000
committerDavid Blaikie <dblaikie@gmail.com>2015-03-23 19:51:23 +0000
commit9965c5ae14f1123c3529d972bf7637407ffefcd3 (patch)
treed67dbb5b6dfaddc78b4ad022f91b28a7f57457c3 /llvm/lib/IR/Instructions.cpp
parent4f75c097b05b8eaf704ed679b18d5a54f2e63476 (diff)
downloadbcm5719-llvm-9965c5ae14f1123c3529d972bf7637407ffefcd3.tar.gz
bcm5719-llvm-9965c5ae14f1123c3529d972bf7637407ffefcd3.zip
Refactor: Simplify boolean expressions in llvm IR
Simplify boolean expressions using `true` and `false` with `clang-tidy` Patch by Richard Thomson with a few other simplifications to fix else-after-returns in the surrounding code. Differential Revision: http://reviews.llvm.org/D8527 llvm-svn: 233005
Diffstat (limited to 'llvm/lib/IR/Instructions.cpp')
-rw-r--r--llvm/lib/IR/Instructions.cpp50
1 files changed, 22 insertions, 28 deletions
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp
index 26020496027..af2aeb9ec62 100644
--- a/llvm/lib/IR/Instructions.cpp
+++ b/llvm/lib/IR/Instructions.cpp
@@ -2529,44 +2529,38 @@ bool CastInst::isCastable(Type *SrcTy, Type *DestTy) {
// Run through the possibilities ...
if (DestTy->isIntegerTy()) { // Casting to integral
- if (SrcTy->isIntegerTy()) { // Casting from integral
+ if (SrcTy->isIntegerTy()) // Casting from integral
return true;
- } else if (SrcTy->isFloatingPointTy()) { // Casting from floating pt
+ if (SrcTy->isFloatingPointTy()) // Casting from floating pt
return true;
- } else if (SrcTy->isVectorTy()) { // Casting from vector
+ if (SrcTy->isVectorTy()) // Casting from vector
return DestBits == SrcBits;
- } else { // Casting from something else
- return SrcTy->isPointerTy();
- }
- } else if (DestTy->isFloatingPointTy()) { // Casting to floating pt
- if (SrcTy->isIntegerTy()) { // Casting from integral
+ // Casting from something else
+ return SrcTy->isPointerTy();
+ }
+ if (DestTy->isFloatingPointTy()) { // Casting to floating pt
+ if (SrcTy->isIntegerTy()) // Casting from integral
return true;
- } else if (SrcTy->isFloatingPointTy()) { // Casting from floating pt
+ if (SrcTy->isFloatingPointTy()) // Casting from floating pt
return true;
- } else if (SrcTy->isVectorTy()) { // Casting from vector
+ if (SrcTy->isVectorTy()) // Casting from vector
return DestBits == SrcBits;
- } else { // Casting from something else
- return false;
- }
- } else if (DestTy->isVectorTy()) { // Casting to vector
+ // Casting from something else
+ return false;
+ }
+ if (DestTy->isVectorTy()) // Casting to vector
return DestBits == SrcBits;
- } else if (DestTy->isPointerTy()) { // Casting to pointer
- if (SrcTy->isPointerTy()) { // Casting from pointer
- return true;
- } else if (SrcTy->isIntegerTy()) { // Casting from integral
+ if (DestTy->isPointerTy()) { // Casting to pointer
+ if (SrcTy->isPointerTy()) // Casting from pointer
return true;
- } else { // Casting from something else
- return false;
- }
- } else if (DestTy->isX86_MMXTy()) {
- if (SrcTy->isVectorTy()) {
+ return SrcTy->isIntegerTy(); // Casting from integral
+ }
+ if (DestTy->isX86_MMXTy()) {
+ if (SrcTy->isVectorTy())
return DestBits == SrcBits; // 64-bit vector to MMX
- } else {
- return false;
- }
- } else { // Casting to something else
return false;
- }
+ } // Casting to something else
+ return false;
}
bool CastInst::isBitCastable(Type *SrcTy, Type *DestTy) {
OpenPOWER on IntegriCloud