From a19f3db07cab54ff3976cc2c42597aabd2be25e0 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Sat, 6 Jun 2015 01:33:58 +0000 Subject: [PATCH] [TableGen] Fold variable declaration/initialization into if condition for a couple short lived variables. NFC llvm-svn: 239207 --- lib/TableGen/Record.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/TableGen/Record.cpp b/lib/TableGen/Record.cpp index d9405e18d5c..93922c7c99f 100644 --- a/lib/TableGen/Record.cpp +++ b/lib/TableGen/Record.cpp @@ -927,9 +927,8 @@ static Init *ForeachHelper(Init *LHS, Init *MHS, Init *RHS, RecTy *Type, DagInit *MHSd = dyn_cast(MHS); if (MHSd && isa(Type)) { Init *Val = MHSd->getOperator(); - Init *Result = EvaluateOperation(RHSo, LHS, Val, - Type, CurRec, CurMultiClass); - if (Result) + if (Init *Result = EvaluateOperation(RHSo, LHS, Val, + Type, CurRec, CurMultiClass)) Val = Result; std::vector > args; @@ -938,9 +937,8 @@ static Init *ForeachHelper(Init *LHS, Init *MHS, Init *RHS, RecTy *Type, std::string ArgName = MHSd->getArgName(i); // Process args - Init *Result = EvaluateOperation(RHSo, LHS, Arg, Type, - CurRec, CurMultiClass); - if (Result) + if (Init *Result = EvaluateOperation(RHSo, LHS, Arg, Type, + CurRec, CurMultiClass)) Arg = Result; // TODO: Process arg names @@ -1351,8 +1349,8 @@ Init *VarListElementInit:: resolveListElementReference(Record &R, unsigned Elt) const { if (Init *Result = TI->resolveListElementReference(R, RV, Element)) { if (TypedInit *TInit = dyn_cast(Result)) { - Init *Result2 = TInit->resolveListElementReference(R, RV, Elt); - if (Result2) return Result2; + if (Init *Result2 = TInit->resolveListElementReference(R, RV, Elt)) + return Result2; return VarListElementInit::get(TInit, Elt); } return Result;