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

Richard legalize at xmission.com
Mon May 25 06:58:27 PDT 2015


================
Comment at: lib/CodeGen/MachineLICM.cpp:946
@@ -945,6 +945,3 @@
   // Stores and side effects are already checked by isSafeToMove.
-  if (I.mayLoad() && !isLoadFromGOTOrConstantPool(I) &&
-      !IsGuaranteedToExecute(I.getParent()))
-    return false;
-
-  return true;
+  return !(I.mayLoad() && !isLoadFromGOTOrConstantPool(I) &&
+      !IsGuaranteedToExecute(I.getParent()));
----------------
craig.topper wrote:
> Push the negate through
Fixed.

================
Comment at: lib/CodeGen/PseudoSourceValue.cpp:98
@@ -97,3 +97,3 @@
 bool PseudoSourceValue::mayAlias(const MachineFrameInfo *MFI) const {
-  if (this == getGOT() ||
+  return !(this == getGOT() ||
       this == getConstantPool() ||
----------------
craig.topper wrote:
> Push the negate through and use ANDs
Fixed.

================
Comment at: lib/CodeGen/TargetInstrInfo.cpp:202
@@ -201,6 +201,3 @@
   SrcOpIdx2 = SrcOpIdx1 + 1;
-  if (!MI->getOperand(SrcOpIdx1).isReg() ||
-      !MI->getOperand(SrcOpIdx2).isReg())
-    // No idea.
-    return false;
-  return true;
+  return !(!MI->getOperand(SrcOpIdx1).isReg() ||
+      !MI->getOperand(SrcOpIdx2).isReg());
----------------
craig.topper wrote:
> Push the negate through
Fixed.

http://reviews.llvm.org/D9970

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






More information about the llvm-commits mailing list