Issue 71388
Summary Is DataLayout::getAlignment for TargetExtType unreachable?
Labels llvm:ir
Assignees jcranmer-intel
Reporter 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();
```
?
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to