[PATCH] D123901: [LLVM][Casting.h] Update dyn_cast machinery to provide more control over how the casting is performed.

Aman LaChapelle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 6 20:47:35 PDT 2022


bzcheeseman added a comment.

In D123901#3561964 <https://reviews.llvm.org/D123901#3561964>, @reames wrote:

> Is there any chance that this change removed the assert on cast<X> that the thing being pointed to isa<X>?  I'm looking at a local case where I have cast<FixedVectorType(T) succeeding on something which clearly *isn't* a fixed vector, and isa<FixedVectorType>(T) returning false on the same pointer.  Its possible that I'm looking at some weird bit of undefined behavior, but since I can't find where the corresponding assert is in the new version of the code, I wanted to ask.

That looks like what happened, yep. I meant to add it to the default implementation of `doCast` (so that you don't have to pay the price of `isa`) but apparently forgot to do so. I'll try and get to this when I get the chance - and clean up all the assert usage at once. If you need it urgently, asserting `isa<T>` inside `cast` is fine for now and I can come back and clean things up later.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123901



More information about the llvm-commits mailing list