diff --git a/mlir/include/mlir/IR/OpDefinition.h b/mlir/include/mlir/IR/OpDefinition.h index cc9431553ddf2..48bdec9483f84 100644 --- a/mlir/include/mlir/IR/OpDefinition.h +++ b/mlir/include/mlir/IR/OpDefinition.h @@ -322,14 +322,8 @@ class TraitBase { protected: /// Return the ultimate Operation being worked on. Operation *getOperation() { - // We have to cast up to the trait type, then to the concrete type, then to - // the BaseState class in explicit hops because the concrete type will - // multiply derive from the (content free) TraitBase class, and we need to - // be able to disambiguate the path for the C++ compiler. - auto *trait = static_cast *>(this); - auto *concrete = static_cast(trait); - auto *base = static_cast(concrete); - return base->getOperation(); + auto *concrete = static_cast(this); + return concrete->getOperation(); } };