[llvm] 865f54e - [DAG] ISD::is*Load/is*Store - merge isa<>/cast<> calls into single dyn_cast<>. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 16 03:30:44 PST 2023
Author: Simon Pilgrim
Date: 2023-11-16T11:30:15Z
New Revision: 865f54e501739f382d33866baebfd0f9aaad01bb
URL: https://github.com/llvm/llvm-project/commit/865f54e501739f382d33866baebfd0f9aaad01bb
DIFF: https://github.com/llvm/llvm-project/commit/865f54e501739f382d33866baebfd0f9aaad01bb.diff
LOG: [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.
Added:
Modified:
llvm/include/llvm/CodeGen/SelectionDAGNodes.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h
index 4df56aac4aa17ba..05c0b9674e98b96 100644
--- a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h
+++ b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h
@@ -3080,53 +3080,53 @@ namespace ISD {
/// Returns true if the specified node is a non-extending and unindexed load.
inline bool isNormalLoad(const SDNode *N) {
- const LoadSDNode *Ld = dyn_cast<LoadSDNode>(N);
+ auto *Ld = dyn_cast<LoadSDNode>(N);
return Ld && Ld->getExtensionType() == ISD::NON_EXTLOAD &&
- Ld->getAddressingMode() == ISD::UNINDEXED;
+ Ld->getAddressingMode() == ISD::UNINDEXED;
}
/// Returns true if the specified node is a non-extending load.
inline bool isNON_EXTLoad(const SDNode *N) {
- return isa<LoadSDNode>(N) &&
- cast<LoadSDNode>(N)->getExtensionType() == ISD::NON_EXTLOAD;
+ auto *Ld = dyn_cast<LoadSDNode>(N);
+ return Ld && Ld->getExtensionType() == ISD::NON_EXTLOAD;
}
/// Returns true if the specified node is a EXTLOAD.
inline bool isEXTLoad(const SDNode *N) {
- return isa<LoadSDNode>(N) &&
- cast<LoadSDNode>(N)->getExtensionType() == ISD::EXTLOAD;
+ auto *Ld = dyn_cast<LoadSDNode>(N);
+ return Ld && Ld->getExtensionType() == ISD::EXTLOAD;
}
/// Returns true if the specified node is a SEXTLOAD.
inline bool isSEXTLoad(const SDNode *N) {
- return isa<LoadSDNode>(N) &&
- cast<LoadSDNode>(N)->getExtensionType() == ISD::SEXTLOAD;
+ auto *Ld = dyn_cast<LoadSDNode>(N);
+ return Ld && Ld->getExtensionType() == ISD::SEXTLOAD;
}
/// Returns true if the specified node is a ZEXTLOAD.
inline bool isZEXTLoad(const SDNode *N) {
- return isa<LoadSDNode>(N) &&
- cast<LoadSDNode>(N)->getExtensionType() == ISD::ZEXTLOAD;
+ auto *Ld = dyn_cast<LoadSDNode>(N);
+ return Ld && Ld->getExtensionType() == ISD::ZEXTLOAD;
}
/// Returns true if the specified node is an unindexed load.
inline bool isUNINDEXEDLoad(const SDNode *N) {
- return isa<LoadSDNode>(N) &&
- cast<LoadSDNode>(N)->getAddressingMode() == ISD::UNINDEXED;
+ auto *Ld = dyn_cast<LoadSDNode>(N);
+ return Ld && Ld->getAddressingMode() == ISD::UNINDEXED;
}
/// Returns true if the specified node is a non-truncating
/// and unindexed store.
inline bool isNormalStore(const SDNode *N) {
- const StoreSDNode *St = dyn_cast<StoreSDNode>(N);
+ auto *St = dyn_cast<StoreSDNode>(N);
return St && !St->isTruncatingStore() &&
- St->getAddressingMode() == ISD::UNINDEXED;
+ St->getAddressingMode() == ISD::UNINDEXED;
}
/// Returns true if the specified node is an unindexed store.
inline bool isUNINDEXEDStore(const SDNode *N) {
- return isa<StoreSDNode>(N) &&
- cast<StoreSDNode>(N)->getAddressingMode() == ISD::UNINDEXED;
+ auto *St = dyn_cast<StoreSDNode>(N);
+ return St && St->getAddressingMode() == ISD::UNINDEXED;
}
/// Attempt to match a unary predicate against a scalar/splat constant or
More information about the llvm-commits
mailing list