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

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 7 11:01:23 PDT 2022


reames added a comment.

In D123901#3562333 <https://reviews.llvm.org/D123901#3562333>, @bzcheeseman wrote:

> 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.

See https://discourse.llvm.org/t/cast-x-is-broken-implications-and-proposal-to-address/63033

If you could help with the cleanup here, it would be appreciated.


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