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

Craig Topper craig.topper at gmail.com
Sun May 24 23:55:44 PDT 2015


================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:9806
@@ -9807,6 +9805,3 @@
     EVT TruncateType = Inst->getValueType(0);
-    if (TruncateType != SliceType &&
-        !TLI.isOperationLegal(ISD::ZERO_EXTEND, TruncateType))
-      return false;
-
-    return true;
+    return !(TruncateType != SliceType &&
+        !TLI.isOperationLegal(ISD::ZERO_EXTEND, TruncateType));
----------------
Push the negate through and use an OR

================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:9910
@@ -9914,6 +9909,3 @@
     // 3. Check that we do not have a zext in the way.
-    if (Inst->getValueType(0) != getLoadedType())
-      return false;
-
-    return true;
+    return !(Inst->getValueType(0) != getLoadedType());
   }
----------------
Use ==

================
Comment at: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:2317
@@ -2316,5 +2316,3 @@
   bool isGNU = Triple(TM.getTargetTriple()).getEnvironment() == Triple::GNU;
-  if (isGNU && !TM.Options.UnsafeFPMath)
-    return false;
-  return true;
+  return !(isGNU && !TM.Options.UnsafeFPMath);
 }
----------------
Push the negate through

================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:2702
@@ -2703,3 +2701,3 @@
 
-  if (Op.getOpcode() == ISD::OR &&
+  return !(Op.getOpcode() == ISD::OR &&
       !MaskedValueIsZero(Op.getOperand(0),
----------------
Push the negate through

================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1365
@@ -1364,3 +1364,3 @@
   // physical register.
-  if (!OPI2->isReg() ||
+  return !(!OPI2->isReg() ||
       (!TargetRegisterInfo::isPhysicalRegister(OPI->getReg()) &&
----------------
Push the negate through

http://reviews.llvm.org/D9971

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






More information about the llvm-commits mailing list