forked from OSchip/llvm-project
NFC: Change `classof` on registered operations to use pointer comparison.
The current implementation always uses string comparison, but if the operation is registered the AbstractOperation instance can be used to provide faster pointer comparison. PiperOrigin-RevId: 272041333
This commit is contained in:
parent
c97a9320a0
commit
8e67039e31
|
@ -923,10 +923,9 @@ public:
|
|||
Region *getParentRegion() { return getOperation()->getParentRegion(); }
|
||||
|
||||
/// Return true if this "op class" can match against the specified operation.
|
||||
/// This hook can be overridden with a more specific implementation in
|
||||
/// the subclass of Base.
|
||||
///
|
||||
static bool classof(Operation *op) {
|
||||
if (auto *abstractOp = op->getAbstractOperation())
|
||||
return &classof == abstractOp->classof;
|
||||
return op->getName().getStringRef() == ConcreteType::getOperationName();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue