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

Pasi Parviainen pasi.parviainen at iki.fi
Fri May 15 16:10:03 PDT 2015


On 14.5.2015 8:53, Craig Topper wrote:
> 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());
>       }

To which one are you trying to make a point, to a reader or a compiler? 
If for the reader, please don't. And the latter makes me sad :(.

>       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;
>     }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>




More information about the llvm-commits mailing list