[PATCH] Refactor: Simplify boolean conditional return statements in lib/Target/Arm

Richard legalize at xmission.com
Mon May 25 09:19:47 PDT 2015


================
Comment at: lib/Target/ARM/ARMFrameLowering.cpp:113
@@ -113,2 +112,3 @@
+  return (MI->getOpcode() == ARM::LDR_POST_IMM ||
        MI->getOpcode() == ARM::LDR_POST_REG ||
        MI->getOpcode() == ARM::t2LDR_POST) &&
----------------
craig.topper wrote:
> This should really be aligned right after the opening parenthese on the previous line. That's really probably true of many of these patches, but it looks particularly bad here.
Fixed.

I forgot to run clang-format on these before posting them; I'm doing that now.

================
Comment at: lib/Target/ARM/ARMISelLowering.cpp:4942
@@ -4941,6 +4941,3 @@
   // VUZP.32 for 64-bit vectors is a pseudo-instruction alias for VTRN.32.
-  if (VT.is64BitVector() && EltSz == 32)
-    return false;
-
-  return true;
+  return !(VT.is64BitVector() && EltSz == 32);
 }
----------------
craig.topper wrote:
> Push negate through
Fixed.

================
Comment at: lib/Target/ARM/ARMISelLowering.cpp:4966
@@ -4968,6 +4965,3 @@
   // VUZP.32 for 64-bit vectors is a pseudo-instruction alias for VTRN.32.
-  if (VT.is64BitVector() && EltSz == 32)
-    return false;
-
-  return true;
+  return !(VT.is64BitVector() && EltSz == 32);
 }
----------------
craig.topper wrote:
> Push negate through
Fixed.

================
Comment at: lib/Target/ARM/ARMISelLowering.cpp:10055
@@ -10070,6 +10054,3 @@
   SDNode *U = *ExtVal->use_begin();
-  if ((U->getOpcode() == ISD::ADD || U->getOpcode() == ISD::SUB ||
-       U->getOpcode() == ISD::SHL || U->getOpcode() == ARMISD::VSHL))
-    return false;
-
-  return true;
+  return !(U->getOpcode() == ISD::ADD || U->getOpcode() == ISD::SUB ||
+       U->getOpcode() == ISD::SHL || U->getOpcode() == ARMISD::VSHL);
----------------
craig.topper wrote:
> Push negate through and use != and &&. Align second line after the return.
Fixed.

================
Comment at: lib/Target/ARM/AsmParser/ARMAsmParser.cpp:1263
@@ -1262,5 +1262,3 @@
   bool isMemTBB() const {
-    if (!isMem() || !Memory.OffsetRegNum || Memory.isNegative ||
-        Memory.ShiftType != ARM_AM::no_shift || Memory.Alignment != 0)
-      return false;
-    return true;
+    return !(!isMem() || !Memory.OffsetRegNum || Memory.isNegative ||
+        Memory.ShiftType != ARM_AM::no_shift || Memory.Alignment != 0);
----------------
craig.topper wrote:
> Push the negate through this expression and all the similar ones below.
Fixed.

http://reviews.llvm.org/D9980

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






More information about the llvm-commits mailing list