SelectionDAGDumper.cpp - remove nested if-else return chain. NFCI.

Match style and don't use an else after a return.
This commit is contained in:
Simon Pilgrim 2021-07-30 17:49:03 +01:00
parent 986841cca2
commit 3c0b596ecc
1 changed files with 16 additions and 14 deletions

View File

@ -146,9 +146,9 @@ std::string SDNode::getOperationName(const SelectionDAG *G) const {
unsigned IID = cast<ConstantSDNode>(getOperand(OpNo))->getZExtValue(); unsigned IID = cast<ConstantSDNode>(getOperand(OpNo))->getZExtValue();
if (IID < Intrinsic::num_intrinsics) if (IID < Intrinsic::num_intrinsics)
return Intrinsic::getBaseName((Intrinsic::ID)IID).str(); return Intrinsic::getBaseName((Intrinsic::ID)IID).str();
else if (!G) if (!G)
return "Unknown intrinsic"; return "Unknown intrinsic";
else if (const TargetIntrinsicInfo *TII = G->getTarget().getIntrinsicInfo()) if (const TargetIntrinsicInfo *TII = G->getTarget().getIntrinsicInfo())
return TII->getName(IID); return TII->getName(IID);
llvm_unreachable("Invalid intrinsic ID"); llvm_unreachable("Invalid intrinsic ID");
} }
@ -526,13 +526,13 @@ static void printMemOperand(raw_ostream &OS, const MachineMemOperand &MMO,
if (G) { if (G) {
const MachineFunction *MF = &G->getMachineFunction(); const MachineFunction *MF = &G->getMachineFunction();
return printMemOperand(OS, MMO, MF, MF->getFunction().getParent(), return printMemOperand(OS, MMO, MF, MF->getFunction().getParent(),
&MF->getFrameInfo(), G->getSubtarget().getInstrInfo(), &MF->getFrameInfo(),
*G->getContext()); G->getSubtarget().getInstrInfo(), *G->getContext());
} else {
LLVMContext Ctx;
return printMemOperand(OS, MMO, /*MF=*/nullptr, /*M=*/nullptr,
/*MFI=*/nullptr, /*TII=*/nullptr, Ctx);
} }
LLVMContext Ctx;
return printMemOperand(OS, MMO, /*MF=*/nullptr, /*M=*/nullptr,
/*MFI=*/nullptr, /*TII=*/nullptr, Ctx);
} }
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
@ -948,17 +948,19 @@ static bool printOperand(raw_ostream &OS, const SelectionDAG *G,
if (!Value.getNode()) { if (!Value.getNode()) {
OS << "<null>"; OS << "<null>";
return false; return false;
} else if (shouldPrintInline(*Value.getNode(), G)) { }
if (shouldPrintInline(*Value.getNode(), G)) {
OS << Value->getOperationName(G) << ':'; OS << Value->getOperationName(G) << ':';
Value->print_types(OS, G); Value->print_types(OS, G);
Value->print_details(OS, G); Value->print_details(OS, G);
return true; return true;
} else {
OS << PrintNodeId(*Value.getNode());
if (unsigned RN = Value.getResNo())
OS << ':' << RN;
return false;
} }
OS << PrintNodeId(*Value.getNode());
if (unsigned RN = Value.getResNo())
OS << ':' << RN;
return false;
} }
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)