<div dir="ltr">Oh yeah i don't know why i did the two negations. that was dumb. I'll fix. I think my brain got messed up around the fact that the original code didn't even use "empty" it was checking getSize() == 0.</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 15, 2015 at 4:36 PM, Pasi Parviainen <span dir="ltr"><<a href="mailto:pasi.parviainen@iki.fi" target="_blank">pasi.parviainen@iki.fi</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 16.5.2015 2:10, Pasi Parviainen wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 14.5.2015 8:53, Craig Topper wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: ctopper<br>
Date: Thu May 14 00:53:59 2015<br>
New Revision: 237342<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=237342&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=237342&view=rev</a><br>
Log:<br>
[TableGen] Simplify some code. NFC<br>
<br>
Modified:<br>
     llvm/trunk/lib/TableGen/Record.cpp<br>
<br>
Modified: llvm/trunk/lib/TableGen/Record.cpp<br>
URL:<br>
<a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/Record.cpp?rev=237342&r1=237341&r2=237342&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/Record.cpp?rev=237342&r1=237341&r2=237342&view=diff</a><br>
<br>
==============================================================================<br>
<br>
--- llvm/trunk/lib/TableGen/Record.cpp (original)<br>
+++ llvm/trunk/lib/TableGen/Record.cpp Thu May 14 00:53:59 2015<br>
@@ -794,14 +794,10 @@ Init *UnOpInit::Fold(Record *CurRec, Mul<br>
    }<br>
    case EMPTY: {<br>
      if (ListInit *LHSl = dyn_cast<ListInit>(LHS)) {<br>
-      if (LHSl->empty())<br>
-        return IntInit::get(1);<br>
-      return IntInit::get(0);<br>
+      return IntInit::get(!!LHSl->empty());<br>
      }<br>
      if (StringInit *LHSs = dyn_cast<StringInit>(LHS)) {<br>
-      if (LHSs->getValue().empty())<br>
-        return IntInit::get(1);<br>
-      return IntInit::get(0);<br>
+      return IntInit::get(!!LHSs->getValue().empty());<br>
      }<br>
</blockquote>
<br>
To which one are you trying to make a point, to a reader or a compiler?<br>
If for the reader, please don't. And the latter makes me sad :(.<br>
</blockquote>
<br></div></div>
And this is meant as a comment for those double negations...<div class="HOEnZb"><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
      break;<br>
@@ -1134,9 +1130,8 @@ Init *TernOpInit::Fold(Record *CurRec, M<br>
    }<br>
<br>
    case FOREACH: {<br>
-    Init *Result = ForeachHelper(LHS, MHS, RHS, getType(),<br>
-                                 CurRec, CurMultiClass);<br>
-    if (Result)<br>
+    if (Init *Result = ForeachHelper(LHS, MHS, RHS, getType(),<br>
+                                     CurRec, CurMultiClass))<br>
        return Result;<br>
      break;<br>
    }<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br>
</blockquote>
<br>
</blockquote>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">~Craig</div>
</div>