Remove usages of asserting vector getters in Type in preparation for the
VectorType refactor. The existence of these functions complicates the
refactor while adding little value.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/include/llvm/CodeGen/BasicTTIImpl.h | ||
---|---|---|
85 | I spoke to this a bit in D77259. Realistically, for this example, in debug you'll get a slightly more readable assert message. In release, you'll get a null dereference in getVectorInstrCost vs (I assume) a template error in the cast. From a debugging perspective, the second situation is almost certainly preferable, but just doing the cast will be better for performance. I'll fix it. |
LGTM!
llvm/include/llvm/CodeGen/BasicTTIImpl.h | ||
---|---|---|
85 | Thanks! In this case the only difference for a release build would be that VTy would be nullptr when using dyn_cast, and would be Ty when using cast. I don't think the use of cast gives a template error. |
llvm/include/llvm/CodeGen/BasicTTIImpl.h | ||
---|---|---|
85 | I guess in a just world, you'd get a "types unrelated" error. But since it just does a c-style cast, it's probably just UB. |
Can we just use cast<> and get rid of the separate assert below? We'd lose the message, but I'm not sure how useful that is, given that the context makes it quite obvious.