Skip to content

Is DataLayout::getAlignment for TargetExtType unreachable? #71388

Closed
@pmatos

Description

@pmatos

It looks as though the switch case:

case Type::TargetExtTyID: {
    Type *LayoutTy = cast<TargetExtType>(Ty)->getLayoutType();
    return getAlignment(LayoutTy, abi_or_pref);
  }

in DataLayout.cpp::getAlignment is unreachable due to the initial assert:
assert(Ty->isSized() && "Cannot getTypeInfo() on a type that is unsized!");.

Type::isSized() has the following case which returns false for TargetExtTyID:

    if (getTypeID() != StructTyID && getTypeID() != ArrayTyID &&
        !isVectorTy() && getTypeID() != TargetExtTyID)
      return false;

Do we need to improve the check in isSized with for example:

if (getTypeID() == TargetExtTyID)
  return getLayoutType()->isSized();

?

Metadata

Metadata

Labels

llvm:irquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions