[MLIR][NFC] Remove unnecessary cast.

I was reading this post:
https://www.fluentcpp.com/2017/05/19/crtp-helper/

And I noticed that most likely this cast is not needed.
Unless it is needed by some compiler versions.
I tested it with:
cmake --build . --target check-mlir

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D121555
This commit is contained in:
antonio-cortes-perez 2022-04-04 09:10:27 -07:00 committed by Sergei Grechanik
parent 368d35a894
commit c2a8a104ec
1 changed files with 2 additions and 8 deletions

View File

@ -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<TraitType<ConcreteType> *>(this);
auto *concrete = static_cast<ConcreteType *>(trait);
auto *base = static_cast<OpState *>(concrete);
return base->getOperation();
auto *concrete = static_cast<ConcreteType *>(this);
return concrete->getOperation();
}
};