summaryrefslogtreecommitdiffstats
path: root/llvm/lib/TableGen/Record.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2015-06-06 01:33:58 +0000
committerCraig Topper <craig.topper@gmail.com>2015-06-06 01:33:58 +0000
commit5904beb666237bb13f7699f6db817f35cd6822ce (patch)
tree37f9db7de84dbc174547f30f98025a960d520651 /llvm/lib/TableGen/Record.cpp
parentdaf263de842e5bac449531286f72978c49105972 (diff)
downloadbcm5719-llvm-5904beb666237bb13f7699f6db817f35cd6822ce.tar.gz
bcm5719-llvm-5904beb666237bb13f7699f6db817f35cd6822ce.zip
[TableGen] Fold variable declaration/initialization into if condition for a couple short lived variables. NFC
llvm-svn: 239207
Diffstat (limited to 'llvm/lib/TableGen/Record.cpp')
-rw-r--r--llvm/lib/TableGen/Record.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/llvm/lib/TableGen/Record.cpp b/llvm/lib/TableGen/Record.cpp
index d9405e18d5c..93922c7c99f 100644
--- a/llvm/lib/TableGen/Record.cpp
+++ b/llvm/lib/TableGen/Record.cpp
@@ -927,9 +927,8 @@ static Init *ForeachHelper(Init *LHS, Init *MHS, Init *RHS, RecTy *Type,
DagInit *MHSd = dyn_cast<DagInit>(MHS);
if (MHSd && isa<DagRecTy>(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<std::pair<Init *, std::string> > 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<TypedInit>(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;
OpenPOWER on IntegriCloud