[llvm-dev] [RFC] Should we add isa_or_null<>?
Don Hinton via llvm-dev
llvm-dev at lists.llvm.org
Thu Apr 4 05:37:04 PDT 2019
I'd like to propose adding `isa_or_null<>` to replace the following usage
pattern that's relatively common in conditionals:
var && isa<T>(var) =>> isa_or_null<T>(var)
And in particular when `var` is a method call which might be expensive,
X->foo() && isa<T>(X->foo()) =>> isa_or_null<T>(X->foo())
The implementation could be a simple wrapper around isa<>, and while the IR
produced is only slightly more efficient, the elimination of an extra call
could be worthwhile.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev