hintonda added a comment.

I looked at the IR generated at `-O2`, and found that while `if (isa<X>(y))` is 
a modest win over `if (dyn_cast<X>(y)`,  `if (dyn_cast_or_null<X>(y))` 
generates exactly the same IR that `if(y && isa<X>(y))` does.  Also, if `y` is 
actually an expression that makes a function call, it's more expensive because 
it will make the call twice.

So I don't seen any reason to replace `dyn_cast_or_null<>` in conditionals.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59802/new/

https://reviews.llvm.org/D59802



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to