[PATCH] Refactor: Simplify boolean conditional return statements in lib/Target/Arm
Craig Topper
craig.topper at gmail.com
Mon May 25 02:33:07 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) &&
----------------
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.
================
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);
}
----------------
Push negate through
================
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);
}
----------------
Push negate through
================
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);
----------------
Push negate through and use != and &&. Align second line after the return.
================
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);
----------------
Push the negate through this expression and all the similar ones below.
http://reviews.llvm.org/D9980
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list