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

Richard legalize at xmission.com
Mon May 25 09:46:23 PDT 2015


================
Comment at: lib/Target/NVPTX/NVPTXAsmPrinter.cpp:638
@@ -637,5 +637,3 @@
   if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(C)) {
-    if (GV->getName() == "llvm.used")
-      return false;
-    return true;
+    return !(GV->getName() == "llvm.used");
   }
----------------
craig.topper wrote:
> Use !=
Fixed.

================
Comment at: lib/Target/NVPTX/NVPTXAsmPrinter.cpp:1921
@@ -1923,1 +1920,3 @@
+  return PI != TypeNameMap.end() && (!PI->second.compare("struct._image1d_t") ||
                                   !PI->second.compare("struct._image2d_t") ||
+                                  !PI->second.compare("struct._image3d_t"));
----------------
craig.topper wrote:
> Fix indentation to line up with previous line.
Fixed.

================
Comment at: lib/Target/NVPTX/NVPTXISelLowering.cpp:3740
@@ -3739,5 +3739,3 @@
   if (AM.BaseGV) {
-    if (AM.BaseOffs || AM.HasBaseReg || AM.Scale)
-      return false;
-    return true;
+    return !(AM.BaseOffs || AM.HasBaseReg || AM.Scale);
   }
----------------
craig.topper wrote:
> Push negate through
Fixed.

================
Comment at: lib/Target/NVPTX/NVPTXISelLowering.cpp:4105
@@ -4110,1 +4104,3 @@
+      return Val.isIntN(OptSize);
     } else {
+      return Val.isSignedIntN(OptSize);
----------------
craig.topper wrote:
> Drop the else and the curly braces
While I know this is an LLVM/clang style rule, it's beyond the scope of this change.  There is a check for this in clang-tidy to detect it.

================
Comment at: lib/Target/NVPTX/NVPTXUtilities.cpp:340
@@ -340,2 +339,3 @@
+  return (id == Intrinsic::nvvm_barrier0) ||
       (id == Intrinsic::nvvm_barrier0_popc) ||
       (id == Intrinsic::nvvm_barrier0_and) ||
----------------
craig.topper wrote:
> Indent to line up with previous line. Same below
Fixed.

http://reviews.llvm.org/D9983

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






More information about the llvm-commits mailing list