Skip to content

Commit d1d9db5

Browse files
committed
use auto with dyn_casted values; NFC
llvm-svn: 256581
1 parent e3773d6 commit d1d9db5

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2088,8 +2088,7 @@ TargetLowering::SimplifySetCC(EVT VT, SDValue N0, SDValue N1,
20882088
/// node is a GlobalAddress + offset.
20892089
bool TargetLowering::isGAPlusOffset(SDNode *N, const GlobalValue *&GA,
20902090
int64_t &Offset) const {
2091-
if (isa<GlobalAddressSDNode>(N)) {
2092-
GlobalAddressSDNode *GASD = cast<GlobalAddressSDNode>(N);
2091+
if (auto *GASD = dyn_cast<GlobalAddressSDNode>(N)) {
20932092
GA = GASD->getGlobal();
20942093
Offset += GASD->getOffset();
20952094
return true;
@@ -2099,14 +2098,12 @@ bool TargetLowering::isGAPlusOffset(SDNode *N, const GlobalValue *&GA,
20992098
SDValue N1 = N->getOperand(0);
21002099
SDValue N2 = N->getOperand(1);
21012100
if (isGAPlusOffset(N1.getNode(), GA, Offset)) {
2102-
ConstantSDNode *V = dyn_cast<ConstantSDNode>(N2);
2103-
if (V) {
2101+
if (auto *V = dyn_cast<ConstantSDNode>(N2)) {
21042102
Offset += V->getSExtValue();
21052103
return true;
21062104
}
21072105
} else if (isGAPlusOffset(N2.getNode(), GA, Offset)) {
2108-
ConstantSDNode *V = dyn_cast<ConstantSDNode>(N1);
2109-
if (V) {
2106+
if (auto *V = dyn_cast<ConstantSDNode>(N1)) {
21102107
Offset += V->getSExtValue();
21112108
return true;
21122109
}

0 commit comments

Comments
 (0)