[PATCH] D10001: Refactor: Simplify boolean conditional return statements in lib/Transforms/Util

Alexander Kornienko via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 28 07:36:49 PST 2015


alexfh added a subscriber: alexfh.

================
Comment at: lib/Transforms/Utils/Local.cpp:298
@@ -297,2 +297,3 @@
   // debug info is empty.
   if (DbgDeclareInst *DDI = dyn_cast<DbgDeclareInst>(I)) {
+    return DDI->getAddress() == nullptr;
----------------
Please remove the braces here and in the next `if` as well.

================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:3663
@@ -3662,6 +3662,3 @@
       DefaultResults.size() == 1 ? DefaultResults.begin()->second : nullptr;
-  if ((!DefaultResult &&
-        !isa<UnreachableInst>(DefaultDest->getFirstNonPHIOrDbg())))
-    return false;
-
-  return true;
+  return !(!DefaultResult &&
+        !isa<UnreachableInst>(DefaultDest->getFirstNonPHIOrDbg()));
----------------
Push the negation through (should the check be taught to do this?).


http://reviews.llvm.org/D10001





More information about the llvm-commits mailing list