diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2015-04-10 11:24:51 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2015-04-10 11:24:51 +0000 |
commit | 619c4e57ba8d8caac7a0ce41c403427f47ab50ee (patch) | |
tree | 7e2e5cdff47178c8a291f148e1fe08dfe72a144c /llvm/lib/CodeGen/SelectionDAG | |
parent | e9c336aeb53b4137c214aa119067803f6464fae8 (diff) | |
download | bcm5719-llvm-619c4e57ba8d8caac7a0ce41c403427f47ab50ee.tar.gz bcm5719-llvm-619c4e57ba8d8caac7a0ce41c403427f47ab50ee.zip |
Reduce dyn_cast<> to isa<> or cast<> where possible.
No functional change intended.
llvm-svn: 234586
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 14 | ||||
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp | 2 |
2 files changed, 8 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 2b169b755fe..37263ff78a8 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -1984,12 +1984,12 @@ SDValue DAGCombiner::visitMUL(SDNode *N) { N0IsConst = isConstantSplatVector(N0.getNode(), ConstValue0); N1IsConst = isConstantSplatVector(N1.getNode(), ConstValue1); } else { - N0IsConst = dyn_cast<ConstantSDNode>(N0) != nullptr; - ConstValue0 = N0IsConst ? (dyn_cast<ConstantSDNode>(N0))->getAPIntValue() - : APInt(); - N1IsConst = dyn_cast<ConstantSDNode>(N1) != nullptr; - ConstValue1 = N1IsConst ? (dyn_cast<ConstantSDNode>(N1))->getAPIntValue() - : APInt(); + N0IsConst = isa<ConstantSDNode>(N0); + if (N0IsConst) + ConstValue0 = cast<ConstantSDNode>(N0)->getAPIntValue(); + N1IsConst = isa<ConstantSDNode>(N1); + if (N1IsConst) + ConstValue1 = cast<ConstantSDNode>(N1)->getAPIntValue(); } // fold (mul c1, c2) -> c1*c2 @@ -11662,7 +11662,7 @@ SDValue DAGCombiner::visitEXTRACT_SUBVECTOR(SDNode* N) { // type. if (V->getOperand(0).getValueType() != NVT) return SDValue(); - unsigned Idx = dyn_cast<ConstantSDNode>(N->getOperand(1))->getZExtValue(); + unsigned Idx = N->getConstantOperandVal(1); unsigned NumElems = NVT.getVectorNumElements(); assert((Idx % NumElems) == 0 && "IDX in concat is not a multiple of the result vector length."); diff --git a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp index 150dac34f05..a9ffa728228 100644 --- a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp @@ -626,7 +626,7 @@ SelectionDAGBuilder::LowerStatepoint(ImmutableStatepoint ISP, // Add a leading constant argument with the Flags and the calling convention // masked together CallingConv::ID CallConv = CS.getCallingConv(); - int Flags = dyn_cast<ConstantInt>(CS.getArgument(2))->getZExtValue(); + int Flags = cast<ConstantInt>(CS.getArgument(2))->getZExtValue(); assert(Flags == 0 && "not expected to be used"); Ops.push_back(DAG.getTargetConstant(StackMaps::ConstantOp, MVT::i64)); Ops.push_back( |