[llvm] r237342 - [TableGen] Simplify some code. NFC

Craig Topper craig.topper at gmail.com
Wed May 13 22:53:59 PDT 2015


Author: ctopper
Date: Thu May 14 00:53:59 2015
New Revision: 237342

URL: http://llvm.org/viewvc/llvm-project?rev=237342&view=rev
Log:
[TableGen] Simplify some code. NFC

Modified:
    llvm/trunk/lib/TableGen/Record.cpp

Modified: llvm/trunk/lib/TableGen/Record.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/Record.cpp?rev=237342&r1=237341&r2=237342&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/Record.cpp (original)
+++ llvm/trunk/lib/TableGen/Record.cpp Thu May 14 00:53:59 2015
@@ -794,14 +794,10 @@ Init *UnOpInit::Fold(Record *CurRec, Mul
   }
   case EMPTY: {
     if (ListInit *LHSl = dyn_cast<ListInit>(LHS)) {
-      if (LHSl->empty())
-        return IntInit::get(1);
-      return IntInit::get(0);
+      return IntInit::get(!!LHSl->empty());
     }
     if (StringInit *LHSs = dyn_cast<StringInit>(LHS)) {
-      if (LHSs->getValue().empty())
-        return IntInit::get(1);
-      return IntInit::get(0);
+      return IntInit::get(!!LHSs->getValue().empty());
     }
 
     break;
@@ -1134,9 +1130,8 @@ Init *TernOpInit::Fold(Record *CurRec, M
   }
 
   case FOREACH: {
-    Init *Result = ForeachHelper(LHS, MHS, RHS, getType(),
-                                 CurRec, CurMultiClass);
-    if (Result)
+    if (Init *Result = ForeachHelper(LHS, MHS, RHS, getType(),
+                                     CurRec, CurMultiClass))
       return Result;
     break;
   }





More information about the llvm-commits mailing list