[TableGen] Remove unnecessary outer 'if' and merge it's conditions into the inner 'if's. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239206 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Craig Topper 2015-06-06 01:33:55 +00:00
parent 77411bdfe3
commit c052f54559

View File

@ -913,8 +913,6 @@ static Init *EvaluateOperation(OpInit *RHSo, Init *LHS, Init *Arg,
static Init *ForeachHelper(Init *LHS, Init *MHS, Init *RHS, RecTy *Type,
Record *CurRec, MultiClass *CurMultiClass) {
DagInit *MHSd = dyn_cast<DagInit>(MHS);
ListInit *MHSl = dyn_cast<ListInit>(MHS);
OpInit *RHSo = dyn_cast<OpInit>(RHS);
@ -926,8 +924,8 @@ static Init *ForeachHelper(Init *LHS, Init *MHS, Init *RHS, RecTy *Type,
if (!LHSt)
PrintFatalError(CurRec->getLoc(), "!foreach requires typed variable\n");
if ((MHSd && isa<DagRecTy>(Type)) || (MHSl && isa<ListRecTy>(Type))) {
if (MHSd) {
DagInit *MHSd = dyn_cast<DagInit>(MHS);
if (MHSd && isa<DagRecTy>(Type)) {
Init *Val = MHSd->getOperator();
Init *Result = EvaluateOperation(RHSo, LHS, Val,
Type, CurRec, CurMultiClass);
@ -951,7 +949,9 @@ static Init *ForeachHelper(Init *LHS, Init *MHS, Init *RHS, RecTy *Type,
return DagInit::get(Val, "", args);
}
if (MHSl) {
ListInit *MHSl = dyn_cast<ListInit>(MHS);
if (MHSl && isa<ListRecTy>(Type)) {
std::vector<Init *> NewOperands;
std::vector<Init *> NewList(MHSl->begin(), MHSl->end());
@ -973,7 +973,6 @@ static Init *ForeachHelper(Init *LHS, Init *MHS, Init *RHS, RecTy *Type,
}
return ListInit::get(NewList, MHSl->getType());
}
}
return nullptr;
}