The return type of getTypeAllocSize() is TypeSize. We do not rely on the implicit conversion to uint64_t. The return value may be scalable values.
Can we assume their scalable flags must match? In that case, it's best to assert this.
llvm::TypeSize::isKnownLE() should be used with some caution, because isKnownLE(4, vscale x 4) evaluates to true, so if their scalable flags don't match, this may lead to surprising results.
This doesn't seem correct for scalable vectors.