Change isa<> to a variadic function template, so that it can be used to test against one of multiple types as follows:
isa<Type0, Type1, Type2>(Val)
Differential D81045
[LLVM] Change isa<> to a variadic function template jurahul on Jun 2 2020, 5:43 PM. Authored by
Details Change isa<> to a variadic function template, so that it can be used to test against one of multiple types as follows: isa<Type0, Type1, Type2>(Val)
Diff Detail
Unit Tests
Event TimelineComment Actions Thanks, added a couple of comments.
Comment Actions @rriddle and others, I have extended the isa<> function to be a variadic template, but that is causing a ripple effect of several places breaking where isa<> is used as a predicate and instantiate using something like: if (SCEVExprContains(T, isa<SCEVUnknown, const SCEV *>)) with the new isa<> definition, such code does not work as is and needs to updated. I am working on fixing all references, but I am wondering if this will cause churn in out-of-tree code that uses LLVM as well. I cannot call the new functions is_one_of as there already exists a struct of this type with a different meaning. Another option is to name it isa_one_of but that does not read well I think. Do you agree with extending isa<> as in this change? If so, I can continue patching the remaining places (once I setup a windows build). Comment Actions fix MLIR test failure due to change in error message. Reinstate the old message for a single parent case Comment Actions This is ready for review. The 2 Clang hip related failure are not caused by this change, and the offending change has been reverted now (http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20200601/323475.html)
Comment Actions I have run into the desire to have this on many occasions, so LGTM for me.
|
nit: We could also update this to use llvm::erase_if, but fine to leave as is.