[PATCH] Refactor: Simplify boolean conditional return statements in llvm/lib/IR

Craig Topper craig.topper at gmail.com
Mon May 25 00:06:00 PDT 2015


================
Comment at: lib/IR/Instructions.cpp:1375
@@ -1374,5 +1374,3 @@
 bool ExtractElementInst::isValidOperands(const Value *Val, const Value *Index) {
-  if (!Val->getType()->isVectorTy() || !Index->getType()->isIntegerTy())
-    return false;
-  return true;
+  return !(!Val->getType()->isVectorTy() || !Index->getType()->isIntegerTy());
 }
----------------
Push the negate through

================
Comment at: lib/IR/Instructions.cpp:2603
@@ -2604,6 +2602,3 @@
 
-  if (DestTy->isX86_MMXTy() || SrcTy->isX86_MMXTy())
-    return false;
-
-  return true;
+  return !(DestTy->isX86_MMXTy() || SrcTy->isX86_MMXTy());
 }
----------------
Push the negate through

================
Comment at: lib/IR/Verifier.cpp:1515
@@ -1514,6 +1514,3 @@
       || (LastIndex == AttributeSet::FunctionIndex
-          && (LastSlot == 0 || Attrs.getSlotIndex(LastSlot - 1) <= Params)))
-    return true;
-
-  return false;
+          && (LastSlot == 0 || Attrs.getSlotIndex(LastSlot - 1) <= Params));
 }
----------------
Operators should go on end of previous lines.

http://reviews.llvm.org/D9974

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list