[llvm] r236088 - [TableGen] Fold a couple dyn_casts into the ifs that check their results. NFC
Craig Topper
craig.topper at gmail.com
Wed Apr 29 00:13:12 PDT 2015
Author: ctopper
Date: Wed Apr 29 02:13:12 2015
New Revision: 236088
URL: http://llvm.org/viewvc/llvm-project?rev=236088&view=rev
Log:
[TableGen] Fold a couple dyn_casts into the ifs that check their results. 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=236088&r1=236087&r2=236088&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/Record.cpp (original)
+++ llvm/trunk/lib/TableGen/Record.cpp Wed Apr 29 02:13:12 2015
@@ -1007,21 +1007,18 @@ static Init *ForeachHelper(Init *LHS, In
static Init *EvaluateOperation(OpInit *RHSo, Init *LHS, Init *Arg,
RecTy *Type, Record *CurRec,
MultiClass *CurMultiClass) {
- std::vector<Init *> NewOperands;
-
- TypedInit *TArg = dyn_cast<TypedInit>(Arg);
-
// If this is a dag, recurse
- if (TArg && TArg->getType()->getAsString() == "dag") {
- Init *Result = ForeachHelper(LHS, Arg, RHSo, Type,
- CurRec, CurMultiClass);
- return Result;
+ if (TypedInit *TArg = dyn_cast<TypedInit>(Arg)) {
+ if (TArg->getType()->getAsString() == "dag") {
+ Init *Result = ForeachHelper(LHS, Arg, RHSo, Type,
+ CurRec, CurMultiClass);
+ return Result;
+ }
}
+ std::vector<Init *> NewOperands;
for (int i = 0; i < RHSo->getNumOperands(); ++i) {
- OpInit *RHSoo = dyn_cast<OpInit>(RHSo->getOperand(i));
-
- if (RHSoo) {
+ if (OpInit *RHSoo = dyn_cast<OpInit>(RHSo->getOperand(i))) {
Init *Result = EvaluateOperation(RHSoo, LHS, Arg,
Type, CurRec, CurMultiClass);
if (Result) {
More information about the llvm-commits
mailing list