summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2015-04-29 07:13:12 +0000
committerCraig Topper <craig.topper@gmail.com>2015-04-29 07:13:12 +0000
commit39ba33b8f02fb91f21620279fe4df735fb59fc0e (patch)
tree08c49fcd28e29966a7fe8c5f995a65b936a3e0ec /llvm/lib
parented5a95080847a7d11bff1226a1a9f14ea5f42943 (diff)
downloadbcm5719-llvm-39ba33b8f02fb91f21620279fe4df735fb59fc0e.tar.gz
bcm5719-llvm-39ba33b8f02fb91f21620279fe4df735fb59fc0e.zip
[TableGen] Fold a couple dyn_casts into the ifs that check their results. NFC
llvm-svn: 236088
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/TableGen/Record.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/llvm/lib/TableGen/Record.cpp b/llvm/lib/TableGen/Record.cpp
index b58a00462a3..b8fc94dd0f6 100644
--- a/llvm/lib/TableGen/Record.cpp
+++ b/llvm/lib/TableGen/Record.cpp
@@ -1007,21 +1007,18 @@ static Init *ForeachHelper(Init *LHS, Init *MHS, Init *RHS, RecTy *Type,
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) {
OpenPOWER on IntegriCloud