[llvm] 17310f3 - [SelectionDAG][NFC] Address a few clang-tidy warnings
Fraser Cormack via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 8 08:33:51 PST 2022
Author: Fraser Cormack
Date: 2022-03-08T16:22:26Z
New Revision: 17310f3d19b8b2af2bf0a255810d7d3bd713a10b
URL: https://github.com/llvm/llvm-project/commit/17310f3d19b8b2af2bf0a255810d7d3bd713a10b
DIFF: https://github.com/llvm/llvm-project/commit/17310f3d19b8b2af2bf0a255810d7d3bd713a10b.diff
LOG: [SelectionDAG][NFC] Address a few clang-tidy warnings
Fix a couple of else-after-return warnings and some unnecessary
parentheses.
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 2f8bf720417db..4e7eeeed1bb57 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -1639,7 +1639,9 @@ SDValue SelectionDAGBuilder::getValueImpl(const Value *V) {
Ops.push_back(getValue(CV->getOperand(i)));
return NodeMap[V] = DAG.getBuildVector(VT, getCurSDLoc(), Ops);
- } else if (isa<ConstantAggregateZero>(C)) {
+ }
+
+ if (isa<ConstantAggregateZero>(C)) {
EVT EltVT =
TLI.getValueType(DAG.getDataLayout(), VecTy->getElementType());
@@ -1651,12 +1653,12 @@ SDValue SelectionDAGBuilder::getValueImpl(const Value *V) {
if (isa<ScalableVectorType>(VecTy))
return NodeMap[V] = DAG.getSplatVector(VT, getCurSDLoc(), Op);
- else {
- SmallVector<SDValue, 16> Ops;
- Ops.assign(cast<FixedVectorType>(VecTy)->getNumElements(), Op);
- return NodeMap[V] = DAG.getBuildVector(VT, getCurSDLoc(), Ops);
- }
+
+ SmallVector<SDValue, 16> Ops;
+ Ops.assign(cast<FixedVectorType>(VecTy)->getNumElements(), Op);
+ return NodeMap[V] = DAG.getBuildVector(VT, getCurSDLoc(), Ops);
}
+
llvm_unreachable("Unknown vector constant");
}
@@ -1680,11 +1682,12 @@ SDValue SelectionDAGBuilder::getValueImpl(const Value *V) {
return RFV.getCopyFromRegs(DAG, FuncInfo, getCurSDLoc(), Chain, nullptr, V);
}
- if (const MetadataAsValue *MD = dyn_cast<MetadataAsValue>(V)) {
+ if (const MetadataAsValue *MD = dyn_cast<MetadataAsValue>(V))
return DAG.getMDNode(cast<MDNode>(MD->getMetadata()));
- }
+
if (const auto *BB = dyn_cast<BasicBlock>(V))
return DAG.getBasicBlock(FuncInfo.MBBMap[BB]);
+
llvm_unreachable("Can't get register for value!");
}
More information about the llvm-commits
mailing list