Skip to content

Commit 865f54e

Browse files
committed
[DAG] ISD::is*Load/is*Store - merge isa<>/cast<> calls into single dyn_cast<>. NFCI.
cast<> repeats most of the work that isa<> will have already done (and even calls assert(isa<>) in debug builds) - just use dyn_cast and a pointer check to avoid all this duplicated work.
1 parent 825e4ae commit 865f54e

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

llvm/include/llvm/CodeGen/SelectionDAGNodes.h

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3080,53 +3080,53 @@ namespace ISD {
30803080

30813081
/// Returns true if the specified node is a non-extending and unindexed load.
30823082
inline bool isNormalLoad(const SDNode *N) {
3083-
const LoadSDNode *Ld = dyn_cast<LoadSDNode>(N);
3083+
auto *Ld = dyn_cast<LoadSDNode>(N);
30843084
return Ld && Ld->getExtensionType() == ISD::NON_EXTLOAD &&
3085-
Ld->getAddressingMode() == ISD::UNINDEXED;
3085+
Ld->getAddressingMode() == ISD::UNINDEXED;
30863086
}
30873087

30883088
/// Returns true if the specified node is a non-extending load.
30893089
inline bool isNON_EXTLoad(const SDNode *N) {
3090-
return isa<LoadSDNode>(N) &&
3091-
cast<LoadSDNode>(N)->getExtensionType() == ISD::NON_EXTLOAD;
3090+
auto *Ld = dyn_cast<LoadSDNode>(N);
3091+
return Ld && Ld->getExtensionType() == ISD::NON_EXTLOAD;
30923092
}
30933093

30943094
/// Returns true if the specified node is a EXTLOAD.
30953095
inline bool isEXTLoad(const SDNode *N) {
3096-
return isa<LoadSDNode>(N) &&
3097-
cast<LoadSDNode>(N)->getExtensionType() == ISD::EXTLOAD;
3096+
auto *Ld = dyn_cast<LoadSDNode>(N);
3097+
return Ld && Ld->getExtensionType() == ISD::EXTLOAD;
30983098
}
30993099

31003100
/// Returns true if the specified node is a SEXTLOAD.
31013101
inline bool isSEXTLoad(const SDNode *N) {
3102-
return isa<LoadSDNode>(N) &&
3103-
cast<LoadSDNode>(N)->getExtensionType() == ISD::SEXTLOAD;
3102+
auto *Ld = dyn_cast<LoadSDNode>(N);
3103+
return Ld && Ld->getExtensionType() == ISD::SEXTLOAD;
31043104
}
31053105

31063106
/// Returns true if the specified node is a ZEXTLOAD.
31073107
inline bool isZEXTLoad(const SDNode *N) {
3108-
return isa<LoadSDNode>(N) &&
3109-
cast<LoadSDNode>(N)->getExtensionType() == ISD::ZEXTLOAD;
3108+
auto *Ld = dyn_cast<LoadSDNode>(N);
3109+
return Ld && Ld->getExtensionType() == ISD::ZEXTLOAD;
31103110
}
31113111

31123112
/// Returns true if the specified node is an unindexed load.
31133113
inline bool isUNINDEXEDLoad(const SDNode *N) {
3114-
return isa<LoadSDNode>(N) &&
3115-
cast<LoadSDNode>(N)->getAddressingMode() == ISD::UNINDEXED;
3114+
auto *Ld = dyn_cast<LoadSDNode>(N);
3115+
return Ld && Ld->getAddressingMode() == ISD::UNINDEXED;
31163116
}
31173117

31183118
/// Returns true if the specified node is a non-truncating
31193119
/// and unindexed store.
31203120
inline bool isNormalStore(const SDNode *N) {
3121-
const StoreSDNode *St = dyn_cast<StoreSDNode>(N);
3121+
auto *St = dyn_cast<StoreSDNode>(N);
31223122
return St && !St->isTruncatingStore() &&
3123-
St->getAddressingMode() == ISD::UNINDEXED;
3123+
St->getAddressingMode() == ISD::UNINDEXED;
31243124
}
31253125

31263126
/// Returns true if the specified node is an unindexed store.
31273127
inline bool isUNINDEXEDStore(const SDNode *N) {
3128-
return isa<StoreSDNode>(N) &&
3129-
cast<StoreSDNode>(N)->getAddressingMode() == ISD::UNINDEXED;
3128+
auto *St = dyn_cast<StoreSDNode>(N);
3129+
return St && St->getAddressingMode() == ISD::UNINDEXED;
31303130
}
31313131

31323132
/// Attempt to match a unary predicate against a scalar/splat constant or

0 commit comments

Comments
 (0)